ReactPhysics3D  v0.10.1
C++ Physics engine library
reactphysics3d::QHHalfEdgeStructure Class Reference

This class describes a polyhedron mesh made of faces and vertices. More...

#include <include/reactphysics3d/utils/quickhull/QHHalfEdgeStructure.h>

Classes

struct  Edge
 An half-edge. More...
 
struct  Face
 A face. More...
 
struct  Vertex
 A vertex. More...
 

Public Types

using VerticesPair = Pair< uint32, uint32 >
 
using EdgeVertices = Pair< const Vertex *, const Vertex * >
 

Public Member Functions

 QHHalfEdgeStructure (MemoryAllocator &allocator)
 Constructor.
 
 ~QHHalfEdgeStructure ()
 Destructor.
 
VertexaddVertex (uint32 externalIndex)
 Add a vertex. More...
 
FaceaddFace (const Array< Vertex * > &faceVertices, const Array< Vector3 > &points, MemoryAllocator &allocator)
 Add a face. More...
 
void removeFace (Face *face)
 Remove a face.
 
void deleteFace (Face *face)
 Delete the face.
 
void removeHalfEdge (Edge *edge)
 Remove an half-edge.
 
void removeVertex (Vertex *vertex)
 Remove a vertex.
 
uint32 getNbFaces () const
 Return the number of faces. More...
 
uint32 getNbHalfEdges () const
 Return the number of half-edges. More...
 
uint32 getNbVertices () const
 Return the number of vertices. More...
 
const FacegetFaces () const
 Return a pointer to the first face in the linked-list of faces.
 
const EdgegetHalfEdges () const
 Return a pointer to the first half-edge in the linked-list of half-edges.
 
const VertexgetVertices () const
 Return a pointer to the first vertex in the linked-list of vertices.
 
bool isValid () const
 Return true if the half-edge structure is valid (for debugging purpose)
 
std::string to_string () const
 Return a string representation of the half-edge structure.
 

Detailed Description

This class describes a polyhedron mesh made of faces and vertices.

The faces do not have to be triangles. Note that in the linked-list of half-edges an edge must always follow its twin edge. This way, on closed mesh, we can always iterate every two half-edges to find the unique edges. This class is only used for QuickHull algorithm.

Member Function Documentation

◆ addFace()

QHHalfEdgeStructure::Face * QHHalfEdgeStructure::addFace ( const Array< Vertex * > &  faceVertices,
const Array< Vector3 > &  points,
MemoryAllocator allocator 
)

Add a face.

Parameters
faceVerticesArray of the vertices in a face (ordered in CCW order as seen from outside the polyhedron). The indices are the internal indices of the vertices inside the HalfEdgeStructure.
pointsArray with the points (coordinates) of the face vertices
allocatorReference to a memory allocator
Returns
A Pointer to the new face

◆ addVertex()

QHHalfEdgeStructure::Vertex * QHHalfEdgeStructure::addVertex ( uint32  externalIndex)

Add a vertex.

Parameters
externalIndexIndex of the vertex in the external user vertex data array
Returns
A pointer to the new vertex

◆ getNbFaces()

RP3D_FORCE_INLINE uint32 reactphysics3d::QHHalfEdgeStructure::getNbFaces ( ) const

Return the number of faces.

Returns
The number of faces in the polyhedron

◆ getNbHalfEdges()

RP3D_FORCE_INLINE uint32 reactphysics3d::QHHalfEdgeStructure::getNbHalfEdges ( ) const

Return the number of half-edges.

Returns
The number of edges in the polyhedron

◆ getNbVertices()

RP3D_FORCE_INLINE uint32 reactphysics3d::QHHalfEdgeStructure::getNbVertices ( ) const

Return the number of vertices.

Returns
The number of vertices in the polyhedron

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