Geogram  Version 1.8.9-rc
A programming library of geometric algorithms
GEOGen::Polygon Class Reference

Internal representation of polygons for GenericVoronoiDiagram. More...

#include <geogram/voronoi/generic_RVD_polygon.h>

Public Member Functions

index_t nb_vertices () const
 Gets the number of vertices.
 
const Vertexvertex (index_t i) const
 Gets a vertex by index. More...
 
Vertexvertex (index_t i)
 Gets a vertex by index. More...
 
index_t next_vertex (index_t i) const
 Gets the index of the successor of a Vertex. More...
 
index_t prev_vertex (index_t i) const
 Gets the index of the predecessor of a Vertex. More...
 
Vertexadd_vertex (const Vertex &v)
 Adds a Vertex to this Polygon. More...
 
void clear ()
 Clears this Polygon.
 
void resize (index_t sz)
 Resizes this Polygon. More...
 
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. More...
 
template<index_t DIM>
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. More...
 
void copy (const Polygon &rhs)
 Overwrites this Polygon with the contents of another polygon. More...
 
void swap (Polygon &rhs)
 Swaps the contents of this Polygon and another polygon. More...
 

Protected Member Functions

template<index_t DIM>
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). More...
 
template<index_t DIM>
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). More...
 

Static Protected Member Functions

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). More...
 

Detailed Description

Internal representation of polygons for GenericVoronoiDiagram.

Stores both geometrical and symbolic representations.

Note
This is an internal implementation class used by GEO::RestrictedVoronoiDiagram. It is not meant to be used directly by client code.

Definition at line 64 of file generic_RVD_polygon.h.

Member Function Documentation

◆ add_vertex()

Vertex* GEOGen::Polygon::add_vertex ( const Vertex v)
inline

Adds a Vertex to this Polygon.

Parameters
[in]vthe vertex to be added. It is copied.
Returns
the address of the stored vertex.

Definition at line 125 of file generic_RVD_polygon.h.

◆ clip_by_plane()

template<index_t DIM>
void GEOGen::Polygon::clip_by_plane ( Polygon target,
PointAllocator target_intersections,
const Mesh mesh,
const Delaunay delaunay,
index_t  i,
index_t  j,
bool  exact,
bool  symbolic 
)
inline

Clips a polygon with a plane.

Computes the intersection between this Polygon and the half-space determined by the positive side of the bisector of segment [i,j] (on the same side as vertex i).

Parameters
[out]targetwhere to store the intersection
[out]target_intersectionswhere to allocate the generated vertices
[in]meshthe input mesh, used by the symbolic information
[in]delaunaythe Delaunay triangulation
[in]iindex of one extremity of bisector in delaunay
[in]jindex of the other extremity of the bisector in delaunay
[in]exactif true, exact predicates are used. Implies symbolic.
[in]symbolicif true, symbolic representation of vertices is computed

Definition at line 181 of file generic_RVD_polygon.h.

◆ clip_by_plane_exact()

template<index_t DIM>
void GEOGen::Polygon::clip_by_plane_exact ( Polygon target,
PointAllocator target_intersections,
const Mesh mesh,
const Delaunay delaunay,
index_t  i,
index_t  j 
)
inlineprotected

Clips a Polygon with a plane (exact version).

Computes the intersection between this Polygon and the half-space determined by the positive side of the bisector of segment [i,j] (the side of i). This version uses symbolically perturbed exact predicates.

Parameters
[out]targetwhere to store the intersection
[out]target_intersectionswhere to allocate the generated vertices
[in]meshthe input mesh (used by exact predicates)
[in]delaunaythe Delaunay triangulation
[in]iindex of one extremity of bisector in delaunay
[in]jindex of the other extremity of the bisector in delaunay

Definition at line 385 of file generic_RVD_polygon.h.

◆ clip_by_plane_fast()

template<index_t DIM>
void GEOGen::Polygon::clip_by_plane_fast ( Polygon target,
PointAllocator target_intersections,
const Delaunay delaunay,
index_t  i,
index_t  j,
bool  symbolic 
) const
inlineprotected

Clips a Polygon with a plane (fast inexact version).

Computes the intersection between this Polygon and the half-space determined by the positive side of the bisector of segment [i,j] (the side of i). This version uses a "fused" predicates-constructions strategy (and reuses the computations from the predicates to accelerate the constructions).

Parameters
[out]targetwhere to store the intersection
[out]target_intersectionswhere to allocate the generated vertices
[in]delaunaythe Delaunay triangulation
[in]iindex of one extremity of bisector in delaunay
[in]jindex of the other extremity of the bisector in delaunay
[in]symbolicif true, symbolic representation of vertices is computed

Definition at line 242 of file generic_RVD_polygon.h.

◆ copy()

void GEOGen::Polygon::copy ( const Polygon rhs)
inline

Overwrites this Polygon with the contents of another polygon.

Parameters
[in]rhsa const reference to the polygon to be copied.

Definition at line 203 of file generic_RVD_polygon.h.

◆ initialize_from_mesh_facet()

void GEOGen::Polygon::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.

The facet from the initial mesh is converted into the internal geometric/symbolic representation.

Parameters
[in]meshthe mesh from which the facet is copied
[in]fthe index of the facet in mesh
[in]symbolicif true, symbolic information is copied
[in]vertex_weighta reference to a vertex attribute that stores weights. If not bound, then 1.0 is used for the weights.

◆ next_vertex()

index_t GEOGen::Polygon::next_vertex ( index_t  i) const
inline

Gets the index of the successor of a Vertex.

Parameters
[in]iindex of the Vertex in this Polygon
Returns
the index of the successor of Vertex i
Precondition
i < nb_vertices()

Definition at line 102 of file generic_RVD_polygon.h.

◆ prev_vertex()

index_t GEOGen::Polygon::prev_vertex ( index_t  i) const
inline

Gets the index of the predecessor of a Vertex.

Parameters
[in]iindex of the Vertex in this Polygon
Returns
the index of the predecessor of Vertex i
Precondition
ii < nb_vertices()

Definition at line 115 of file generic_RVD_polygon.h.

◆ resize()

void GEOGen::Polygon::resize ( index_t  sz)
inline

Resizes this Polygon.

Parameters
[in]sznew size

Definition at line 141 of file generic_RVD_polygon.h.

◆ side_exact()

static Sign GEOGen::Polygon::side_exact ( const Mesh mesh,
const Delaunay delaunay,
const Vertex q,
const double *  pi,
const double *  pj,
coord_index_t  dim 
)
staticprotected

Returns the position of a point relative to a bisector (exact version).

Position of q relative to the bisector Pi(i,j). The symbolic representation of q is used. Symbolic perturbation is applied to degenerate configurations, therefore ZERO is never returned.

Parameters
[in]meshthe input mesh
[in]delaunaythe Delaunay triangulation
[in]qquery point
[in]pione extremity of the bisector
[in]pjthe other extremity of the bisector
[in]dimdimension of the points
Returns
POSITIVE if q is on pi's side, NEGATIVE otherwise (ZERO is never encountered thanks to globally coherent symbolic perturbations).

◆ swap()

void GEOGen::Polygon::swap ( Polygon rhs)
inline

Swaps the contents of this Polygon and another polygon.

Parameters
[in,out]rhsa reference to the Polygon to be swapped with this one.

Definition at line 212 of file generic_RVD_polygon.h.

◆ vertex() [1/2]

Vertex& GEOGen::Polygon::vertex ( index_t  i)
inline

Gets a vertex by index.

Parameters
[in]iindex of the Vertex in this Polygon
Returns
a reference to the Vertex at index i
Precondition
i < nb_vertices()

Definition at line 91 of file generic_RVD_polygon.h.

◆ vertex() [2/2]

const Vertex& GEOGen::Polygon::vertex ( index_t  i) const
inline

Gets a vertex by index.

Parameters
[in]iindex of the Vertex in this Polygon
Returns
a const reference to the Vertex at index i
Precondition
i < nb_vertices()

Definition at line 80 of file generic_RVD_polygon.h.


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