Assignment #2:
Mesh Simplifier

Submission date: Friday, 10/15/21, 23:59

Objective:

Implement edge-collapses based mesh simplifiers. Experience the difference between understanding a geometry processing algorithm on a theoretical level and actually implementing it.

Tasks:

1. Implement an edge collapse based simplifier - here you will need to write the edge collapse code yourself, as well as provide all the data-structures/visualization necessary to run and debug your method. Use the QSLIM metric discussed in class and the rest of the features necessary for a complete simplifier. An example of what your simplifier should do is here.

BONUS:

• Implement a vertex-removal based simplifier with a metric of your choice. Write the appropriate removal and hole triangulation code yourself. Try to develop a method for smart hole triangulation which ensures that triangle normals do not flip (decide what to do if no such triangulation exists)
• Combine your simplifier with a progressive data-structure to allow mesh restoration to any size. Note that in this case you would need to store enough information to undo each edge collapse. In this case your API should support a restore operation that reverts the mesh to any previous size (number of vertices). Allowed sizes should be between the current and the original ones.
The size of the bonus will be at the discretion of the marker.

Instructions:

1. Download the latest version of minimesh.
2. Implement an edge-collapse based simplifier based on the QSLIM metric discussed in class. Your code should compute the new position/error metric per edge; use this value to order edges in a queue; collapse the top edge (if the collapse is valid, i.e.does not create illegal topology); and update the queue accordingly. You must disallow edge collapses if they create illegal topology. Based on a user input (provided via the simplifier window) it should simplify the mesh as instructed, by collapsing as many edges as specified, in an order determined by the metric.
3. In the simplifier:
• Have the correct termination criteria. Support as many collapse operations as possible without violating validity (illegal topology & crashing).
• Use the visualization functionality discussed below to help you debug and test your code.
• Pay attention to efficiency and robustness.
• While you should work independently, it is a good idea to compare your results with other students, to verify code correctness.
4. You can make the following assumptions in your work:
• Your simplifier should only work correctly on closed manifold meshes.
• You can use any available minimesh code for your assignment.
5. Your API should support the following mesh operations, performed repeatedly and in any order:
• Initialize the simplifier (compute error and order edges in queue).
• Perform a single simplification step, colleapsing one edge.
• Simplify the mesh by a user specified amount (or alternatively to a user specified size).
6. To visualize the simplification process and ensure correctness, use the visualization tools provided in minimesh to visualize the top 10 edge candidates for collapse. You can call Mesh_buffer::set_XXX_colors() to color the mesh, where XXX can be faces or vertices. Make sure that the color is updated after the user specified number of simplification operations is finished and that the current top candidate edge is highlighted.
7. Test for illegal operations (e.g. running simplification when no mesh is loaded) and issue an appropriate error message if one is performed.

Submission:

• Write a README file containing your name and how to run your code.
• Use the same procedure as assignment 1 to use the hand-in system to submit your assignment.
• Don't forget to hand in your assignment by Friday, 10/15/21, at 23:59.

You can use your grace days (if you still have them). No late assignments, beyond those, will be accepted.

This assignment is 15% of your final grade.

Visualization:

First of all, make sure you download the latest version of minimesh. The "Mesh_buffer" class contains two function "set_face_colors" and "set_vertex_colors" which sets the colors of vertices or faces. Note that Mesh_buffer expects the colors to be in a continuous order. Therefore, if the mesh is fragmented the color of vertex i must be inside the defrag_map.old2new_vertices[i]th column of the matrix that you pass to "set_vertex_colors".