40#ifndef GEOGRAM_DELAUNAY_DELAUNAY_2D
41#define GEOGRAM_DELAUNAY_DELAUNAY_2D
143 return has_empty_cells_;
153 abort_if_empty_cell_ = x;
201 Sign* orient =
nullptr
315 return cell_to_v_store_.size() / 3;
396 return cell_next_[t];
417 cell_next_[t] = first;
457 (cell_to_v_store_[3 * t] != NO_INDEX) &&
458 (cell_to_v_store_[3 * t + 1] != NO_INDEX) &&
459 (cell_to_v_store_[3 * t + 2] != NO_INDEX) ;
519 cell_to_v_store_.resize(
520 cell_to_v_store_.size() + 3, NO_INDEX
522 cell_to_cell_store_.resize(
523 cell_to_cell_store_.size() + 3, NO_INDEX
529 result =
max_t() - 1;
531 result = first_free_;
536 cell_to_cell_store_[3 * result] = NO_INDEX;
537 cell_to_cell_store_[3 * result + 1] = NO_INDEX;
538 cell_to_cell_store_[3 * result + 2] = NO_INDEX;
556 cell_to_v_store_[3 * result] = v1;
557 cell_to_v_store_[3 * result + 1] = v2;
558 cell_to_v_store_[3 * result + 2] = v3;
589 return cell_next_[t] == cur_stamp_;
606 cell_next_[t] = cur_stamp_;
630 return index_t(triangle_edge_vertex_[e][v]);
643 return cell_to_v_store_[3 * t + lv];
656 const index_t* T = &(cell_to_v_store_[3 * t]);
672 return cell_to_v_store_[3 * t + lv];
684 cell_to_v_store_[3 * t + lv] = v;
696 index_t result = cell_to_cell_store_[3 * t + le];
712 cell_to_cell_store_[3 * t1 + le1] = t2;
729 const index_t* T = &(cell_to_cell_store_[3 * t1]);
756 cell_to_v_store_[3 * t] = v0;
757 cell_to_v_store_[3 * t + 1] = v1;
758 cell_to_v_store_[3 * t + 2] = v2;
759 cell_to_cell_store_[3 * t] = a0;
760 cell_to_cell_store_[3 * t + 1] = a1;
761 cell_to_cell_store_[3 * t + 2] = a2;
785 pv[i] = (v == NO_INDEX) ?
nullptr :
vertex_ptr(v);
790 for(
index_t le = 0; le < 3; ++le) {
792 if(pv[le] ==
nullptr) {
842 double h = heights_[pindex];
844 pv[0],pv[1],pv[2],p,h0,h1,h2,h
929 bool verbose_debug_mode_;
934 bool benchmark_mode_;
944 static char triangle_edge_vertex_[3][2];
949 std::stack<index_t> S_;
954 bool has_empty_cells_;
960 bool abort_if_empty_cell_;
#define geo_debug_assert(x)
Verifies that a condition is met.
void find_conflict_zone_iterative(const double *p, index_t t, index_t &t_bndry, index_t &e_bndry, index_t &first, index_t &last)
This function is used to implement find_conflict_zone.
void set_triangle(index_t t, index_t v0, index_t v1, index_t v2, index_t a0, index_t a1, index_t a2)
Sets the vertices and adjacent triangles of a triangle.
bool triangle_is_finite(index_t t) const
Tests whether a given triangle is a finite one.
static index_t triangle_edge_vertex(index_t e, index_t v)
Returns the local index of a vertex by edge and by local vertex index in the edge.
bool triangle_is_real(index_t t) const
Tests whether a triangle is a real one.
static index_t find_3(const index_t *T, index_t v)
Finds the index of an integer in an array of three integers.
void set_vertices(index_t nb_vertices, const double *vertices) override
Sets the vertices of this Delaunay, and recomputes the cells.
bool triangle_is_in_list(index_t t) const
Tests whether a triangle belongs to a linked list.
index_t triangle_next(index_t t) const
Gets the index of a successor of a triangle.
static constexpr index_t NOT_IN_LIST
Default symbolic value of the cell_next_ field that indicates that a triangle is not in a linked list...
void set_triangle_mark_stamp(index_t stamp)
Generates a unique stamp for marking tets.
index_t triangle_vertex(index_t t, index_t lv) const
Gets the index of a vertex of a triangle.
static constexpr index_t NOT_IN_LIST_BIT
If cell_next_[t] & NOT_IN_LIST_BIT != 0, then t is not in a linked list.
static constexpr index_t END_OF_LIST
Symbolic value of the cell_next_ field that indicates the end of list in a linked list of triangles.
void show_list(index_t first, const std::string &list_name) const
For debugging purposes, displays a triangle.
index_t locate_inexact(const double *p, index_t hint, index_t max_iter) const
Finds the triangle that (approximately) contains a point using inexact predicates.
index_t max_t() const
Maximum valid index for a triangle.
Delaunay2d(coord_index_t dimension=2)
Constructs a new Delaunay2d.
~Delaunay2d() override
Delaunay2d destructor.
void show_triangle(index_t t) const
For debugging purposes, displays a triangle.
void set_triangle_adjacent(index_t t1, index_t le1, index_t t2)
Sets a triangle-to-triangle adjacency.
void check_geometry(bool verbose=false) const
For debugging purposes, test some geometrical properties.
bool triangle_is_virtual(index_t t) const
Tests whether a triangle is a virtual one.
void abort_if_empty_cell(bool x)
Specifies behavior if an empty cell is detected.
static constexpr index_t VERTEX_AT_INFINITY
Symbolic value for a vertex of a triangle that indicates a virtual triangle.
index_t stellate_conflict_zone(index_t v, index_t t_bndry, index_t e_bndry)
Creates a star of triangles filling the conflict zone.
bool create_first_triangle(index_t &iv0, index_t &iv1, index_t &iv2)
Finds in the pointset a set of three non-colinear points.
index_t find_triangle_adjacent(index_t t1, index_t t2) const
Finds the index of the edge accros which t1 is adjacent to t2_in.
index_t insert(index_t v, index_t hint=NO_TRIANGLE)
Inserts a point in the triangulation.
void set_triangle_vertex(index_t t, index_t lv, index_t v)
Sets a triangle-to-vertex adjacency.
void find_conflict_zone(index_t v, index_t t, const Sign *orient, index_t &t_bndry, index_t &e_bndry, index_t &first, index_t &last)
Determines the list of triangles in conflict with a given point.
index_t finite_triangle_vertex(index_t t, index_t lv) const
Gets the index of a vertex of a triangle.
index_t triangle_adjacent(index_t t, index_t le) const
Gets the index of a triangle adjacent to another one.
void remove_triangle_from_list(index_t t)
Removes a triangle from the linked list it belongs to.
void mark_triangle(index_t t)
Marks a triangle.
index_t find_triangle_vertex(index_t t, index_t v) const
Finds the index of the vertex in a triangle.
index_t locate(const double *p, index_t hint=NO_TRIANGLE, bool thread_safe=false, Sign *orient=nullptr) const
Finds the triangle that contains a point.
bool has_empty_cells() const
Tests whether the Laguerre diagram has empty cells.
bool triangle_is_marked(index_t t) const
Tests whether a triangle is marked.
index_t new_triangle(index_t v1, index_t v2, index_t v3)
Creates a new triangle.
void add_triangle_to_list(index_t t, index_t &first, index_t &last)
Adds a triangle to a linked list.
bool triangle_is_free(index_t t) const
Tests whether a triangle is in the free list.
index_t nearest_vertex(const double *p) const override
Computes the nearest vertex from a query point.
void check_combinatorics(bool verbose=false) const
For debugging purposes, tests some combinatorial properties.
static constexpr index_t NO_TRIANGLE
Symbolic constant for uninitialized hint.
index_t new_triangle()
Creates a new triangle.
void show_triangle_adjacent(index_t t, index_t le) const
For debugging purposes, displays a triangle adjacency.
bool triangle_is_conflict(index_t t, const double *p) const
Tests whether a given triangle is in conflict with a given 3d point.
coord_index_t dimension() const
Gets the dimension of this Delaunay.
index_t nb_vertices() const
Gets the number of vertices.
bool thread_safe() const
Tests whether thread-safe mode is active.
Delaunay(coord_index_t dimension)
Creates a new Delaunay triangulation.
const double * vertex_ptr(index_t i) const
Gets a pointer to a vertex by its global index.
~RegularWeightedDelaunay2d() override
RegularWeightedDelaunay2d destructor.
RegularWeightedDelaunay2d(coord_index_t dimension=3)
Constructs a new Regular Delaunay2d triangulation.
Vector with aligned memory allocation.
Abstract interface for Delaunay.
Common include file, providing basic definitions. Should be included before anything else by all head...
Geometric functions in 2d and 3d.
Sign in_circle_2d_SOS(const double *p0, const double *p1, const double *p2, const double *p3)
Tests whether a 2d point is inside the circumscribed circle of a 3d triangle.
Sign orient_2dlifted_SOS(const double *p0, const double *p1, const double *p2, const double *p3, double h0, double h1, double h2, double h3)
Computes the 3d orientation test with lifted points.
Sign orient_2d(const vec2HE &p0, const vec2HE &p1, const vec2HE &p2)
Computes the orientation predicate in 2d.
Global Vorpaline namespace.
geo_index_t index_t
The type for storing and manipulating indices.
Sign
Integer constants that represent the sign of a value.
geo_coord_index_t coord_index_t
The type for storing coordinate indices, and iterating on the coordinates of a point.
Filtered exact predicates for restricted Voronoi diagrams.