6pm - 8:20pm
DUE: Monday 7/24/06 midnight (11:59pm)
Note the date change!
In this assignment you will implement a simple system for mesh modification and refinement.
Your program should load a mesh from an OBJ file (all fields other than
vertex and face definitions can be ignored). The filename should
NOT be hard coded - make it a command line argument instead. Example
testing are given below.
Your program should implement the half-edge mesh data structure for
arbitrary polygonal meshes. You can assume that the input mesh is a
manifold mesh (but faces are not necessarily triangles).
The mesh should be displayed with lighting enabled, using at least two
lights. The user should be able to rotate the mesh using the trackball
interface. See below for the implementation.
Implement the following operations:
• Mouse click : select a mesh polygon (the selected polygon is highlighted)
• Key 'D' : Remove the selected polygon, correctly adjusting the mesh data structure.
• Key 'T' : Triangulate the mesh ( all polygons of the mesh
are converted to triangles). You can do this by choosing an arbitrary
vertex and connecting it to all vertices not adjacent to it.
• Key 'S' : the Loop subdivision algorithm is applied to the mesh
once (You should allow multiple applications if subdivision - the mesh
will get more refined with every key press). The details of Loop
subdivision implementation will be discussed at the lecture.
Some points to note:
Make sure to take care of the case when the user tries to apply Loop
subdivision to a non-triangular mesh (you can either notify the user
about the problem or automatically triangulate the mesh and then call
Please *replace* the teapot in the center of the trackball with the
mesh you are loading from the obj file. Do not let them coexist! Teapot
is there only to display the functionality of the trackball.
You can implement polygon selection using the selection buffer and the
select mode in opengl. This is covered in ch 13 of the redbook. An
example that uses this approach is given below. You can also use the
back buffer approach explained briefly in ch 14 of the redbook.
1. Trackball Interface :
2. Example meshes
3. Selection example
Adapted from one of Denis Zorin's assignments.