Delaunator
2D Delaunay Triangulation in C++ with Python wrapper.
 All Classes Namespaces Functions
Public Types | Public Member Functions | List of all members
Triangulation Class Reference

#include <triangulation.h>

Public Types

typedef Edge *(Triangulation::* finderInitialEdge_mode )() const

Public Member Functions

 Triangulation (const float, const float, const float, const float, const VertexFinderMode=VERTEX_FINDER_MODE_LAST)
 ~Triangulation ()
VertexaddVertexAt (Coordinates, Edge *=NULL)
VertexaddVertexAt (float x, float y, Edge *e=NULL)
VertexvertexAt (float, float, float=EPSILON) const
VertexvertexAt (Coordinates c, float p=EPSILON) const
VertexmoveVertex (Vertex *v, Coordinates c)
VertexmoveVertex (Vertex *v, float x, float y)
VertexmoveVertexTo (Vertex *v, Coordinates c)
void delVertex (Vertex *v)
void mergeVertex (Vertex *v, Vertex *v_destroyed)
unsigned int getIndexOf (Vertex *) const
std::vector< Edge * > getEdges () const
unsigned int getVerticeCount () const
float getXmin () const
float getXmax () const
float getYmin () const
float getYmax () const
float epsilon () const
VertexFinderMode getFinderMode () const
void setFinderMode (VertexFinderMode)
bool haveVertex (Vertex *) const
bool collideAt (Coordinates) const
bool opt_isdebug () const
bool opt_follow_search () const
IteratorVertexToNeighbourVertices getNeighbors (Vertex *)
IteratorOnEdges iterEdges ()
IteratorOnEdges_read iterEdges_read () const
IteratorOnAllEdges iterAllEdges ()
IteratorOnAllEdges_read iterAllEdges_read () const
IteratorOnFaces iterFaces ()
IteratorOnFaces_read iterFaces_read () const
IteratorOnAllFaces iterAllFaces ()
IteratorOnAllFaces_read iterAllFaces_read () const
IteratorOnVertices iterVertices ()
IteratorOnVertices_read iterVertices_read () const
IteratorOnAllVertices iterAllVertices ()
IteratorOnAllVertices_read iterAllVertices_read () const

Detailed Description

Delaunay Triangulation class definition. Main object manipulated by user/wrapper. Provide iterators, access to Vertices, Faces, Edges,... Have all methods for add, delete and move Vertices.

Constructor & Destructor Documentation

Triangulation::Triangulation ( const float  xmin,
const float  xmax,
const float  ymin,
const float  ymax,
const VertexFinderMode  finder_mode = VERTEX_FINDER_MODE_LAST 
)

Wait for limits of triangulation in axis x and y.

Parameters
xminminimal value in x axis allowed
xmaxmaximal value in x axis allowed
yminminimal value in y axis allowed
ymaxmaximal value in y axis allowed
finder_modefor choose which mode of finder will be used for search Coordinates, LAST by default
See Also
VertexFinderMode
Triangulation::~Triangulation ( )

Frees all Faces, Vertices and Edges.

Member Function Documentation

Vertex * Triangulation::addVertexAt ( Coordinates  p,
Edge first = NULL 
)

Add a new vertex to Mesh at given coordinates.

Parameters
pCoordinates where Vertex will be add
firstinitial Edge use by finder, in place of the one taked according to FinderMode
Returns
address of that point in Mesh, or NULL if not found or out of bounds.
bool Triangulation::collideAt ( Coordinates  c) const
Parameters
cCoordinates of tested point
Returns
true if point is in-limit of this
void Triangulation::delVertex ( Vertex del_vrtx)

Remove a Vertex from the triangulation. Iterators will be invalidated, and vertex will be free.

Parameters
del_vrtxtargeted Vertex
VertexFinderMode Triangulation::getFinderMode ( ) const
Returns
VertexFinderMode value, that described method used by this instance.
unsigned int Triangulation::getIndexOf ( Vertex v) const

Return index of a Vertex in Triangulation container.

Parameters
vVertex that will be found
Returns
an unsigned int that is the index of the Vertex for this Deulaunator, or equal to number of Vertice if not found
IteratorVertexToNeighbourVertices Triangulation::getNeighbors ( Vertex v)

Infinite iteration on all neighbour vertices of a given Vertex.

Parameters
vthe targeted Vertex
Returns
an IteratorVertexToNeighbourVertices that iter on neighbors of target
bool Triangulation::haveVertex ( Vertex v) const
Parameters
vtested Vertex
Returns
true iff tested Vertex is referenced by triangulation
void Triangulation::mergeVertex ( Vertex v,
Vertex v_destroyed 
)

Merge two Vertex by destroying the second one

Parameters
vthe Vertex
v_destroyedthe Vertex that will be destroyed
Note
all iterators and pointers on v_destroyed will be destroyed
Vertex * Triangulation::moveVertex ( Vertex mv_vrtx,
float  x,
float  y 
)

Move given vertex by given vector values. Modify the mesh in consequence. Vertex can't pass over the mesh bounds.

Parameters
mv_vrtxthe Vertex to move
vec_xmove in x axis
vec_ymove in y axis
Returns
address of the Vertex, or of a new Vertex if given was freed
Note
given Vertex can be deleted, but data is keeped in returned Vertex.
Vertex * Triangulation::moveVertexTo ( Vertex mv_vrtx,
Coordinates  new_position 
)

Move given vertex at given Coordinates. Modify the mesh in consequence. Vertex can't pass over the mesh bounds.

Parameters
mv_vrtxthe Vertex to move
new_positionof the Vertex
Returns
address of the Vertex, or of a new Vertex if given was freed
Note
given Vertex can be deleted, but data is keeped in returned Vertex.
void Triangulation::setFinderMode ( VertexFinderMode  m)
Parameters
mVertexFinderMode value, that tell which Edge this instance will used as first Edge for search
Vertex * Triangulation::vertexAt ( float  x,
float  y,
float  precision = EPSILON 
) const
Returns
vertex found at given coords, around precision. or NULL iff no vertex found.
Note
never return the corners Vertex

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