Sei sulla pagina 1di 12

Hw2 Mesh Simplification Writeup

Tian Qiu
A91114755
Teammate: N/A

Overview:
Things completed:
3.1 Mesh viewer using the skeleton code from hw1 in CSE 167 last quarter. (done)
3.2 Mesh connectivity (done)
3.3 Mesh decimation (done)
3.4 Quadric simplification (done)
3.5 Progressive meshes (Most of the part)
Things not completed:
3.5* Hoppes geomorph

Project Structure: The solution is named hw1-windows because I used the framework of the previous
homework in CSE 167. Here are descriptions of each source file:
main.cpp : Open input file, initialize openGL buffers, create mesh object in a view window, and handle
keyboard inputs.
Geometry.cpp: The majority of works have been done here. It contains all class definitions for the mesh object
as well as parser that reads file contents.
1. halfEdge class: used for conveniently access neighbors in a counterclockwise manner. Faces are
stored in halfEdge * list.
2. vertex: position, normal and a GLfloat[10] array to store quadric matrix.
3. edgeData: the data class that has a pointer to one halfEdge, mergePoint location and the
corresponding cost. (For a pair of symmetric edges, there is only one edgeData)
4. collapse: class that stores the information of a collapse, including lists of halfEdge* to affected
neighbors.
5. mesh: the class that performs the edge collapse and includes some other tracking variables.

shaders.cpp: unchanged since last homework.


Transform.cpp: modelview and camera transformation.
Other shader files: unchanged.

Implementation Notes:
How to run executable:
navigate to the current directory which must include model folder containing .off files.
cmd: mesh.exe [onlyFilename.off]
Why I use half-edge:
According to the slide, using half edge structure is a neat way to handle convoluted neighbors update or
removal. It has a small size and simple definition but is still powerful.
In this project, halfEdge is as follows:
int vert the index of this half edge in the vector of all vertices populated from the file.
int ctr tracking variable for edge-splitting.
halfEdge* prev, next, sym ptr to local neighbors, prev and next are used counterclockwisely. sym
points to the alternate halfEdge with reversed v0 and v1.
How file is parsed:
vector<halfEdge*> edges and vector<vertex> verts are populated when parsing. For each vertex, there
can be many halfEdge containing it, (original or symmetric). But three halfEdge will determine a face.
Other library I used:
Besides glm, glew, I also used the boost c++ library for container templates. It should be included in the source
file (Or use Manage NuGet package and search for boost). The reason why I use this library is that it offers a
nice heap implementation which is much powerful than STL priority_queue. With boost::heap, I am able to read
and write elements at a specific index in the heap and update the whole priority_queue accordingly.
Progressive Mesh Tracking:
New merge points are push_backed to the end of vertices list. So, when the mesh reaches the MAX limit of
simplifications, the variable collapsedData have information of all steps. So it will be very easy to recover.
Since all works are in the memory, this program should run faster than local file I/O program even though it
might be memory-hungry when processing complicated meshes.

Known issues:
The boost::heap::binomial_heap which I used as a substitute of STL priority_queue can possibly throw
exception when one handle has a parent address at 0xdddddddd in mesh::edgeCollapse().
It seems that something went wrong with the boost library when visual studio was compliling the template.
I havent found a solution to this bug, sadly :(

Examples:
1. Mesh Viewer:
armadillo.png
rocker-arm.png
teapot.png
brain.png
2. Mesh Decimation:

Before and after collapsing v0 and v1. (quadric errors are taken into account)
Before and after, collapsing the edge at the (2,2) and (2,1). Upper right(0,0).
3. Quadric Error
sphere.off Collapsing 100 more edges per picture.
4. Progressive Mesh
Link:
https://youtu.be/PlgQDFMPvCk

Potrebbero piacerti anche