Skip to content
Simon Dietz edited this page Nov 21, 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
  • Implement Snap to ground modifier

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
  • Format changes of the README.md according to max line length = 80
  • Let's have some fun and implement a low poly barrel creator based on Grant Abbitts tutorial: https://www.youtube.com/watch?v=0jWLjAaIEMg&t=450s

Dev Diary

Today, I decided to not only test and refactor my library but also actively expand it. Specifically, I implemented a new MeshCreator focused on procedural assets. I used a Blender tutorial by Grant Abbitt (https://www.youtube.com/watch?v=0jWLjAaIEMg&t=450s) as a reference to create a low-poly barrel.

My goal was to procedurally generate this asset using my library, thus expanding it and honing my skills. This approach offers several advantages:

  • Learning Process: It forces me to think creatively about how to achieve the desired result using the existing tools in my library.
  • Documentation: I can document my development process and share my solutions with others.
  • Enjoyment: It's simply fun to actively use the library and create something new.

First Steps:

I watched the tutorial carefully and considered how to implement the individual steps using my library. Initially, I focused on the simpler variant and omitted details like indentations.

Implementation:

First, I defined the parameters that describe my barrel:

  • Cylinder: Number of segments, radius
  • Metal Rings: Height, thickness
  • Wooden Part: Height of the bottom, middle, and top sections

Dev Diary

11-20-2024

  • Further refactoring of the Mesh3D class
  • Further refactoring of the Mesh3DUtil class
  • Started knowledge collection
Clone this wiki locally