Part II: Building the Corner Table



Return to the Project 2 Home Page


The Corner Table:

Download the zip.

Specification:

Build a corner table of the mesh using arrays of integers for the O, V, and G tables. Each vertex is represented only once in the G table as a 3D point with z=0. The opposite corner without an opposite should be -1.

Description:

Our corner table is created whenever the user presses 'S' while manipulating the mesh. By default, it is saved in the file "mesh.txt". The file is in the following format:

Vertices and Opposites are listed: V, O

Geometry of each Point is listed: X, Y, Z

To read a previous manipulation, simply press 'A' and the Corner Table will be read from "mesh.txt".

Detailed Explanations:

Although setting up a file reader and writer was not a problem, we found that trying to determine the opposite of our points at first was. During our first meeting, we were stumped on how to solve this problem. However, we found it easiest to calculate the opposite of each as we inserted the triangle into our mesh. First we had to make sure that our triangles were oriented properly, as we discussed in Part I. We used the following pseudocode to determine whether a corner had an opposite or not. Please note that a and b are corners.

Found = False;

if ((a.n.v.g == b.p.v.g) && (a.p.v.g == b.n.v.g))

then a & b are opposites & Found = True.

if (found = false) then O[a] = O[b] = -1.

http://www.geom.uiuc.edu/~samuelp/del_project.html

Calculating the opposite of each triangle was very useful in traversing the triangle mesh as shown in Part III.

Conclusions:

Although having the opposites for each of the vertices was very useful in traversing the mesh, we found that it was rather difficult trying to add in the opposite for two connected edges. Again, implementing the Opposite and Vertex tables will be very useful in later portions of this project because it will aid us in determining if a vertex is on the edge of a given shape or not. Later we will be increasing the z value of the vertex depending on how distant it is from the edge, and these tables will make the process easier.

One thing we could have done to increase usability of the program was to create a seperate file for the O & V tables with proper formatting enabling an easier understanding of the tables. If given extra time, this is one aspect we would have taken into consideration.