# Mini-project 2: Basic mesh processing

## Due: Tues, March 18 (11:59 PM)

The goal of this project is to implement a few simple geometry processing algorithms such as mesh smoothing and subdivision.
This will allow one to gain intuition for how to modify meshes programmatically.
## Starter Code

The C++ starter code can be used if you desire. Open the solution or run `make`

to build `meshpro`

and `mesh_view`

. I have included one mesh in the `meshes`

subdirectory but more are available in a zip file. See Project 1 for more information on the starter code.

Your goal is to implement Taubin smoothing and Loop subdivision:
- Implement Taubin smoothing. You can implement this in
`R3Mesh::Taubin(double lambda, double mu, int iters)`

.

The algorithm is described in Sections 2 and 3 of the paper. Each vertex **p**_{i} is iteratively moved in the direction of the mesh Laplacian **∇p**_{i} by a positive factor λ (smoothing/shrinking step). After this has been done on all vertices, each vertex is then moved by a negative factor μ (inflation step). This is shown in the diagram below:

- Implement Loop subdivision, as shown in slides 12-17, or Loop's Masters thesis. This involves replacing each triangle face with 4 subdivided faces, as shown below:

First, vertex positions for "odd" (new/grey) vertices are set based on weighted averages of the 4 vertices on the adjacent two faces. Second, the "even" (old/black) vertices are updated based on a weighted average of the 6 surrounding newly introduced "odd" vertices. These weighting schemes are shown below, and in the slides:

You can implement this subdivision scheme in `R3Mesh::Loop()`

. For simplicity, you can assume all mesh faces are triangles: non-triangular faces can simply be skipped. Some care needs to be taken in the implementation because adjacent triangles share vertices in both the original and subdivided mesh (e.g. duplicated vertices are not desireable).

- Alternatively instead of implementing subdivision you can implement bilateral mesh denoising. Or if you have another interest feel free to propose that and get approval from me.

After implementing these you should be able to use the command-line options:meshpro in.off out.off -taubin lambda mu iters
meshpro in.off out.off -loop

## Policies

Feel free to collaborate on solving the problem but write your code individually.
## Submission

Submit your assignment in a zip file named `yourname_project2.zip`

.

Include your code, and screenshots of before/after results of your Taubin smoothing and Loop subdivision. For Loop subdivision use a low polygon model such as `bump8x8.off`

in the meshes archive. Use the E key to turn on viewing of edges to verify that there are more triangles after subdivision.

Submit your zip to UVA Collab.