40 #ifndef GEOGRAM_VORONOI_GENERIC_RVD_POLYGON
41 #define GEOGRAM_VORONOI_GENERIC_RVD_POLYGON
126 vertex_.push_back(v);
127 return &*(vertex_.rbegin());
180 template <index_t DIM>
185 bool exact,
bool symbolic
188 clip_by_plane_exact<DIM>(
189 target, target_intersections, mesh, delaunay, i, j
192 clip_by_plane_fast<DIM>(
193 target, target_intersections, delaunay, i, j, symbolic
204 vertex_ = rhs.vertex_;
213 vertex_.swap(rhs.vertex_);
241 template <index_t DIM>
252 const double* geo_restrict pi = delaunay->
vertex_ptr(i);
254 const double* geo_restrict pj = delaunay->
vertex_ptr(j);
260 geo_decl_aligned(
double d);
263 d += (pi[c] + pj[c]) * (pi[c] - pj[c]);
269 const double* geo_restrict prev_pk = prev_vk->
point();
274 geo_decl_aligned(
double prev_l);
277 prev_l += prev_pk[c] * (pi[c] - pj[c]);
286 const double* pk = vk->
point();
289 geo_decl_aligned(
double l);
292 l += pk[c] * (pi[c] - pj[c]);
301 if(status != prev_status && (prev_status != 0)) {
303 double* Ipoint = target_intersections.
new_item();
308 prev_vk->
sym(), vk->
sym(), j
322 double denom = 2.0 * (prev_l - l);
323 double lambda1, lambda2;
326 if(::fabs(denom) < 1e-20) {
330 lambda1 = (d - 2.0 * l) / denom;
335 lambda2 = 1.0 - lambda1;
342 lambda1 * prev_pk[c] +
362 prev_status = status;
384 template <index_t DIM>
402 mesh, delaunay, *prev_vk, pi, pj, DIM
411 if(status != prev_status && (prev_status != 0)) {
416 prev_vk->
sym(), vk->
sym(), j
426 target_intersections, *prev_vk, *vk, pi, pj
441 prev_status = status;
465 const Vertex& q,
const double* pi,
const double* pj,
#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.
double * new_item()
Allocates a new point.
Internal representation of polygons for GenericVoronoiDiagram.
void initialize_from_mesh_facet(const Mesh *mesh, index_t f, bool symbolic, const GEO::Attribute< double > &vertex_weight)
Assigns a mesh facet to this Polygon.
index_t nb_vertices() const
Gets the number of vertices.
void clip_by_plane_exact(Polygon &target, PointAllocator &target_intersections, const Mesh *mesh, const Delaunay *delaunay, index_t i, index_t j)
Clips a Polygon with a plane (exact version).
Vertex & vertex(index_t i)
Gets a vertex by index.
index_t next_vertex(index_t i) const
Gets the index of the successor of a Vertex.
void copy(const Polygon &rhs)
Overwrites this Polygon with the contents of another polygon.
const Vertex & vertex(index_t i) const
Gets a vertex by index.
static Sign side_exact(const Mesh *mesh, const Delaunay *delaunay, const Vertex &q, const double *pi, const double *pj, coord_index_t dim)
Returns the position of a point relative to a bisector (exact version).
index_t prev_vertex(index_t i) const
Gets the index of the predecessor of a Vertex.
void resize(index_t sz)
Resizes this Polygon.
void clip_by_plane_fast(Polygon &target, PointAllocator &target_intersections, const Delaunay *delaunay, index_t i, index_t j, bool symbolic) const
Clips a Polygon with a plane (fast inexact version).
void clip_by_plane(Polygon &target, PointAllocator &target_intersections, const Mesh *mesh, const Delaunay *delaunay, index_t i, index_t j, bool exact, bool symbolic)
Clips a polygon with a plane.
void clear()
Clears this Polygon.
Vertex * add_vertex(const Vertex &v)
Adds a Vertex to this Polygon.
void swap(Polygon &rhs)
Swaps the contents of this Polygon and another polygon.
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 set_adjacent_seed(signed_index_t s)
Sets the adjacent seed.
void set_flag(EdgeFlag f)
Sets an EdgeFlag in this 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.
const SymbolicVertex & sym() const
Gets the symbolic representation.
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 set_weight(double w)
Sets the vertex weight.
signed_index_t adjacent_seed() const
Gets the adjacent seed.
const double * point() const
Gets the geometric location at this Vertex.
Abstract interface for Delaunay triangulation in Nd.
const double * vertex_ptr(index_t i) const
Gets a pointer to a vertex by its global index.
Vector with aligned memory allocation.
Types and utilities for manipulating vertices in geometric and symbolic forms in restricted Voronoi d...
Common include file, providing basic definitions. Should be included before anything else by all head...
#define geo_dim_alignment(dim)
Gets a point alignment.
#define geo_assume_aligned(var, alignment)
Informs the compiler that a given pointer is memory-aligned.
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.