To run the code, you need to specify the input polygon name and the output triangulation name:
% Triangulate --in poly.ply --out triangulation.ply
Three example polygons containing 23, 49, and 99 vertices are provided for testing.
Note that input and output geometry is in the PLY file format.
EXTRA CREDIT #1
Implement the O(n log n) algorithm for computing the triangulation of a polygon with n vertices.
EXTRA CREDIT #2
Write code that takes n distinct points on the integer lattice (not necessarily in general position) and returns a polygon that has those points as its vertices.
--viewable
flag and use an application like MeshLab to view the results.Alternatively, you can try to compile the PLY viewing code here (which requires that GLUT be installed). You can invoke the viewer by calling:
% PLYViewer triangulation.ply --noLight --boundary --edges
which will show both the boundary of the polygon and the edges of the triangles.