Home | Hierarchy | Members | Alphabetical | Related Pages |
#include <triangulator.h>
Public Types | |
typedef P | PointType |
typedef std::list< Face >::const_iterator | face_const_iterator |
Public Member Functions | |
template<class T> | |
Triangulator (T first, const T &last) | |
void | process () throw (std::runtime_error) |
unsigned int | faces_size () const |
face_const_iterator | faces_begin () const |
face_const_iterator | faces_end () const |
Protected Member Functions | |
bool | snip (const int u, const int v, const int w, const int nv) |
int | nbPoints () const |
const PointType & | point (const int i) const |
void | addFace (const int u, const int v, const int w) |
Static Protected Member Functions | |
bool | isInTriangle (const PointType &A, const PointType &B, const PointType &C, const PointType &M) |
The code is fully templated which means it can be used with any type of point and any type of sequence.
Here is an exemple of use, where Vec2 is a trivial 2D point type:
list<Vec2> polygon; polygon.push_back(Vec2(0.0f,0.0f)); polygon.push_back(Vec2(1.0f,0.0f)); polygon.push_back(Vec2(1.0f,1.0f)); polygon.push_back(Vec2(0.0f,1.0f)); Triangulator<Vec2> triangulator(polygon.begin(),polygon.end()); triangulator.process(); for (Triangulator<Vec2>::face_const_iterator fter = triangulator.faces_begin(); fter != triangulator.faces_end();++fter) { cout<<"face joining\n" <<" "<<*(fter->vertex(0)) <<" "<<*(fter->vertex(1))<<endl; }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Generated on 24 Feb 2005 with version 1.3.9.1. |