## Examples for Assignment 2

Note: You can hover on any image to see the original high resolution version.

### Rotation

` rotate( mesh, rotate )`
Rotates a mesh ( or a selected part ) around an axis by number specified in the sliders. The unit used for rotation is radians.
 cube.obj rotateX -0.8 cube.obj (selection) rotateX -0.8

### Twist

` twist( mesh, factor )`
Rotates all vertices v along the Y axis by v.position.y * factor. The units are again radians.
 large_cube.obj twist 1 large_cube.obj twist 2

### Inflate

` inflate( mesh, factor )`
Moves all vertices in the direction of their respective vertex normals, proportional to a factor. For the cube, this operation will give a scaling effect.
 cube.obj inflate -1 cube.obj inflate 1 hand.obj inflate -0.1 hand.obj inflate 0.1
It is possible to augment this operation by averageEdgeLength. This will give nicer results for the inflated hand - the creases are better preserved, and the inflate operation is now aware of the mesh scale.
 cube.obj inflate -1 cube.obj inflate 1 hand.obj inflate -1 hand.obj inflate 1

### Noise

` twist( mesh, factor )`
Moves all vertices in the direction of their respective vertex normals, proportional to mesh.averageEdgeLength(v) * factor * randomIn( -1, 1 ).
 large_cube.obj noise 0.5 large_cube.obj noise 1

### Smooth

` smooth( mesh, iter )`
This operation needs to be applied iter number of times. For each iteration, the vertices should be moved to the weighted average of itself and its neighbors. Be careful when updating the position. During a single iteration you want to use original positions throughout the entire computation. Update the actual positions of the vertices only after all new locations have been calculated.
 large_cube.obj smooth 1 large_cube.obj smooth 10 cheetah.obj smooth 1 cheetah.obj smooth 10

### Sharpen

` sharpen( mesh, iter )`
This operation needs to be applied iter number of times, similarly to smooth. If you are having display issues consider checking triangulate. ( Assuming you have implemented the triangulate filter )
 cheetah.obj sharpen 0 cheetah.obj sharpen 1 cheetah.obj sharpen 2 cheetah.obj sharpen 3

### Curvature

` curvature( mesh )`
Depending on your choice of visualization, your results might vary greatly from this. However for the cheetah, what you should be seeing is high curvature values (bright yellow in our visualization) in places like the claws, nostrils or ears, and low curvature values (blue in our visualization) around the claws. This is due to the fact that Gaussian curvature is defined as product of principal curvatures. Your final colors will vary depending on what method you use to map the curvature to a suitable range for the colors. Notice that for the cube, all the vertices have the same value so they are all mapped to mid gray.
 cube.obj curvature cheetah.obj curvature cow.obj curvature

### Truncate

` truncate( mesh, factor )`
Creates an effect where each vertex is "cut off". It is possible to accomplish this using the splitEdge() and splitFace() functions. Topologically we are only adding vertices, so there is no need to remove any vertices. Think about the necessary topological and geometrical changes.
 cube.obj truncate 0.2 cube.obj truncate 0.4 cube.obj (selected) truncate 0.4

### Extrude

` extrude( mesh, factor )`
The vertices of each face should be duplicated and moved along the normal of the face. The original face should be attached to the duplicated vertices. The set of original vertices and duplicated vertices should be connected together by new faces. This feature requires you to modify the half edge data structure by using the splitFaceMakeEdge(...), joinEdgeKillVertex( v1, v2, v3 ), and splitEdgeMakeVertex( v1, v2, f ) functions. Make sure you familiarize yourself with these functions before starting to code this one!
 cube.obj extrude 1 cube.obj (selected) extrude 1

### Bevel

` bevel( mesh, factor )`
Creates the effect where each edge is "cut off". Please refer to the precept 5 slides for some tips on implementing this feature.
 cube.obj bevel 0.2 dodacahedron.obj bevel 0.2 tetrahedron.obj bevel 0.2 cube.obj bevel 0.2 dodacahedron.obj bevel 0.2 tetrahedron.obj bevel 0.2

### Split Long Edges

` splitLong( mesh, factor )`
Splits the longest edge in the mesh. Depending on the choice of which vertices you selected to connect to a newly created one, you can obtain different results. Notice that as you go through the iterations one of the newly added edges might be the longest one.
 cube.obj splitLong 0.1 cube.obj splitLong 0.5 cube.obj splitLong 1.0

### Triangle Topology

` triSubdiv( mesh, levels )`
Splits each face into triangles. This effect is applied levels number of times. The mesh should be triangulated before using this function. In the example images, the input tetrahedron has been scaled (5) and rotated (1.57) for visualization purposes.
 tetrahedron.obj triSubdiv 1 tetrahedron.obj triSubdiv 3

### Loop Subdivision

` loop( mesh, levels )`
Splits each face into triangles. This effect is applied levels number of times. The mesh should be triangulated before using this function. In the example images, the input tetrahedron has been scaled (10) and rotated (1.57) for visualization purposes. In these examples, we have used Warren weights.
 tetrahedron.obj triSubdiv 1 tetrahedron.obj triSubdiv 3 cheetah.obj triSubdiv 1 cheetah.obj triSubdiv 3 tetrahedron.obj triSubdiv 1 tetrahedron.obj triSubdiv 3 cheetah.obj triSubdiv 1 cheetah.obj triSubdiv 3

` quadSubdiv( mesh, levels )`
` catmullClark( mesh, levels )`