Starting from:

$30

Homework 2 OpenGL GUI

Homework 2
Improve the OpenGL GUI developed in HW 1. 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. 
Please write all you codes in your “hw2.cpp” file (do not modify any file
from the meshlib) and send the hw2.cpp to me. I will compile it with the
meshlib files on my computer.
Homework Due: 11:59pm, March 10th, 2020.
If you are late for x days, each day you get 10% off. Namely, your homework
score will be calculated as:
(the score based on your codes) * (0.9^x)

More products