Part I: Tri-mesh Editor



Return to the Project 2 Home Page


The Tri-Mesh Editor:

Download the zip.

Description of Use:

1. Click on an edge and drag to create new triangle.

2. To connect triangles together, drag an edge to a nearby edge.

3. To save your current configuration to a file ("mesh.txt") type 'S'

4. To load your current configuration from a file ("mesh.txt") type 'A'




Specification:

Design triangle mesh editor that lets user click an edge and drag it to create a new triangle on a mesh. Allow connecting to already made edges. Add shade and color to the edges to allow the user to see the difference. Make methods to save and reload the mesh. Show examples including one that shows a hole, one that resembles the human hand or body.

Description:

Our triangle mesh editor shows blue triangles with black edges and allows the user to not only drag an edge to create a triangle, but also to connect to a previously created triangle and connecting the edges and vertices. We've also shown examples including a hole and a human hand.

Detailed Explanations:

One problem we came across was trying to properly orient the triangles. It was easy to confuse which way was the proper orientation. However, one of the equations that was given in class aided greatly on this problem:

((c.n.v.g - c.v.g) x (c.p.v.g - c.v.g)) dot (0,0,1) > 0

Basically, we had to determine if two vectors (QP and PR for example, as in the photo) were greater than 0. This would let us know where the z axis was pointing out of the triangle, and let us know whether we needed to flip the vertices or not.

http://www-sop.inria.fr/prisme/fiches/Arithmetique/index.html.en


Examples:

A Simple Hand

A hand created with the triangle mesh. If you would like to see the same results, please download the text file here and then you can use it within the editor.c file included in the file download above. To see the results and manipulate them for yourself, simply change the
#define fileIn "mesh.txt"
to
#define fileIn "hand.txt"

A Hole

A hole within the center of a triangle mesh. Again, to view this for yourself, please download the text file here and then use them as defined in the Hand image above.

Many Holes

A mesh with multiple holes within it. A more complex view compared to the previous example. Please download the text file here

Conclusions:

Another problem we found was that the more extreme the angle was that we created, the harder it became to drag the edge to another location. This would be something that we would fix if given more time. Perhaps one of the most interesting aspects of this part of the project was learning how to properly orient the triangles. This took a good deal of trial and error to create, because as a user, you really could see no difference between the front and back views.