Geogram  Version 1.9.1-rc
A programming library of geometric algorithms
VBW::ConvexCell Class Reference

Computes the intersection between a set of halfplanes using Bowyer-Watson algorithm. More...

#include <geogram/voronoi/convex_cell.h>

Public Member Functions

 ConvexCell (ConvexCellFlags flags=None)
 ConvexCell constructor. More...
 
void use_exact_predicates (bool x)
 Specifies whether exact predicates should be used. More...
 
bool has_vglobal () const
 Tests whether global vertex indices are stored. More...
 
bool has_tflags () const
 Tests whether triangle flags are stored. More...
 
void create_vglobal ()
 Creates vertex global indices if they are not present.
 
void clear ()
 Removes all vertices and triangles from this ConvexCell. More...
 
void init_with_box (double xmin, double ymin, double zmin, double xmax, double ymax, double zmax)
 Initializes this ConvexCell to an axis-aligned box. More...
 
void init_with_tet (vec4 P0, vec4 P1, vec4 P2, vec4 P3)
 Initializes this ConvexCell to a tetrahedron. More...
 
void init_with_tet (vec4 P0, vec4 P1, vec4 P2, vec4 P3, global_index_t P0_global_index, global_index_t P1_global_index, global_index_t P2_global_index, global_index_t P3_global_index)
 Initializes this ConvexCell to a tetrahedron. More...
 
void save (const std::string &filename, double shrink=0.0) const
 Saves the computed cell in alias wavefront file format. More...
 
index_t save (std::ostream &out, global_index_t v_offset=1, double shrink=0.0, bool borders_only=false) const
 Saves the computed cell in alias wavefront file format. More...
 
void append_to_mesh (GEO::Mesh *mesh, double shrink=0.0, bool borders_only=false, GEO::Attribute< GEO::index_t > *facet_attr=nullptr) const
 Appends the computed cell to a GEO::Mesh. More...
 
void for_each_Voronoi_vertex (index_t v, std::function< void(index_t)> vertex)
 Calls a user-defined function for each vertex of a Voronoi facet. More...
 
void clip_by_plane (vec4 P)
 Clips this convex cell by a new plane. More...
 
void clip_by_plane (vec4 P, global_index_t j)
 Clips this convex cell by a new plane and stores the corresponding global index in the newly created vertex. More...
 
void clip_by_plane (vec4 P, global_index_t P_global_index, std::function< bool(ushort, ushort)> triangle_conflict_predicate)
 Clips this convex cell by a new plane, using a user-defined geometric predicate. More...
 
void clip_by_plane_fast (vec4 P)
 Clips this convex cell by a new plane and stores the corresponding global index in the newly created vertex. More...
 
void clip_by_plane_fast (vec4 P, global_index_t j)
 Clips this convex cell by a new plane and stores the corresponding global index in the newly created vertex. More...
 
index_t nb_t () const
 Gets the number of triangles. More...
 
index_t nb_v () const
 Gets the number of vertices. More...
 
index_t create_vertex (vec4 P)
 Directly creates a new vertex. More...
 
index_t create_vertex (vec4 P, global_index_t v)
 Directly creates a new vertex. More...
 
index_t create_triangle (index_t i, index_t j, index_t k)
 Directly creates a new triangle. More...
 
void kill_vertex (index_t v)
 Replaces a vertex with the vertex at infinity in all facets. More...
 
bool vertex_is_contributing (index_t v) const
 Tests whether a vertex has a corresponding facet in the cell. More...
 
index_t vertex_triangle (index_t v) const
 Gets a triangle incident to a vertex. More...
 
void compute_geometry ()
 Computes the geometry and some cached information. More...
 
double facet_area (index_t v) const
 Gets the dual facet area of a given vertex. More...
 
double volume () const
 Computes the volume of this convex cell. More...
 
vec3 barycenter () const
 Computes the barycenter of this convex cell. More...
 
void compute_mg (double &m, vec3 &mg) const
 Computes volume and barycenter. More...
 
double squared_radius (vec3 center) const
 Computes the squared radius of the smallest sphere containing the cell and centered on a point. More...
 
double squared_inner_radius (vec3 center) const
 Computes the squared radius of the largest sphere contained in the cell and centered on a point. More...
 
bool empty () const
 Tests whether this ConvexCell is empty. More...
 
global_index_t v_global_index (index_t lv) const
 Gets the global vertex index from a local vertex index. More...
 
void set_v_global_index (index_t lv, global_index_t v)
 Sets the global vertex index associated with a local vertex index. More...
 
bool has_v_global_index (global_index_t v) const
 Tests whether a vertex with a given global index exists in this ConvexCell. More...
 
ushort first_triangle () const
 Gets the first triangle. More...
 
ushort next_triangle (ushort t) const
 Gets the successor of a triangle. More...
 
vec3 triangle_point (ushort t) const
 Gets the point that corresponds to a triangle. More...
 
global_index_t triangle_v_global_index (ushort t, index_t llv) const
 Gets the global index of a triangle vertex. More...
 
index_t triangle_v_local_index (ushort t, index_t llv) const
 Gets the local index of a triangle vertex. More...
 
bool triangle_is_user_marked (ushort t)
 Tests whether a triangle is marked by the user. More...
 
void triangle_user_mark (ushort t)
 Sets the user mark on a triangle. More...
 
void triangle_user_unmark (ushort t)
 Resets the user mark on a triangle. More...
 
bool cell_has_conflict (const vec4 &P)
 Tests whether a cell has at least one vertex in conflict with a halfspace. More...
 
bool cell_is_totally_in_conflict (const vec4 &P)
 Tests whether a cell has all its vertices in conflict with a plane. More...
 
index_t triangle_adjacent (index_t t, index_t le) const
 Gets a triangle adjacent to another triangle by edge local index. More...
 
void set_triangle_adjacent (index_t t1, index_t le, index_t t2)
 Sets triangle to triangle adjacency. More...
 
index_t triangle_vertex (index_t t, index_t lv) const
 Gets a triangle vertex. More...
 
index_t triangle_find_vertex (index_t t, index_t v) const
 Gets the local index of a vertex in a triangle. More...
 
index_t triangle_find_adjacent (index_t t1, index_t t2) const
 Gets the edge on witch a triangle is adjacent to another one. More...
 
bool triangle_is_infinite (index_t t) const
 Tests whether a triangle is infinite. More...
 
vec4 vertex_plane (index_t v) const
 Gets the equation of a plane associated with a vertex. More...
 
vec3 vertex_plane_normal (index_t v) const
 Gets the normal to the plane associated with a vertex. More...
 
bool triangle_is_marked_as_conflict (index_t t) const
 Tests whether a triangle is marked as conflict. More...
 
bool triangle_is_in_conflict (TriangleWithFlags T, const vec4 &eqn) const
 Tests whether a triangle is in conflict with a plane. More...
 
index_t new_triangle (index_t i, index_t j, index_t k)
 Creates a new triangle. More...
 
index_t new_triangle (index_t i, index_t j, index_t k, index_t adj0, index_t adj1, index_t adj2)
 Creates a new triangle. More...
 
vec4 compute_triangle_point (index_t t) const
 Computes the coordinates of the point associated with a triangle. More...
 
Triangle get_triangle (index_t t) const
 Gets the three vertices of a triangle. More...
 
ushort get_triangle_flags (index_t t) const
 Gets the flags associated with a triangle. More...
 
void set_triangle_flags (index_t t, ushort flags)
 Sets the flags of a triangle. More...
 
TriangleWithFlags get_triangle_and_flags (index_t t) const
 Gets the three vertices of a triangle and its flags. More...
 
bool triangle_is_marked_as_conflict (index_t t)
 Tests whether a given triangle is in the conflict zone.
 
index_t max_t () const
 Gets the maximum valid index for a triangle. More...
 
index_t max_v () const
 Gets the maximum valid index for a vertex. More...
 
void grow_t ()
 Allocates more space for triangles. More...
 
void grow_v ()
 Allocates more space for vertices. More...
 
void swap (ConvexCell &other)
 Swaps two ConvexCells. More...
 
vec3 & stored_triangle_point (ushort t)
 Gets a modifiable reference to a triangle point. More...
 

Protected Member Functions

void connect_triangles ()
 finds all triangle-triangle adjacency relations. More...
 
void triangulate_conflict_zone (index_t lv, index_t conflict_head, index_t conflict_tail)
 Triangulates the conflict zone. More...
 
void set_vertex_plane (index_t v, vec4 P)
 Changes a vertex plane equation. More...
 

Friends

class GEO::PeriodicDelaunay3d
 

Detailed Description

Computes the intersection between a set of halfplanes using Bowyer-Watson algorithm.

Do not use with a large number of planes.

Definition at line 419 of file convex_cell.h.

Constructor & Destructor Documentation

◆ ConvexCell()

VBW::ConvexCell::ConvexCell ( ConvexCellFlags  flags = None)

ConvexCell constructor.

Parameters
[in]flagsa combination of WithVGlobal, WithTFlags

Member Function Documentation

◆ append_to_mesh()

void VBW::ConvexCell::append_to_mesh ( GEO::Mesh mesh,
double  shrink = 0.0,
bool  borders_only = false,
GEO::Attribute< GEO::index_t > *  facet_attr = nullptr 
) const

Appends the computed cell to a GEO::Mesh.

Parameters
[out]mesha pointer to the mesh.
[in]shrinkshrinking factor to ease visualization.
[in]borders_onlyif set, only facets that correspond to vertex global index -1 are saved.
[in]facet_attroptional facet attribute that stores global facet (dual vertex) ids.
Note
One needs to call mesh->facets.connect() afterwards to have facets adjacencies. It is not called because one may want to append multiple cells to the same mesh.

◆ barycenter()

vec3 VBW::ConvexCell::barycenter ( ) const

Computes the barycenter of this convex cell.

compute_geometry() needs to be called before.

Returns
the barycenter.

◆ cell_has_conflict()

bool VBW::ConvexCell::cell_has_conflict ( const vec4 &  P)
inline

Tests whether a cell has at least one vertex in conflict with a halfspace.

Parameters
[in]Pthe equation of the halfspace.
Return values
trueif there exists a triangle t such that triangle_is_in_conflict(P)
falseotherwise.

Definition at line 966 of file convex_cell.h.

◆ cell_is_totally_in_conflict()

bool VBW::ConvexCell::cell_is_totally_in_conflict ( const vec4 &  P)
inline

Tests whether a cell has all its vertices in conflict with a plane.

Parameters
[in]Pthe equation of the halfspace.
Return values
trueif all the triangles are in conflict with P.
falseotherwise.

Definition at line 986 of file convex_cell.h.

◆ clear()

void VBW::ConvexCell::clear ( )

Removes all vertices and triangles from this ConvexCell.

Keeps allocated memory for future use.

◆ clip_by_plane() [1/3]

void VBW::ConvexCell::clip_by_plane ( vec4  P)

Clips this convex cell by a new plane.

The positive side of the plane equation corresponds to what is kept. In other words, the normal vector P.x, P.y, P.z points towards the interior of this ConvexCell.

Parameters
[in]Pthe plane equation.

◆ clip_by_plane() [2/3]

void VBW::ConvexCell::clip_by_plane ( vec4  P,
global_index_t  j 
)

Clips this convex cell by a new plane and stores the corresponding global index in the newly created vertex.

The positive side of the plane equation corresponds to what is kept. In other words, the normal vector P.x, P.y, P.z points towards the interior of this ConvexCell. This function can only be called if global indices are stored.

Parameters
[in]Pthe plane equation.
[in]jthe global index of the plane.

◆ clip_by_plane() [3/3]

void VBW::ConvexCell::clip_by_plane ( vec4  P,
global_index_t  P_global_index,
std::function< bool(ushort, ushort)>  triangle_conflict_predicate 
)

Clips this convex cell by a new plane, using a user-defined geometric predicate.

It is useful to be able to have a user-defined geometric predicates when the vertices have a symbolic representation, stored in the global indices associated with the plane. It is used by the robust mesh boolean operations. The positive side of the plane equation corresponds to what is kept. In other words, the normal vector P.x, P.y, P.z points towards the interior of this ConvexCell. If global indices are stored, then j is stored as the global index of the plane equation.

Parameters
[in]Pthe plane equation.
[in]P_global_indexthe global index of the plane.
[in]triangle_conflict_predicatea function that takes as arguments a local triangle index and local vertex (plane eqn) index, and that returns true if the triangle is in conflict with the vertex.

◆ clip_by_plane_fast() [1/2]

void VBW::ConvexCell::clip_by_plane_fast ( vec4  P)

Clips this convex cell by a new plane and stores the corresponding global index in the newly created vertex.

For a ConvexCell with a large number of facets, this version is faster than clip_by_plane(). However, it cannot be used with a ConvexCell that has infinite faces.

Parameters
[in]Pthe plane equation.
See also
clip_by_plane()

◆ clip_by_plane_fast() [2/2]

void VBW::ConvexCell::clip_by_plane_fast ( vec4  P,
global_index_t  j 
)

Clips this convex cell by a new plane and stores the corresponding global index in the newly created vertex.

For a ConvexCell with a large number of facets, this version is faster than clip_by_plane(). However, it cannot be used with a ConvexCell that has infinite faces.

Parameters
[in]Pthe plane equation.
[in]jthe global index of the plane.
See also
clip_by_plane()

◆ compute_geometry()

void VBW::ConvexCell::compute_geometry ( )

Computes the geometry and some cached information.

Needs to be called before volume(), facet_area() and barycenter().

◆ compute_mg()

void VBW::ConvexCell::compute_mg ( double &  m,
vec3 &  mg 
) const

Computes volume and barycenter.

Parameters
[out]mthe computed volume
[out]mgthe computed volume times the barycenter

compute_geometry() needs to be called before.

◆ compute_triangle_point()

vec4 VBW::ConvexCell::compute_triangle_point ( index_t  t) const

Computes the coordinates of the point associated with a triangle.

Parameters
[in]tthe triangle.
Returns
the intersection between the three planes associated with the three vertices of the triangle, in homogeneous coordinates.

◆ connect_triangles()

void VBW::ConvexCell::connect_triangles ( )
protected

finds all triangle-triangle adjacency relations.

Client code should not need to call this function. It is used by PeriodicDelaunay3d::copy_Laguerre_cell_from_Delaunay().

◆ create_triangle()

index_t VBW::ConvexCell::create_triangle ( index_t  i,
index_t  j,
index_t  k 
)
inline

Directly creates a new triangle.

Parameters
[in]i,j,kthe three vertices of the triangle.

The triangle is inserted into the list of valid triangles.

Returns
the index of the newly created triangle.

Definition at line 708 of file convex_cell.h.

◆ create_vertex() [1/2]

index_t VBW::ConvexCell::create_vertex ( vec4  P)
inline

Directly creates a new vertex.

Parameters
[in]Pthe plane equation attached to the vertex.
Returns
the index of the newly created vertex.

Definition at line 677 of file convex_cell.h.

◆ create_vertex() [2/2]

index_t VBW::ConvexCell::create_vertex ( vec4  P,
global_index_t  v 
)
inline

Directly creates a new vertex.

Parameters
[in]Pthe plane equation attached to the vertex.
[in]vthe global index associated with the vertex.
Returns
the index of the newly created vertex.
Precondition
global vertex indices are stored

Definition at line 694 of file convex_cell.h.

◆ empty()

bool VBW::ConvexCell::empty ( ) const
inline

Tests whether this ConvexCell is empty.

ConvexCell can be empty if everything was clipped out.

Return values
trueif this ConvexCell is empty.
falseotherwise.

Definition at line 817 of file convex_cell.h.

◆ facet_area()

double VBW::ConvexCell::facet_area ( index_t  v) const

Gets the dual facet area of a given vertex.

compute_geometry() needs to be called before.

Parameters
[in]vthe vertex.
Returns
the dual facet area associated with v.

terminate() needs to be called before calling this function.

◆ first_triangle()

ushort VBW::ConvexCell::first_triangle ( ) const
inline

Gets the first triangle.

Returns
the index of the first triangle, or END_OF_LIST if this ConvexCell is empty.

Definition at line 866 of file convex_cell.h.

◆ for_each_Voronoi_vertex()

void VBW::ConvexCell::for_each_Voronoi_vertex ( index_t  v,
std::function< void(index_t)>  vertex 
)

Calls a user-defined function for each vertex of a Voronoi facet.

One needs to call compute_geometry() before calling this function.

Parameters
[in]vthe index of the (dual) Voronoi Facet, that is a (primal) vertex, in [0..nb_v()-1]
[in]vertexa function that takes an index_t as an argument, with the index of the triangle that corresponds to the current Voronoi vertex.

◆ get_triangle()

Triangle VBW::ConvexCell::get_triangle ( index_t  t) const
inline

Gets the three vertices of a triangle.

Parameters
[in]tthe triangle.
Returns
a Triangle with the indices of the three vertices of the triangle.

Definition at line 1202 of file convex_cell.h.

◆ get_triangle_and_flags()

TriangleWithFlags VBW::ConvexCell::get_triangle_and_flags ( index_t  t) const
inline

Gets the three vertices of a triangle and its flags.

Parameters
[in]tthe triangle.
Returns
a TriangleWithFlags with the indices of the three vertices of the triangle and the flags.

Definition at line 1235 of file convex_cell.h.

◆ get_triangle_flags()

ushort VBW::ConvexCell::get_triangle_flags ( index_t  t) const
inline

Gets the flags associated with a triangle.

Contains both the conflict flag and the chaining.

Parameters
[in]tthe triangle.
Returns
the flags associated with t.

Definition at line 1214 of file convex_cell.h.

◆ grow_t()

void VBW::ConvexCell::grow_t ( )

Allocates more space for triangles.

Makes max_t_ twice bigger.

◆ grow_v()

void VBW::ConvexCell::grow_v ( )

Allocates more space for vertices.

Makes max_v_ twice bigger.

◆ has_tflags()

bool VBW::ConvexCell::has_tflags ( ) const
inline

Tests whether triangle flags are stored.

Return values
trueif triangle flags are stored.
falseotherwise.

Definition at line 454 of file convex_cell.h.

◆ has_v_global_index()

bool VBW::ConvexCell::has_v_global_index ( global_index_t  v) const

Tests whether a vertex with a given global index exists in this ConvexCell.

Parameters
[in]vthe global index.
Return values
trueif there exists in this ConvexCell a vertex with global index v.
falseotherwise.

◆ has_vglobal()

bool VBW::ConvexCell::has_vglobal ( ) const
inline

Tests whether global vertex indices are stored.

Return values
trueif global vertex indices are stored.
falseotherwise.

Definition at line 445 of file convex_cell.h.

◆ init_with_box()

void VBW::ConvexCell::init_with_box ( double  xmin,
double  ymin,
double  zmin,
double  xmax,
double  ymax,
double  zmax 
)

Initializes this ConvexCell to an axis-aligned box.

Previous contents of this ConvexCell are discarded. Vertex 0 is vertex at infinity.

Parameters
[in]xmin,ymin,zmin,xmax,ymax,zmaxthe coordinates of the box.

◆ init_with_tet() [1/2]

void VBW::ConvexCell::init_with_tet ( vec4  P0,
vec4  P1,
vec4  P2,
vec4  P3 
)

Initializes this ConvexCell to a tetrahedron.

Previous contents of this ConvexCell are discarded. Vertex 0 is vertex at infinity.

Parameters
[in]P0,P1,P2,P3the plane equations of the four faces of the tetrahedron.

◆ init_with_tet() [2/2]

void VBW::ConvexCell::init_with_tet ( vec4  P0,
vec4  P1,
vec4  P2,
vec4  P3,
global_index_t  P0_global_index,
global_index_t  P1_global_index,
global_index_t  P2_global_index,
global_index_t  P3_global_index 
)

Initializes this ConvexCell to a tetrahedron.

Previous contents of this ConvexCell are discarded. Vertex 0 is vertex at infinity.

Parameters
[in]P0,P1,P2,P3the plane equations of the four faces of the tetrahedron.
[in]P0_global_index,P1_global_index,P1_global_index,P2_global_indexthe global indices associated with the plane equations.
Precondition
has_vglobal()

◆ kill_vertex()

void VBW::ConvexCell::kill_vertex ( index_t  v)

Replaces a vertex with the vertex at infinity in all facets.

Parameters
[in]vthe vertex to be killed.

◆ max_t()

index_t VBW::ConvexCell::max_t ( ) const
inline

Gets the maximum valid index for a triangle.

Returns
the maximum valid index of a triangle.

Definition at line 1253 of file convex_cell.h.

◆ max_v()

index_t VBW::ConvexCell::max_v ( ) const
inline

Gets the maximum valid index for a vertex.

Returns
the maximum valid index of a vertex.

Definition at line 1261 of file convex_cell.h.

◆ nb_t()

index_t VBW::ConvexCell::nb_t ( ) const
inline

Gets the number of triangles.

Returns
the number of created triangles.

The created triangles are not necessarily valid ones. To get the valid triangles, one needs to traverse the list from first_valid_.

Definition at line 657 of file convex_cell.h.

◆ nb_v()

index_t VBW::ConvexCell::nb_v ( ) const
inline

Gets the number of vertices.

Returns
the number of vertices.

Some vertices can be incident to no triangle. The first six vertices correspond to the facets of the initial axis aligned box passed to the constructor.

Definition at line 668 of file convex_cell.h.

◆ new_triangle() [1/2]

index_t VBW::ConvexCell::new_triangle ( index_t  i,
index_t  j,
index_t  k 
)
inline

Creates a new triangle.

Parameters
[in]i,j,kthe three vertices of the triangle.

Definition at line 1143 of file convex_cell.h.

◆ new_triangle() [2/2]

index_t VBW::ConvexCell::new_triangle ( index_t  i,
index_t  j,
index_t  k,
index_t  adj0,
index_t  adj1,
index_t  adj2 
)
inline

Creates a new triangle.

Adjacency information is not used (kept for reference).

Parameters
[in]i,j,kthe three vertices of the triangle.
[in]adj0,adj1,adj2the three adjacent triangles (unused in this version).
Returns
the index of the new triangle.

Definition at line 1175 of file convex_cell.h.

◆ next_triangle()

ushort VBW::ConvexCell::next_triangle ( ushort  t) const
inline

Gets the successor of a triangle.

Parameters
[in]tthe index of a valid triangle.
Returns
the index of the successor of t, or END_OF_LIST if t is the last triangle.

Definition at line 876 of file convex_cell.h.

◆ save() [1/2]

void VBW::ConvexCell::save ( const std::string &  filename,
double  shrink = 0.0 
) const

Saves the computed cell in alias wavefront file format.

Parameters
[in]filenamethe name of the file where to save the cell.
[in]shrinkshrinking factor to ease visualization.

◆ save() [2/2]

index_t VBW::ConvexCell::save ( std::ostream &  out,
global_index_t  v_offset = 1,
double  shrink = 0.0,
bool  borders_only = false 
) const

Saves the computed cell in alias wavefront file format.

Parameters
[out]outa stream where to save the output.
[in]v_offsetoffset applied to vertex indices.
[in]shrinkshrinking factor to ease visualization.
[in]borders_onlyif set, only facets that correspond to vertex global index -1 are saved.
Returns
the number of created vertices.

◆ set_triangle_adjacent()

void VBW::ConvexCell::set_triangle_adjacent ( index_t  t1,
index_t  le,
index_t  t2 
)
inline

Sets triangle to triangle adjacency.

Parameters
[in]t1a triangle.
[in]lelocal index of an edge of t (in 0..2).
[in]t2triangle to be made adjacent to t1 along edge le.

Definition at line 1019 of file convex_cell.h.

◆ set_triangle_flags()

void VBW::ConvexCell::set_triangle_flags ( index_t  t,
ushort  flags 
)
inline

Sets the flags of a triangle.

Parameters
[in]tthe triangle.
[in]flagsthe flags to be set.

Definition at line 1224 of file convex_cell.h.

◆ set_v_global_index()

void VBW::ConvexCell::set_v_global_index ( index_t  lv,
global_index_t  v 
)
inline

Sets the global vertex index associated with a local vertex index.

Vertex indices correspond to planes (remember, we are in dual form).

Parameters
[in]lvthe local vertex index
[in]vthe global vertex index that corresponds to lv.

Definition at line 845 of file convex_cell.h.

◆ set_vertex_plane()

void VBW::ConvexCell::set_vertex_plane ( index_t  v,
vec4  P 
)
inlineprotected

Changes a vertex plane equation.

Parameters
[in]vthe vertex.
[in]Pthe plane equation.

Does not update combinatorics.

Note
Use with care, for experts only.

Definition at line 1343 of file convex_cell.h.

◆ squared_inner_radius()

double VBW::ConvexCell::squared_inner_radius ( vec3  center) const

Computes the squared radius of the largest sphere contained in the cell and centered on a point.

Returns
the minimum squared distance between center and all facets of the cell.

◆ squared_radius()

double VBW::ConvexCell::squared_radius ( vec3  center) const

Computes the squared radius of the smallest sphere containing the cell and centered on a point.

Returns
the maximum squared distance between center and all the vertices of the cell.

◆ stored_triangle_point()

vec3& VBW::ConvexCell::stored_triangle_point ( ushort  t)
inline

Gets a modifiable reference to a triangle point.

Parameters
[in]tthe index
Returns
a modifiable reference to the stored point

Definition at line 1311 of file convex_cell.h.

◆ swap()

void VBW::ConvexCell::swap ( ConvexCell other)
inline

Swaps two ConvexCells.

Parameters
[in]otherthe ConvexCell to be exchanged with this ConvexCell.

Definition at line 1283 of file convex_cell.h.

◆ triangle_adjacent()

index_t VBW::ConvexCell::triangle_adjacent ( index_t  t,
index_t  le 
) const
inline

Gets a triangle adjacent to another triangle by edge local index.

Parameters
[in]ta triangle.
[in]lelocal index of an edge of t (in 0..2).
Returns
the triangle adjacent to t along \ p e.

Definition at line 1006 of file convex_cell.h.

◆ triangle_find_adjacent()

index_t VBW::ConvexCell::triangle_find_adjacent ( index_t  t1,
index_t  t2 
) const
inline

Gets the edge on witch a triangle is adjacent to another one.

Parameters
[in]t1a triangle.
[in]t2a triangle adjacent to t1
Returns
the edge index e such that triangle_adjacent(t1,e)=t2

Definition at line 1061 of file convex_cell.h.

◆ triangle_find_vertex()

index_t VBW::ConvexCell::triangle_find_vertex ( index_t  t,
index_t  v 
) const
inline

Gets the local index of a vertex in a triangle.

Parameters
[in]ta triangle.
[in]va vertex index.
Returns
the local index of v in t (in 0..2).

Definition at line 1047 of file convex_cell.h.

◆ triangle_is_in_conflict()

bool VBW::ConvexCell::triangle_is_in_conflict ( TriangleWithFlags  T,
const vec4 &  eqn 
) const

Tests whether a triangle is in conflict with a plane.

A triangle is in conflict with a plane if feeding the point associated with the triangle in the equation of the plane yields a negative number.

Parameters
[in]Ta triangle.
[in]eqnthe four coefficients of the equation of the plane.
Return values
trueif t is in conflict with eqn.
falseotherwise.

◆ triangle_is_infinite()

bool VBW::ConvexCell::triangle_is_infinite ( index_t  t) const
inline

Tests whether a triangle is infinite.

Parameters
[in]tthe triangle
Return values
trueif t is incident to the vertex at infinity.
falseotherwise.

Definition at line 1077 of file convex_cell.h.

◆ triangle_is_marked_as_conflict()

bool VBW::ConvexCell::triangle_is_marked_as_conflict ( index_t  t) const
inline

Tests whether a triangle is marked as conflict.

Parameters
[in]ta triangle.
Return values
trueif t is marked as conflict.
falseotherwise.

Definition at line 1120 of file convex_cell.h.

◆ triangle_is_user_marked()

bool VBW::ConvexCell::triangle_is_user_marked ( ushort  t)
inline

Tests whether a triangle is marked by the user.

Parameters
[in]tthe triangle.
Return values
trueif the triangle is marked.
falseotherwise.
Precondition
triangle flags are stored.

Definition at line 930 of file convex_cell.h.

◆ triangle_point()

vec3 VBW::ConvexCell::triangle_point ( ushort  t) const
inline

Gets the point that corresponds to a triangle.

If compute_geometry() was called, this gets the previously computed point, else it is computed and returned.

Parameters
[in]tthe index of the triangle.
Returns
the point that corresponds to triangle t.

Definition at line 888 of file convex_cell.h.

◆ triangle_user_mark()

void VBW::ConvexCell::triangle_user_mark ( ushort  t)
inline

Sets the user mark on a triangle.

Parameters
[in]tthe triangle.
Precondition
triangle flags are stored.

Definition at line 941 of file convex_cell.h.

◆ triangle_user_unmark()

void VBW::ConvexCell::triangle_user_unmark ( ushort  t)
inline

Resets the user mark on a triangle.

Parameters
[in]tthe triangle.
Precondition
triangle flags are stored.

Definition at line 952 of file convex_cell.h.

◆ triangle_v_global_index()

global_index_t VBW::ConvexCell::triangle_v_global_index ( ushort  t,
index_t  llv 
) const
inline

Gets the global index of a triangle vertex.

Parameters
[in]tthe triangle.
[in]llvone of 0,1,2.
Returns
the global index of the vertex.
Precondition
global indices are stored.

Definition at line 906 of file convex_cell.h.

◆ triangle_v_local_index()

index_t VBW::ConvexCell::triangle_v_local_index ( ushort  t,
index_t  llv 
) const
inline

Gets the local index of a triangle vertex.

Parameters
[in]tthe triangle.
[in]llvone of 0,1,2.
Returns
the local index of the vertex, in 0..nb_v()-1

Definition at line 918 of file convex_cell.h.

◆ triangle_vertex()

index_t VBW::ConvexCell::triangle_vertex ( index_t  t,
index_t  lv 
) const
inline

Gets a triangle vertex.

Parameters
[in]ta triangle.
[in]lvlocal index of a vertex of t (in 0..2).
Returns
the vertex

Definition at line 1034 of file convex_cell.h.

◆ triangulate_conflict_zone()

void VBW::ConvexCell::triangulate_conflict_zone ( index_t  lv,
index_t  conflict_head,
index_t  conflict_tail 
)
protected

Triangulates the conflict zone.

Parameters
[in]lvthe local index of the new vertex
[in]conflict_head,conflicttail the first and last triangle of the conflict zone stored as a linked list.

◆ use_exact_predicates()

void VBW::ConvexCell::use_exact_predicates ( bool  x)
inline

Specifies whether exact predicates should be used.

Parameters
[in]xtrue if exact predicates should be used.

Not supported if ConvexCell distributed as standalone file.

Definition at line 435 of file convex_cell.h.

◆ v_global_index()

global_index_t VBW::ConvexCell::v_global_index ( index_t  lv) const
inline

Gets the global vertex index from a local vertex index.

Vertex indices correspond to planes (remember, we are in dual form).

Parameters
[in]lvthe local vertex index
Returns
the global vertex index that corresponds to lv.

Definition at line 830 of file convex_cell.h.

◆ vertex_is_contributing()

bool VBW::ConvexCell::vertex_is_contributing ( index_t  v) const
inline

Tests whether a vertex has a corresponding facet in the cell.

Calling compute_geometry() before makes this function faster.

Definition at line 728 of file convex_cell.h.

◆ vertex_plane()

vec4 VBW::ConvexCell::vertex_plane ( index_t  v) const
inline

Gets the equation of a plane associated with a vertex.

The first six equations correspond to the six facets of a cube.

Parameters
[in]vthe local index of the vertex.

Definition at line 1093 of file convex_cell.h.

◆ vertex_plane_normal()

vec3 VBW::ConvexCell::vertex_plane_normal ( index_t  v) const
inline

Gets the normal to the plane associated with a vertex.

The first six equations correspond to the six facets of a cube.

Parameters
[in]vthe local index of the vertex.

Definition at line 1104 of file convex_cell.h.

◆ vertex_triangle()

index_t VBW::ConvexCell::vertex_triangle ( index_t  v) const
inline

Gets a triangle incident to a vertex.

Parameters
[in]vvertex index.
Returns
a triangle incident to v.

Definition at line 748 of file convex_cell.h.

◆ volume()

double VBW::ConvexCell::volume ( ) const

Computes the volume of this convex cell.

compute_geometry() needs to be called before.

Returns
the volume.

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