Examples for Assignment 2

Note: You could hover on any images to see the original (high resolution) ones.

Rotation

 rotate( mesh, rotate )
Rotates a mesh ( or a selected part ) around selected axis, by number specified in the sliders. Unit used for rotation is radian.
rotate_1.png
cube.obj rotateX -0.8
rotate_2.png
cube.obj (selection) rotateX -0.8

Twist

 twist( mesh, factor )
All vertices v are rotated along the Y axis by v.position.y * factor. Units are again radians.
twist_1.png
large_cube.obj twist 1
twist_2.png
large_cube.obj twist 2

Inflate

 inflate( mesh, factor )
All vertices are moved along the direction of respective vertex normals, proportional to factor. For a cube.obj this operation will give scaling effect.
inflate_1.png
cube.obj inflate -1
inflate_2.png
cube.obj inflate 1
inflate_4.png
hand.obj inflate -0.1
inflate_3.png
hand.obj inflate 0.1
It is possible to augment this operation by averageEdgeLength. This will give us nicer results for inflated hand - the creases are better preserved, and the inflate operation is now aware of the mesh scale.
inflate_factor_1.png
cube.obj inflate -1
inflate_factor_2.png
cube.obj inflate 1
inflate_factor_4.png
hand.obj inflate -1
inflate_factor_3.png
hand.obj inflate 1

Noise

 twist( mesh, factor )
All vertices are moved along the direction of respective vertex normals, proportional to mesh.averageEdgeLength(v) * factor * randomIn( -1, 1 ).
noise_2.png
large_cube.obj noise 0.5
noise_1.png
large_cube.obj noise 1

Smooth

 smooth( mesh, iter )
This operation needs to be applied iter number of times. Each iteration vertices should be moved to the weighted average of its neighbors. Be careful when updating the position as during 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.
smooth_gauss_1.png
large_cube.obj smooth 1
smooth_gauss_2.png
cube.obj smooth 10
smooth_gauss_4.png
cheetah.obj smooth 1
smooth_gauss_3.png
cheetah.obj smooth 10

Sharpen

 sharpen( mesh, iter )
This operation needs to be applied iter number of times, similarly to smooth. If you having display issues consider checking triangulate. ( Assumes you have implemented triangulate filter )
sharpen_1.png
cheetah.obj sharpen 0
sharpen_2.png
cheetah.obj sharpen 1
sharpen_3.png
cheetah.obj sharpen 2
sharpen_4.png
cheetah.obj sharpen 3

Curvature

 curvature( mesh )
Depending on your choice of visualization, your results might greatly vary from this. However, for cheetah, what you should be seeing is high ( white in our visualization ) values in places like claws, nostrils or ears, and low ( black in our visualization ) around the claws. This due to the fact that Gaussian curvature is defined as product of principal curvatures.
curvature_1.png
cheetah.obj curvature
curvature_2.png
cheetah.obj curvature
curvature_3.png
cheetah.obj curvature

Truncate

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

Extrude

 extrude( mesh, factor )
Vertices of each face should be duplicated and moved along the normal of the face. Original face should be attached to duplicated vertices. Set of original vertices and duplicated vertices should be connected together by new faces. This feature requires you to modify half edge data structure by using addVertex( position ), addFace(), and addHalfedge( v1, v2, f ) functions. Make sure you familiarize yourself with those!
addHalfedge( v1,v2,f ) will create halfedge going from v1 to v2 pointing to face f. This means returned halfedge object will point to vertex v2, and face f. This method will also modify vertex v1 outgoing halfedge to be the newly created one. You will need to relink the opposite and next halfedges manually. For reference you can look at provided splitEdge() and splitFace() methods.
extrude_1.png
cube.obj extrude 1
extrude_2.png
cube.obj (selected) extrude 1

Bevel

 bevel( mesh, factor )
This effect should create effect where each edge is "cut off". Please refer to the precept 5 slides for some tips on implementing this feature.
bevel_1.png
cube.obj bevel 0.2
bevel_3.png
dodacahedron.obj bevel 0.2
bevel_5.png
tetrahedron.obj bevel 0.2
bevel_2.png
cube.obj bevel 0.2
bevel_4.png
dodacahedron.obj bevel 0.2
bevel_5.png
tetrahedron.obj bevel 0.2

Split Long Edges

 splitLong( mesh, factor )
Depending on the choice of which vertices you selected to connect to a newly created one, you can obtain different results. Behavior you should be observing is splitting of the longest edge. Notice that as you go through iterations one of the newly added edges might be the longest one.
split_long_1
cube.obj splitLong 0.1
split_long_2
cube.obj splitLong 0.5
split_long_3
cube.obj splitLong 1.0

Triangle subdivision

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

Loop subdivision

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

Quad Subdivision

 quadSubdiv( mesh, levels )
Splits each face into quads. This effect is applied levels number of times.
quad_subdivide_1.png
cube.obj quadSubdiv 1
quad_subdivide_2.png
cube.obj quadSubdiv 2
quad_subdivide_3.png
cube.obj quadSubdiv 3
quad_subdivide_4.png
cube.obj (selected) quadSubdiv 1
quad_subdivide_5.png
cube.obj (selected) quadSubdiv 2
quad_subdivide_6.png
cube.obj (selected) quadSubdiv 3

Catmull-Clark Subdivision

 catmullClark( mesh, levels )
Splits each face into quads. This effect is applied levels number of times. Uses update rules as given in slides. The order in which you should apply the geometrical changes is : modify positions of new edge midpoints, modify positions of newly created face centroids, modify positions of old vertices.
Tip: When calculating locations for edge midpoints, take the average of positions of vertices of that edge, and average of centroids of adjacent faces.
cc_1.png
cube.obj catmullClark 1
cc_3.png
cube.obj catmullClark 2
cc_5.png
cube.obj catmullClark 3
cc_7.png
dodacahedron.obj catmullClark 1
cc_9.png
dodacahedron.objquadSubdiv 2
cc_11.png
dodacahedron.obj catmullClark 3
cc_2.png
cube.obj catmullClark 1
cc_4.png
cube.obj catmullClark 2
cc_6.png
cube.obj catmullClark 3
cc_8.png
dodacahedron.obj catmullClark 1
cc_10.png
dodacahedron.obj catmullClark 2
cc_12.png
dodacahedron.obj catmullClark 3