40 #ifndef GEOGRAM_VORONOI_GENERIC_RVD_VERTEX
41 #define GEOGRAM_VORONOI_GENERIC_RVD_VERTEX
78 template <
class T, index_t DIM>
130 return data_ + size_;
152 return data_ + size_;
191 if(where ==
end() - 1) {
259 void print(std::ostream& out)
const {
311 while(result !=
end() && *result < x) {
325 while(result !=
end() && *result < x) {
339 template <
class T, index_t DIM>
353 template <
class T, index_t DIM1, index_t DIM2, index_t DIM3>
360 auto i1 = S1.
begin();
361 auto i2 = S2.
begin();
362 while(i1 < S1.
end() && i2 < S2.
end()) {
612 if(nb1 == 3 && nb2 == 3) {
620 }
else if(nb1 == 2) {
625 }
else if(nb2 == 2) {
686 if(size_ == capacity_) {
690 return item(size_ - 1);
705 for(
index_t c = 0; c < chunks_.size(); c++) {
724 CHUNK_SIZE = 1 << CHUNK_SHIFT,
725 CHUNK_MASK = CHUNK_SIZE - 1
733 reinterpret_cast<double*
>(
735 index_t(CHUNK_SIZE) * dimension_ *
sizeof(
double)
739 capacity_ += CHUNK_SIZE;
749 return &(chunks_[i >> CHUNK_SHIFT][(i & CHUNK_MASK) * dimension_]);
756 std::vector<double*> chunks_;
926 operator const double* ()
const {
956 return (flags_ & f) != 0;
976 template <index_t DIM>
980 const double* p1,
const double* p2
982 const double* q1 = vq1.
point();
983 const double* q2 = vq2.
point();
984 double* Ipoint = target_intersections.
new_item();
986 double d = 0.0, l1 = 0.0, l2 = 0.0;
988 double n = p1[c] - p2[c];
989 d -= n * (p2[c] + p1[c]);
996 double l12 = l1 + l2;
1005 Ipoint[c] = l1 * q1[c] + l2 * q2[c];
1020 template <index_t DIM>
1022 const double* p1,
const double* p2
1025 for(
index_t c = 0; c < DIM; ++c) {
1033 const double* point_;
Assertion checking mechanism.
#define geo_debug_assert(x)
Verifies that a condition is met.
Generic mechanism for attributes.
An allocator for points that are created from intersections in GenericVoronoiDiagram.
void clear()
Clears this PointAllocator.
double * new_item()
Allocates a new point.
~PointAllocator()
PointAllocator destructor.
double * item(index_t i)
Gets a pointer to one of the allocated points from its index.
void grow()
Allocates a new chunk of memory.
coord_index_t dimension() const
Gets the dimension of the points stored in this PointAllocator.
PointAllocator(coord_index_t dim)
Creates a new empty PointAllocator.
A set of three integers that encodes the equation of a vertex in GenericVoronoiDiagram.
bool has_bisector(index_t i) const
Tests whether a bisector is present in the symbolic representation this vertex.
void copy_boundary_edge_from(const thisclass &rhs)
Copies a boundary edge from the symbolic representation of another vertex.
void set_boundary_edge(index_t v1, index_t v2)
Sets the boundary edge on which this vertex is located.
index_t boundary_facet(signed_index_t i) const
Gets a boundary facet.
void add_boundary_facet(index_t i)
Adds a boundary facet to the symbolic representation.
void get_boundary_edge(index_t &v1, index_t &v2) const
Gets the global indices of the boundary vertices that define the boundary edge on which this vertex i...
index_t nb_boundary_facets() const
Gets the number of boundary facets in the symbolic representation.
index_t get_boundary_vertex() const
Gets the global index of the boundary vertex that corresponds to this vertex.
index_t nb_bisectors() const
Gets the number of bisectors in the symbolic representation.
void set_boundary_vertex(index_t v)
Sets the boundary vertex on which this vertex is located.
bool has_boundary_facet(index_t i) const
Tests whether a boundary facet is present in the symbolic representation of this vertex.
SymbolicVertex()
Creates an uninitialized SymbolicVertex.
static index_t to_unsigned_int(signed_index_t x)
Casts a signed_index_t into an (unsigned) index_t.
index_t bisector(signed_index_t i) const
Gets a bisector.
void add_bisector(index_t i)
Adds a bisector to the symbolic representation.
bool intersect_symbolic(const thisclass &v1, const thisclass &v2, index_t E)
Computes the symbolic representation of the intersection between a segment and a bisector.
Internal representation of vertices in GenericVoronoiDiagram.
void clear()
Clears this Vertex.
Vertex(const double *p, double w, signed_index_t f, const SymbolicVertex &sym)
Creates a new Vertex.
void set_adjacent_seed(signed_index_t s)
Sets the adjacent seed.
void set_flag(EdgeFlag f)
Sets an EdgeFlag in this Vertex.
Vertex()
Creates an uninitialized Vertex.
void intersect_geom(PointAllocator &target_intersections, const Vertex &vq1, const Vertex &vq2, const double *p1, const double *p2)
Computes the intersection between a segment and a bisector.
Sign side_fast(const double *p1, const double *p2) const
Computes the side of this vertex relative to a bisector.
const SymbolicVertex & sym() const
Gets the symbolic representation.
void set_adjacent_facet(signed_index_t f)
Sets the adjacent facet.
void set_point(const double *p)
Sets the geometric location at this vertex.
double weight() const
Gets Vertex weight.
void copy_edge_from(const Vertex &rhs)
Copies adjacent facet and edge flags from another Vertex.
void unset_flag(EdgeFlag f)
Resets an EdgeFlag in this Vertex.
void set_weight(double w)
Sets the vertex weight.
SymbolicVertex & sym()
Gets the symbolic representation.
signed_index_t adjacent_seed() const
Gets the adjacent seed.
Vertex(const double *p, double w, signed_index_t f)
Creates a new Vertex.
const double * point() const
Gets the geometric location at this Vertex.
signed_index_t adjacent_facet() const
Gets the adjacent facet.
bool check_flag(EdgeFlag f) const
Tests an EdgeFlag in this Vertex.
Small_set is similar to std::set, but with fixed maximum size (and no dynamic memory allocation).
const_iterator begin() const
Gets a const iterator to the first element..
iterator find(const T &x)
Finds an element by value.
void grow()
Increases the size of this small_set.
iterator end()
Gets an iterator one position past the last element.
T value_type
Type of the elements.
index_t capacity() const
Gets the maximum number of elements that can be stored in this small_set.
const T * const_iterator
A random access iterator to const elements.
small_set()
Constructs an empty small_set.
iterator insert(const T &x, iterator where)
Inserts a new element at a specified location..
const_iterator find(const T &x) const
Finds an element by value.
T & operator[](signed_index_t i)
Direct access to an element.
const_iterator find_i(const T &x) const
Finds where an element should be located from its value.
T * iterator
A random access iterator to elements
const_iterator end_of_storage() const
Gets a const iterator one position past the last element that can be stored.
iterator begin()
Gets an iterator to the first element.
void clear()
Clears this small_set.
T & reference
Reference to element.
iterator find_i(const T &x)
Finds where an element is or where it should be inserted from its value.
void print(std::ostream &out) const
Displays the stored elements.
iterator insert(const T &x)
Insert a new element.
void push_back(const T &x)
Appends an element to the end of the list.
index_t size() const
Gets the number of element in this small_set.
const_iterator end() const
Gets a const iterator one position past the last element.
iterator end_of_storage()
Gets an iterator one position past the last element that can be stored.
Abstract interface for Delaunay triangulation in Nd.
Implementation of Delaunay using nearest neighbors.
std::ostream & operator<<(std::ostream &os, const GEO::expansion_nt &a)
Displays the approximated value of an expansion_nt to a stream.
index_t EdgeFlags
A set of EdgeFlags.
void sets_intersect(const small_set< T, DIM1 > &S1, const small_set< T, DIM2 > &S2, small_set< T, DIM3 > &I)
Computes the intersection between two small_sets.
index_t EdgeFlag
An individual edge flag.
Common include file, providing basic definitions. Should be included before anything else by all head...
The class that represents a mesh.
void * aligned_malloc(size_t size, size_t alignment=GEO_MEMORY_ALIGNMENT)
Allocates aligned memory.
void aligned_free(void *p)
Deallocates aligned memory.
T geo_sqr(T x)
Gets the square value of a value.
geo_signed_index_t signed_index_t
The type for storing and manipulating indices differences.
Sign geo_sgn(const T &x)
Gets the sign of a value.
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.
Function and classes for process manipulation.