Triangulator

Inheritance:

Methods of Triangulator:

Triangulator
Triangulator::Triangulator(void);

Description:

addHoleVertex
void Triangulator::add_hole_vertex(int index);

Description: Adds the next consecutive vertex of the current hole. This vertex should index into the vertex pool established by repeated calls to add_vertex().
The vertices may be listed in either clockwise or counterclockwise order. Vertices should not be repeated.

addPolygonVertex
void Triangulator::add_polygon_vertex(int index);

Description: Adds the next consecutive vertex of the polygon. This vertex should index into the vertex pool established by repeated calls to add_vertex().
The vertices may be listed in either clockwise or counterclockwise order. Vertices should not be repeated. In particular, do not repeat the first vertex at the end.

addVertex
int Triangulator::add_vertex(LPoint2d const &point);

Description: Adds a new vertex to the vertex pool. Returns the vertex index number.

beginHole
void Triangulator::begin_hole(void);

Description: Finishes the previous hole, if any, and prepares to add a new hole.

clear
void Triangulator::clear(void);

Description: Removes all vertices and polygon specifications from the Triangulator, and prepares it to start over.

clearPolygon
void Triangulator::clear_polygon(void);

Description: Removes the current polygon definition (and its set of holes), but does not clear the vertex pool.

getNumTriangles
int Triangulator::get_num_triangles(void) const;

Description: Returns the number of triangles generated by the previous call to triangulate().

getNumVertices
int Triangulator::get_num_vertices(void) const;

Description: Returns the number of vertices in the pool. Note that the Triangulator might append new vertices, in addition to those added by the user, if any of the polygon is self-intersecting, or if any of the holes intersect some part of the polygon edges.

getTriangleV0
int Triangulator::get_triangle_v0(int n) const;

Description: Returns vertex 0 of the nth triangle generated by the previous call to triangulate().
This is a zero-based index into the vertices added by repeated calls to add_vertex().

getTriangleV1
int Triangulator::get_triangle_v1(int n) const;

Description: Returns vertex 1 of the nth triangle generated by the previous call to triangulate().
This is a zero-based index into the vertices added by repeated calls to add_vertex().

getTriangleV2
int Triangulator::get_triangle_v2(int n) const;

Description: Returns vertex 2 of the nth triangle generated by the previous call to triangulate().
This is a zero-based index into the vertices added by repeated calls to add_vertex().

getVertex
LPoint2d const &Triangulator::get_vertex(int n) const;

Description: Returns the nth vertex.

isLeftWinding
bool Triangulator::is_left_winding(void) const;

Description: Returns true if the polygon vertices are listed in counterclockwise order, or false if they appear to be listed in clockwise order.

triangulate
void Triangulator::triangulate(void);

Description: Does the work of triangulating the specified polygon. After this call, you may retrieve the new triangles one at a time by iterating through get_triangle_v0/1/2().