Panda3D
Public Member Functions | Public Attributes | List of all members
Triangulator3 Class Reference

This is an extension of Triangulator to handle polygons with three- dimensional points. More...

#include "triangulator3.h"

Inheritance diagram for Triangulator3:
Triangulator

Public Member Functions

int add_vertex (const LPoint3d &point)
 Adds a new vertex to the vertex pool. More...
 
int add_vertex (double x, double y, double z)
 Adds a new vertex to the vertex pool. More...
 
void clear ()
 Removes all vertices and polygon specifications from the Triangulator, and prepares it to start over. More...
 
int get_num_vertices () const
 
const LPlaned & get_plane () const
 
const LPoint3d & get_vertex (int n) const
 
void triangulate ()
 Does the work of triangulating the specified polygon. More...
 
- Public Member Functions inherited from Triangulator
void add_hole_vertex (int index)
 Adds the next consecutive vertex of the current hole. More...
 
void add_polygon_vertex (int index)
 Adds the next consecutive vertex of the polygon. More...
 
int add_vertex (const LPoint2d &point)
 Adds a new vertex to the vertex pool. More...
 
int add_vertex (double x, double y)
 Adds a new vertex to the vertex pool. More...
 
void begin_hole ()
 Finishes the previous hole, if any, and prepares to add a new hole. More...
 
void clear ()
 Removes all vertices and polygon specifications from the Triangulator, and prepares it to start over. More...
 
void clear_polygon ()
 Removes the current polygon definition (and its set of holes), but does not clear the vertex pool. More...
 
int get_num_triangles () const
 Returns the number of triangles generated by the previous call to triangulate(). More...
 
int get_num_vertices () const
 
int get_triangle_v0 (int n) const
 Returns vertex 0 of the nth triangle generated by the previous call to triangulate(). More...
 
int get_triangle_v1 (int n) const
 Returns vertex 1 of the nth triangle generated by the previous call to triangulate(). More...
 
int get_triangle_v2 (int n) const
 Returns vertex 2 of the nth triangle generated by the previous call to triangulate(). More...
 
const LPoint2d & get_vertex (int n) const
 
bool is_left_winding () const
 Returns true if the polygon vertices are listed in counterclockwise order, or false if they appear to be listed in clockwise order. More...
 
void triangulate ()
 Does the work of triangulating the specified polygon. More...
 

Public Attributes

 get_num_vertices
 Returns the number of vertices in the pool. More...
 
 get_plane
 Returns the plane of the polygon. More...
 
 get_vertex
 Returns the nth vertex. More...
 
- Public Attributes inherited from Triangulator
 get_num_vertices
 Returns the number of vertices in the pool. More...
 
 get_vertex
 Returns the nth vertex. More...
 

Detailed Description

This is an extension of Triangulator to handle polygons with three- dimensional points.

It assumes all of the points lie in a single plane, and internally projects the supplied points into 2-D for passing to the underlying Triangulator object.

Definition at line 28 of file triangulator3.h.

Member Function Documentation

◆ add_vertex() [1/2]

int Triangulator3::add_vertex ( const LPoint3d &  point)

Adds a new vertex to the vertex pool.

Returns the vertex index number.

Definition at line 39 of file triangulator3.cxx.

Referenced by add_vertex().

◆ add_vertex() [2/2]

int Triangulator3::add_vertex ( double  x,
double  y,
double  z 
)
inline

Adds a new vertex to the vertex pool.

Returns the vertex index number.

Definition at line 18 of file triangulator3.I.

References add_vertex().

◆ clear()

void Triangulator3::clear ( )

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

Definition at line 29 of file triangulator3.cxx.

References Triangulator::clear().

◆ triangulate()

void Triangulator3::triangulate ( )

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().

Definition at line 51 of file triangulator3.cxx.

Member Data Documentation

◆ get_num_vertices

int Triangulator3::get_num_vertices
inline

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.

Definition at line 38 of file triangulator3.h.

◆ get_plane

const LPlaned & Triangulator3::get_plane
inline

Returns the plane of the polygon.

This is only available after calling triangulate().

Definition at line 44 of file triangulator3.h.

◆ get_vertex

const LPoint3d & Triangulator3::get_vertex
inline

Returns the nth vertex.

Definition at line 38 of file triangulator3.h.


The documentation for this class was generated from the following files: