1 #ifndef DELAUNATOR_TRIANGULATION_H_INCLUDED
2 #define DELAUNATOR_TRIANGULATION_H_INCLUDED
15 #include "iterators.h"
37 enum VertexFinderMode {
38 VERTEX_FINDER_MODE_RANDOM,
39 VERTEX_FINDER_MODE_FIRST,
40 VERTEX_FINDER_MODE_MIDDLE,
41 VERTEX_FINDER_MODE_LAST
69 const float,
const float,
const VertexFinderMode = VERTEX_FINDER_MODE_LAST);
82 #ifdef DEBUG // some tests with assertions
83 void DEBUG_tests()
const;
87 std::vector<Edge*> getEdges()
const {
return this->edges; }
88 unsigned int getVerticeCount()
const {
return this->vertices.size(); }
89 float getXmin()
const {
return this->xmin; }
90 float getXmax()
const {
return this->xmax; }
91 float getYmin()
const {
return this->ymin; }
92 float getYmax()
const {
return this->ymax; }
93 float epsilon()
const {
return EPSILON; }
101 bool opt_isdebug()
const {
return true; }
103 bool opt_isdebug()
const {
return false; }
106 bool opt_follow_search()
const {
return true; }
108 bool opt_follow_search()
const {
return false; }
145 float xmin, xmax, ymin, ymax;
146 std::vector<Vertex*> vertices;
147 std::vector<Edge*> edges;
148 std::vector<Face*> faces;
149 finderInitialEdge_mode finderInitialEdge = NULL;
153 Edge* finderInitial_random()
const {
return this->edges[randN(this->edges.size())]; }
154 Edge* finderInitial_middle()
const {
return this->edges[randN(this->edges.size()/2)]; }
155 Edge* finderInitial_first ()
const {
return this->edges[0]; }
156 Edge* finderInitial_last ()
const {
return this->edges[this->edges.size()-1]; }
158 bool applyDelaunayCondition(
Face*,
unsigned int ttl = 0);
160 bool applyDelaunayCondition(
Face*);
162 void operateFlip(Edge*);
164 inline void removeVertexFromVertices(
Vertex* v) {
165 for(std::vector<Vertex*>::iterator it = this->vertices.begin();
166 it != this->vertices.end(); it++) {
168 this->vertices.erase(it);
170 it = this->vertices.end()-1;
174 inline void removeEdgeFromEdges(Edge* e) {
175 for(std::vector<Edge*>::iterator it = this->edges.begin();
176 it != this->edges.end(); it++) {
178 this->edges.erase(it);
180 it = this->edges.end()-1;
184 inline void removeFaceFromFaces(
Face* f) {
185 for(std::vector<Face*>::iterator it = this->faces.begin();
186 it != this->faces.end(); it++) {
188 this->faces.erase(it);
190 it = this->faces.end()-1;
202 std::vector<Face*> nei_faces;
205 nei_faces.push_back(edge->leftFace());
206 edge = edge->rotLeftEdge();
209 for(
Face* f : nei_faces) {
213 this->applyDelaunayCondition(f);