Starting from:

$30

EE4730-Homework 2 OpenGL GUI Solved

Using MeshLib (half-edge data structure) to do some basic geometric computation on triangle meshes. 

 

1.     Include meshlib files into hw1 project and make the GUI work like hw1.  Now, instead of using your original OBJ reading function, you can directly use ReadOBJFile() function to read an OBJ file to the mesh object. Then, revise the Bounding box computation, and mesh rendering functions accordingly to get the mesh rendered. 

 

2.     Implement the ComputeNormals() function to compute the normal vector on each vertex. The vertex normal is a weighted average of normal vectors of this vertex’s surrounding face, 

 

 

 

where 𝑁𝐹(𝑣) is the set of neighboring faces surrounding the vertex 𝑣, and the weight 𝛼𝑖 is the interior corner angle of 𝑓𝑖 at 𝑣. 

 

3.     Implement a “RenderEdge()” function, so that when you press “e”, you can see the edge connectivity shown in blue together with the mesh.

 

4.     Trace all the boundary loops and compute the boundary loop number 𝑏.

Print 𝑏 on the screen. Also implement a “RenderBoundary()” function, so that when you press “b”, you can see the boundary loops shown in yellow on the mesh. 

 

5.     Compute the Gaussian curvature 𝜅𝐺 on each vertex. Colorize the surface: 

a.     color a vertex to green if its curvature 𝜅𝐺 < −0.05 and its curvature is a local minimum (i.e., value ≤ curvatures of its surrounding vertices)

b.     color a vertex to red if its curvature 𝜅𝐺 0.05 and its curvature is a local maximum (i.e., value ≥ curvatures of its surrounding vertices)

c.     color all the other vertices to be gray (𝑟 = 0.7, 𝑔 = 0.7, 𝑏 = 0.7).

d.     Display/undisplay these color when the key “k” is pressed. 

 

Hint:  to make your program efficient, you can use an array to store your computed properties. For example, in Step 2, you can first compute all the face normal vectors, and store them in a point (namely, 3D vector) array

𝑁𝑓[0, … , 𝐹 − 1]. In the mesh library, each face 𝑓 has an index 𝑓− 𝑖𝑛𝑑𝑒𝑥(). You can just store each face 𝑓’s normal in 𝑁𝑓[𝑓 → 𝑖𝑛𝑑𝑒𝑥()]. In Step 4, similarly, you may want to use a flag array to store if a boundary edge is visited or not. In Step 5, also store computed curvatures of all the vertices

More products