Skip to content
Simon Dietz edited this page Nov 20, 2024 · 22 revisions
  • The ScaleModifier has the potential for parallelism.
  • The ScaleModifier does not need to scale if scale = 1
  • Provide seed for the NoiseModifier -> testing
  • The TranslateModifier does not need to translate if deltaX == deltaY == deltaZ == 0

Refactoring Plan: Mesh3D Class

  • Goal To improve the extensibility, maintainability, and testability of the Mesh3D class by applying the Open-Closed Principle.

  • Approach Identify Modification Operations: Identify all operations that modify the mesh, such as rotation, scaling, translation, smoothing, subdivision, etc.

  • Refactor Existing Operations: Convert existing modification methods (e.g., rotateX, scale) into MeshModifier classes. Remove these methods from the Mesh3D class.

Mesh Modifier Descriptions

Basic Modifiers

  • BendModifier: Bends the mesh along a specified axis.
  • BevelEdgesModifier: Creates a bevel along the edges of the mesh.
  • BevelFacesModifier: Creates a bevel around the faces of the mesh.
  • BevelVerticesModifier: Creates a bevel around the vertices of the mesh.
  • CenterAtModifier: Centers the mesh at a specific point.
  • CrocodileModifier:
  • ExtrudeModifier: Extrudes the faces of the mesh along their normals.
  • FitToAABBModifier: Scales and /translates???/ the mesh to fit within an axis-aligned bounding box.
  • FlipFacesModifier: Flips the orientation of the faces of the mesh.
  • HolesModifier: Creates holes in the mesh.
  • InsetModifier: Insets the faces of the mesh inward.
  • NoiseModifier: Adds noise to the vertex positions of the mesh. Normals!
  • PushPullModifier: Pushes or pulls the faces of the mesh along their normals.
  • RemoveDoubleVerticesModifier: Removes duplicate vertices from the mesh.
  • RotateXModifier: Rotates the mesh around the X-axis.
  • RotateYModifier: Rotates the mesh around the Y-axis.
  • RotateZModifier: Rotates the mesh around the Z-axis.
  • ScaleModifier: Scales the mesh uniformly or non-uniformly.
  • SmoothModifier: Smoothes the mesh by averaging vertex positions. ???
  • SolidifyModifier: Adds thickness to the faces of the mesh.
  • SpherifyModifier: Spherifies the mesh.
  • TranslateModifier: Translates the mesh.
  • UpdateFaceNormalsModifier Updates the face normals of the mesh.
  • WireframeModifier: Converts the mesh to a wireframe representation. ???

Subdivision Modifiers

  • CatmullClarkModifier: Subdivides the mesh using the Catmull-Clark subdivision scheme.
  • DooSabinModifier: Subdivides the mesh using the Doo-Sabin subdivision scheme.
  • LinearSubdivisionModifier: Subdivides the mesh using a linear subdivision scheme.
  • PlanarMidEdgeCenterModifier: Subdivides the mesh by splitting edges and connecting their midpoints.
  • PlanarMidEdgeModifier: Subdivides the mesh by splitting edges and connecting their midpoints to the face centroids.
  • PlanarVertexCenterModifier: Subdivides the mesh by connecting vertices to face centroids.
  • PlanarVertexMidEdgeCenterModifier: Subdivides the mesh by connecting vertices, edge midpoints, and face centroids.
  • PokeFacesModifier: Adds a vertex to the center of each face.
  • QuadsToTrianglesModifier: Converts quad faces to triangles.

Dev Diary

11-19-2024

  • Unit testing of TranslateModifier

Dev Diary

11-18-2024

  • Goal: Further refactoring of the mesh class following the refactoring plan.
  • Removed the update face normals method from the mesh class. Implemented a new modifier UpdateFaceNormalsModifier
  • Removed the scaled copy from the mesh class
  • The scaled copy should live as own creator class. The current implementation was wrong anyways, caus it did not copy face attributes.

// public Mesh3D scaledCopy(Vector3f scale) { // Mesh3D copy = new Mesh3D(); // List vertices = copy.vertices; // List faces = copy.faces; // // for (Vector3f v : this.vertices) // vertices.add(new Vector3f(v).multLocal(scale)); // // for (Face3D f : this.faces) // faces.add(new Face3D(f)); // // return copy; //}

  • Removed the getSelection(String tag) from the mesh class. It exists as face selection option already and it is not used within the library.
  • Removed rotateX from the mesh class
Clone this wiki locally