Easy3D 2.6.1
Loading...
Searching...
No Matches
Delaunay3 Class Reference

3D Delaunay triangulation, using Hang Si's tetgen. More...

#include <easy3d/algo/delaunay_3d.h>

Inheritance diagram for Delaunay3:
Delaunay

Public Member Functions

 Delaunay3 ()
 Default constructor.
 
 ~Delaunay3 () override
 Destructor.
 
void set_vertices (unsigned int nb_vertices, const float *vertices) override
 Sets the vertices from an array of floating point numbers, in which each consecutive number triple denotes a 3D point.
 
void set_vertices (const std::vector< vec3 > &vertices)
 Sets the vertices from an array of 3D points.
 
unsigned int nb_tets () const
 Returns the number of tetrahedra.
 
const int * tet_to_v () const
 Returns the pointer to the tetrahedron-to-vertex mapping.
 
const int * tet_to_tet () const
 Returns the pointer to the tetrahedron-to-tetrahedron mapping.
 
int vertex_tet (int v) const
 Returns the index of a tetrahedron containing the vertex v.
 
unsigned int nearest_vertex (const float *p) const override
 Finds the index of the nearest vertex to a given point.
 
unsigned int nearest_vertex (const vec3 &p) const
 Finds the index of the nearest vertex to a given 3D point.
 
const vec3vertex (unsigned int i) const
 Returns the coordinates of the vertex with index i.
 
int tet_vertex (unsigned int t, unsigned int lv) const
 Returns the index of the lv-th vertex in the t-th tetrahedron.
 
int tet_adjacent (unsigned int t, unsigned int lf) const
 Returns the index of the tetrahedron adjacent to the lf-th face of the t-th tetrahedron.
 
int tet_facet_vertex (unsigned int t, unsigned int lf, unsigned int lv) const
 Returns the index of the lv-th vertex in the lf-th face of the t-th tetrahedron.
 
int next_around_halfedge (int t, unsigned int lv1, unsigned int lv2) const
 Returns the next tetrahedron around the halfedge defined by vertices lv1 and lv2 in tetrahedron t.
 
int prev_around_halfedge (int t, unsigned int lv1, unsigned int lv2) const
 Returns the previous tetrahedron around the halfedge defined by vertices lv1 and lv2 in tetrahedron t.
 
vec3 facet_normal (unsigned int t, unsigned int f) const
 Computes the normal vector of the f-th face of the t-th tetrahedron.
 
vec3 tet_circumcenter (unsigned int t) const
 Computes the circumcenter of the t-th tetrahedron.
 
void get_voronoi_cell (unsigned int v, VoronoiCell3d &cell, bool geometry=true) const
 Computes the Voronoi cell associated with vertex v.
 
- Public Member Functions inherited from Delaunay
 Delaunay (unsigned int dimension)
 Constructor.
 
virtual ~Delaunay ()
 Virtual destructor.
 
unsigned int dimension () const
 Returns the dimension of the triangulation.
 
unsigned int cell_size () const
 Returns the size of a cell.
 
const float * vertices_ptr () const
 Returns a pointer to the vertices array.
 
const float * vertex_ptr (unsigned int i) const
 Returns a pointer to the vertex of index i.
 
unsigned int nb_vertices () const
 Returns the number of vertices.
 
unsigned int nb_cells () const
 Returns the number of cells.
 
const int * cell_to_v () const
 Returns a pointer to the cell-to-vertex mapping.
 
const int * cell_to_cell () const
 Returns a pointer to the cell-to-cell mapping.
 
int cell_vertex (unsigned int c, unsigned int lv) const
 Returns the index of the lv-th vertex in the c-th cell.
 
int cell_adjacent (unsigned int c, unsigned int lf) const
 Returns the index of the cell adjacent to the lf-th face of the c-th cell.
 
int vertex_cell (unsigned int v) const
 Returns the index of a cell containing the vertex v.
 
unsigned int index (unsigned int c, int v) const
 Returns the local index of vertex v within cell c.
 
unsigned int adjacent_index (unsigned int c1, unsigned int c2) const
 Returns the local index of the face shared by cells c1 and c2.
 
unsigned int next_around_vertex (unsigned int c, unsigned int lv) const
 Returns the next cell around vertex lv in cell c.
 
virtual void get_neighbors (unsigned int v, std::vector< unsigned int > &neighbors) const
 Retrieves the one-ring neighbors of vertex v.
 
bool check_duplicate_vertices ()
 Checks for duplicate vertices in stored neighbor lists.
 

Detailed Description

3D Delaunay triangulation, using Hang Si's tetgen.

This class provides functionality for 3D Delaunay triangulation using the tetgen library. It manages vertices, tetrahedra, and their relationships, and provides methods for querying the triangulation structure and computing Voronoi cells.

See also
Delaunay, Delaunay2

Member Function Documentation

◆ facet_normal()

vec3 facet_normal ( unsigned int t,
unsigned int f ) const
inline

Computes the normal vector of the f-th face of the t-th tetrahedron.

Parameters
tThe index of the tetrahedron.
fThe local index of the face within the tetrahedron.
Returns
The normal vector of the face.

◆ get_voronoi_cell()

void get_voronoi_cell ( unsigned int v,
VoronoiCell3d & cell,
bool geometry = true ) const

Computes the Voronoi cell associated with vertex v.

Parameters
vThe index of the vertex.
cellThe Voronoi cell to store the result.
geometryIf true, computes the geometry of the Voronoi cell.

◆ nb_tets()

unsigned int nb_tets ( ) const
inline

Returns the number of tetrahedra.

Returns
The number of tetrahedra in the triangulation.

◆ nearest_vertex() [1/2]

unsigned int nearest_vertex ( const float * p) const
inlineoverridevirtual

Finds the index of the nearest vertex to a given point.

Parameters
pA pointer to the coordinates of the point.
Returns
The index of the nearest vertex.

Reimplemented from Delaunay.

◆ nearest_vertex() [2/2]

unsigned int nearest_vertex ( const vec3 & p) const
inline

Finds the index of the nearest vertex to a given 3D point.

Parameters
pThe 3D point.
Returns
The index of the nearest vertex.

◆ next_around_halfedge()

int next_around_halfedge ( int t,
unsigned int lv1,
unsigned int lv2 ) const
inline

Returns the next tetrahedron around the halfedge defined by vertices lv1 and lv2 in tetrahedron t.

Parameters
tThe index of the tetrahedron.
lv1The local index of the first vertex.
lv2The local index of the second vertex.
Returns
The index of the next tetrahedron.

◆ prev_around_halfedge()

int prev_around_halfedge ( int t,
unsigned int lv1,
unsigned int lv2 ) const
inline

Returns the previous tetrahedron around the halfedge defined by vertices lv1 and lv2 in tetrahedron t.

Parameters
tThe index of the tetrahedron.
lv1The local index of the first vertex.
lv2The local index of the second vertex.
Returns
The index of the previous tetrahedron.

◆ set_vertices() [1/2]

void set_vertices ( const std::vector< vec3 > & vertices)
inline

Sets the vertices from an array of 3D points.

Parameters
verticesA vector of 3D points.

◆ set_vertices() [2/2]

void set_vertices ( unsigned int nb_vertices,
const float * vertices )
overridevirtual

Sets the vertices from an array of floating point numbers, in which each consecutive number triple denotes a 3D point.

Parameters
nb_verticesThe number of vertices.
verticesA pointer to the array of vertex coordinates.
Note
The vertices array must have a size of nb_vertices * 3.

Reimplemented from Delaunay.

◆ tet_adjacent()

int tet_adjacent ( unsigned int t,
unsigned int lf ) const
inline

Returns the index of the tetrahedron adjacent to the lf-th face of the t-th tetrahedron.

Parameters
tThe index of the tetrahedron.
lfThe local index of the face within the tetrahedron.
Returns
The index of the adjacent tetrahedron.

◆ tet_circumcenter()

vec3 tet_circumcenter ( unsigned int t) const
inline

Computes the circumcenter of the t-th tetrahedron.

Parameters
tThe index of the tetrahedron.
Returns
The circumcenter of the tetrahedron.

◆ tet_facet_vertex()

int tet_facet_vertex ( unsigned int t,
unsigned int lf,
unsigned int lv ) const
inline

Returns the index of the lv-th vertex in the lf-th face of the t-th tetrahedron.

Parameters
tThe index of the tetrahedron.
lfThe local index of the face within the tetrahedron.
lvThe local index of the vertex within the face.
Returns
The global index of the vertex.

◆ tet_to_tet()

const int * tet_to_tet ( ) const
inline

Returns the pointer to the tetrahedron-to-tetrahedron mapping.

Returns
A pointer to the array mapping tetrahedra to their adjacent tetrahedra.

◆ tet_to_v()

const int * tet_to_v ( ) const
inline

Returns the pointer to the tetrahedron-to-vertex mapping.

Returns
A pointer to the array mapping tetrahedra to their vertices.

◆ tet_vertex()

int tet_vertex ( unsigned int t,
unsigned int lv ) const
inline

Returns the index of the lv-th vertex in the t-th tetrahedron.

Parameters
tThe index of the tetrahedron.
lvThe local index of the vertex within the tetrahedron.
Returns
The global index of the vertex.

◆ vertex()

const vec3 & vertex ( unsigned int i) const
inline

Returns the coordinates of the vertex with index i.

Parameters
iThe index of the vertex.
Returns
The coordinates of the vertex.

◆ vertex_tet()

int vertex_tet ( int v) const
inline

Returns the index of a tetrahedron containing the vertex v.

Parameters
vThe index of the vertex.
Returns
The index of a tetrahedron containing the vertex.

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