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

Base class for Delaunay triangulation. More...

#include <easy3d/algo/delaunay.h>

Inheritance diagram for Delaunay:
Delaunay2 Delaunay3

Public Member Functions

 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.
 
virtual void set_vertices (unsigned int nb_vertices, const float *vertices)
 Sets the vertices for the triangulation.
 
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.
 
virtual unsigned int nearest_vertex (const float *p) const
 Finds the index of the nearest vertex to a given point.
 
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

Base class for Delaunay triangulation.

This class provides the base functionality for Delaunay triangulation in 2D and 3D. It manages vertices, cells, and their relationships, and provides methods for querying the triangulation structure.

See also
Delaunay2D, Delaunay3D

Constructor & Destructor Documentation

◆ Delaunay()

Delaunay ( unsigned int dimension)
explicit

Constructor.

Parameters
dimensionThe dimension of the triangulation, which must be either 2 or 3.

Member Function Documentation

◆ adjacent_index()

unsigned int adjacent_index ( unsigned int c1,
unsigned int c2 ) const
inline

Returns the local index of the face shared by cells c1 and c2.

Parameters
c1The index of the first cell.
c2The index of the second cell.
Returns
The local index of the shared face.

◆ cell_adjacent()

int cell_adjacent ( unsigned int c,
unsigned int lf ) const
inline

Returns the index of the cell adjacent to the lf-th face of the c-th cell.

Parameters
cThe index of the cell.
lfThe local index of the face within the cell.
Returns
The index of the adjacent cell.

◆ cell_size()

unsigned int cell_size ( ) const
inline

Returns the size of a cell.

Returns
The number of vertices per cell (3 for 2D, 4 for 3D).

◆ cell_to_cell()

const int * cell_to_cell ( ) const
inline

Returns a pointer to the cell-to-cell mapping.

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

◆ cell_to_v()

const int * cell_to_v ( ) const
inline

Returns a pointer to the cell-to-vertex mapping.

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

◆ cell_vertex()

int cell_vertex ( unsigned int c,
unsigned int lv ) const
inline

Returns the index of the lv-th vertex in the c-th cell.

Parameters
cThe index of the cell.
lvThe local index of the vertex within the cell.
Returns
The global index of the vertex.

◆ check_duplicate_vertices()

bool check_duplicate_vertices ( )

Checks for duplicate vertices in stored neighbor lists.

Returns
True if duplicate vertices are found, false otherwise.

◆ dimension()

unsigned int dimension ( ) const
inline

Returns the dimension of the triangulation.

Returns
The dimension (2 for 2D, 3 for 3D).

◆ get_neighbors()

void get_neighbors ( unsigned int v,
std::vector< unsigned int > & neighbors ) const
virtual

Retrieves the one-ring neighbors of vertex v.

Parameters
vThe index of the vertex.
neighborsA vector to store the indices of the neighboring vertices.

◆ index()

unsigned int index ( unsigned int c,
int v ) const
inline

Returns the local index of vertex v within cell c.

Parameters
cThe index of the cell.
vThe global index of the vertex.
Returns
The local index of the vertex within the cell.

◆ nb_cells()

unsigned int nb_cells ( ) const
inline

Returns the number of cells.

Returns
The number of cells in the triangulation.

◆ nb_vertices()

unsigned int nb_vertices ( ) const
inline

Returns the number of vertices.

Returns
The number of vertices in the triangulation.

◆ nearest_vertex()

unsigned int nearest_vertex ( const float * p) const
virtual

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 in Delaunay2, and Delaunay3.

◆ next_around_vertex()

unsigned int next_around_vertex ( unsigned int c,
unsigned int lv ) const
inline

Returns the next cell around vertex lv in cell c.

Parameters
cThe index of the cell.
lvThe local index of the vertex within the cell.
Returns
The index of the next cell.

◆ set_vertices()

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

Sets the vertices for the triangulation.

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 * dimension().

Reimplemented in Delaunay2, and Delaunay3.

◆ vertex_cell()

int vertex_cell ( unsigned int v) const
inline

Returns the index of a cell containing the vertex v.

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

◆ vertex_ptr()

const float * vertex_ptr ( unsigned int i) const
inline

Returns a pointer to the vertex of index i.

Parameters
iThe index of the vertex.
Returns
A pointer to the coordinates of the vertex.

◆ vertices_ptr()

const float * vertices_ptr ( ) const
inline

Returns a pointer to the vertices array.

Returns
A pointer to the array of vertex coordinates.

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