Mini Maya

OpenGL / C++ / Qt

I created a rudimentary version of Autodesk Maya with several key features such as vertex transformations, edge splitting, face extrusion, triangulation, and Catmull-Clark subdivision. The mesh data is stored in a half-edge data structure with three major components: vertices, half-edges, and faces. A complex system of pointers stored within each data type allows for efficient transversal across the mesh. One edge is made up of two half-edges from adjacent faces. 

Split Edge

splitEdge.PNG

According to the half-edge data structure, every half edge points to the next half-edge in its loop, a half-edge on the adjacent face, the face it belongs to, and the vertex in between it and the next half-edge. In addition, every vertex points to the half-edge that points to it.

By this pointer system, we can split an edge by adding two half-edges and a vertex to an original edge.

 

This requires some maneuvering within the pointer system in order to maintain the correct edge loop order and adjacent edges. 

Subdivision

In order to subdivide a face, I stored "centroids" with their corresponding face in a centroid map. Since the centroid's position is in the perfect center of the face, I used it to calculate the adjusted positions for vertices when the mesh needed to be "smoothed". 

Additionally I needed to split a single face into four faces, or quandrangulate it. This required adding midpoints in between original vertices, and new centroids and half-edges for every face. I drew the attached diagram (below) to help me visualize what exactly this function is doing.

subdivision_notes.jpg