|
EBGeometry
Compact, header-only C++ library for fast evaluation of signed distance functions
|
DCEL mesh class - stores a doubly-connected edge mesh. More...
#include <EBGeometry_DCEL_Mesh.hpp>

Public Types | |
| enum class | SearchAlgorithm { Direct , Direct2 } |
| Possible search algorithms for DCEL::MeshT. More... | |
| using | Vec3 = Vec3T< T > |
| Alias for vector type. | |
| using | Vertex = VertexT< T, Meta > |
| Alias for vertex type. | |
| using | Edge = EdgeT< T, Meta > |
| Alias for edge type. | |
| using | Face = FaceT< T, Meta > |
| Alias for face type. | |
| using | Mesh = MeshT< T, Meta > |
| Alias for mesh type. | |
| using | VertexPtr = std::shared_ptr< Vertex > |
| Alias for vertex pointer type. | |
| using | EdgePtr = std::shared_ptr< Edge > |
| Alias for edge pointer type. | |
| using | FacePtr = std::shared_ptr< Face > |
| Alias for face pointer type. | |
Public Member Functions | |
| MeshT () noexcept=default | |
| Default constructor. | |
| MeshT (const Mesh &a_otherMesh)=delete | |
| Disallowed copy construction. | |
| MeshT (Mesh &&a_otherMesh) noexcept=default | |
| Move constructor. | |
| MeshT (std::vector< FacePtr > &a_faces, std::vector< EdgePtr > &a_edges, std::vector< VertexPtr > &a_vertices) noexcept | |
| Full constructor. This provides the faces, edges, and vertices to the mesh. | |
| ~MeshT () noexcept=default | |
| Destructor (does nothing) | |
| Mesh & | operator= (const Mesh &a_otherMesh)=delete |
| Disallowed copy assignment. | |
| Mesh & | operator= (Mesh &&a_otherMesh) noexcept=default |
| Move assignment operator. | |
| std::shared_ptr< Mesh > | deepCopy () const |
| Create an independent, fully-decoupled copy of this mesh. | |
| void | sanityCheck (const std::string a_id) const |
| Perform a sanity check. | |
| void | setSearchAlgorithm (const SearchAlgorithm a_algorithm) noexcept |
| Search algorithm for direct signed distance computations. | |
| void | setInsideOutsideAlgorithm (typename Polygon2D< T >::InsideOutsideAlgorithm a_algorithm) noexcept |
| Set the inside/outside algorithm to use when computing the signed distance to polygon faces. | |
| void | reconcile (const DCEL::VertexNormalWeight a_weight=DCEL::VertexNormalWeight::Angle) noexcept |
| Reconcile function which computes the internal parameters in vertices, edges, and faces for use with signed distance functionality. | |
| void | flip () noexcept |
| Flip the mesh, making all the normals change direction. | |
| std::vector< VertexPtr > & | getVertices () noexcept |
| Get modifiable vertices in this mesh. | |
| const std::vector< VertexPtr > & | getVertices () const noexcept |
| Get immutable vertices in this mesh. | |
| std::vector< Vec3T< T > > | getAllVertexCoordinates () const noexcept |
| Return all vertex coordinates in the mesh. | |
| std::vector< EdgePtr > & | getEdges () noexcept |
| Get modifiable half-edges in this mesh. | |
| const std::vector< EdgePtr > & | getEdges () const noexcept |
| Get immutable half-edges in this mesh. | |
| std::vector< FacePtr > & | getFaces () noexcept |
| Get modifiable faces in this mesh. | |
| const std::vector< FacePtr > & | getFaces () const noexcept |
| Get immutable faces in this mesh. | |
| T | signedDistance (const Vec3 &a_x0) const noexcept |
| Compute the signed distance from a point to this mesh. | |
| T | signedDistance (const Vec3 &a_x0, SearchAlgorithm a_algorithm) const noexcept |
| Compute the signed distance from a point to this mesh. | |
| T | unsignedDistance2 (const Vec3 &a_x0) const noexcept |
| Compute the unsigned square distance from a point to this mesh. | |
Protected Member Functions | |
| void | reconcileFaces () noexcept |
| Function which computes internal things for the polygon faces. | |
| void | reconcileEdges () noexcept |
| Function which computes internal things for the half-edges. | |
| void | reconcileVertices (const DCEL::VertexNormalWeight a_weight) noexcept |
| Function which computes internal things for the vertices. | |
| void | flipFaceNormals () noexcept |
| Flip all face normals. | |
| void | flipEdgeNormals () noexcept |
| Flip all edge normals. | |
| void | flipVertexNormals () noexcept |
| Flip all vertex normals. | |
| T | DirectSignedDistance (const Vec3 &a_point) const noexcept |
| Implementation of signed distance function which iterates through all faces. | |
| T | DirectSignedDistance2 (const Vec3 &a_point) const noexcept |
| Implementation of squared signed distance function which iterates through all faces. | |
| void | incrementWarning (std::map< std::string, size_t > &a_warnings, const std::string &a_warn) const |
| Increment a warning. This is used in sanityCheck() for locating holes or bad inputs in the mesh. | |
| void | printWarnings (const std::map< std::string, size_t > &a_warnings, const std::string &a_id) const |
| Print all warnings to std::cerr. | |
Protected Attributes | |
| SearchAlgorithm | m_algorithm = SearchAlgorithm::Direct2 |
| Search algorithm. Only used in signed distance functions. | |
| std::vector< VertexPtr > | m_vertices |
| Mesh vertices. | |
| std::vector< EdgePtr > | m_edges |
| Mesh half-edges. | |
| std::vector< FacePtr > | m_faces |
| Mesh faces. | |
DCEL mesh class - stores a doubly-connected edge mesh.
Mesh class which stores a full DCEL mesh (with signed distance functions)
| T | Floating-point precision type. |
| Meta | User-defined metadata type. |
This encapsulates a full DCEL mesh, and also includes DIRECT signed distance functions. The mesh consists of a set of vertices, half-edges, and polygon faces who each have references to other vertices, half-edges, and polygon faces. The signed distance functions DIRECT, which means that they go through ALL of the polygon faces and compute the signed distance to them. This is extremely inefficient, which is why this class is almost always embedded into a bounding volume hierarchy.
| T | Floating-point precision type. |
| Meta | User-defined metadata type. |
Possible search algorithms for DCEL::MeshT.
| Enumerator | |
|---|---|
| Direct | Computes the signed distance to every face and returns the one with the smallest magnitude. See DirectSignedDistance(). |
| Direct2 | Computes the squared unsigned distance to every face to find the closest one, then returns the signed distance to only that face. Equivalent to Direct but usually faster since it avoids a square root per face. See DirectSignedDistance2(). |
|
defaultnoexcept |
Default constructor.
Leaves the mesh empty (no vertices, edges, or faces) with the default search algorithm; use define() or the mutable getVertices()/getEdges()/getFaces() to populate it.
|
delete |
Disallowed copy construction.
Copying is deliberately disallowed: a shallow copy of m_vertices/m_edges/m_faces would share the same underlying vertex/edge/face objects as the original (they reference each other internally), so it would not behave like an independent mesh – mutating the "copy" would also mutate the original. Use a file parser to build an independent mesh instead. Moving is allowed (see the move constructor), since that transfers ownership rather than aliasing it.
| [in] | a_otherMesh | Other mesh. |
|
defaultnoexcept |
Move constructor.
| [in,out] | a_otherMesh | Other mesh. |
|
noexcept |
Full constructor. This provides the faces, edges, and vertices to the mesh.
Copies the three vectors directly into m_faces/m_edges/m_vertices. This only associates pointer structures through the mesh; internal parameters like face area and normal are computed by reconcile().
| [in] | a_faces | Polygon faces |
| [in] | a_edges | Half-edges |
| [in] | a_vertices | Vertices |
|
inline |
Create an independent, fully-decoupled copy of this mesh.
Since copy construction/assignment are disallowed (see their documentation), this is the supported way to duplicate a mesh. Unlike a shallow copy, this creates brand new VertexT/EdgeT/FaceT objects and relinks all of their internal pointers (outgoing edge, pair edge, next edge, half edge, adjacent faces) so that the copy shares no vertex, edge, or face with the original – mutating one mesh does not affect the other. Every field is preserved exactly (position, normal vector, centroid, area, meta-data, search algorithm) rather than recomputed, so a mesh that has had flipNormal()/flip() called on it and not yet been re-reconciled will be copied faithfully rather than silently "un-flipped".
|
inlineprotectednoexcept |
Implementation of signed distance function which iterates through all faces.
| [in] | a_point | 3D point |
|
inlineprotectednoexcept |
Implementation of squared signed distance function which iterates through all faces.
This first find the face with the smallest unsigned square distance, and the returns the signed distance to that face (more efficient than the other version).
| [in] | a_point | 3D point |
Flip the mesh, making all the normals change direction.
|
inlinenoexcept |
Return all vertex coordinates in the mesh.
|
inlinenoexcept |
Get immutable half-edges in this mesh.
|
inlinenoexcept |
Get modifiable half-edges in this mesh.
|
inlinenoexcept |
Get immutable faces in this mesh.
|
inlinenoexcept |
Get modifiable faces in this mesh.
|
inlinenoexcept |
Get immutable vertices in this mesh.
|
inlinenoexcept |
Get modifiable vertices in this mesh.
|
inlineprotected |
Increment a warning. This is used in sanityCheck() for locating holes or bad inputs in the mesh.
| [in] | a_warnings | Map of all registered warnings |
| [in] | a_warn | Current warning to increment by |
|
delete |
Disallowed copy assignment.
Has the same rationale as the disallowed copy constructor; see its documentation.
| [in] | a_otherMesh | Other mesh. |
|
defaultnoexcept |
Move assignment operator.
| [in,out] | a_otherMesh | Other mesh. |
|
inlineprotected |
Print all warnings to std::cerr.
| [in] | a_warnings | List of warnings (generated by sanityCheck) |
| [in] | a_id | Identifier used when printing warnings (can be empty string) |
|
inlinenoexcept |
Reconcile function which computes the internal parameters in vertices, edges, and faces for use with signed distance functionality.
| [in] | a_weight | Vertex angle weighting function. Either VertexNormalWeight::None for unweighted vertex normals or VertexNormalWeight::Angle for the pseudonormal |
This will reconcile faces, edges, and vertices, e.g. computing the area and normal vector for faces
|
inlineprotectednoexcept |
Function which computes internal things for the half-edges.
|
inlineprotectednoexcept |
Function which computes internal things for the polygon faces.
|
inlineprotectednoexcept |
Function which computes internal things for the vertices.
| [in] | a_weight | Vertex angle weighting |
|
inline |
Perform a sanity check.
This will provide error messages if vertices are badly linked, faces are nullptr, and so on. These messages are logged by calling incrementWarning() which identifies types of errors that can occur, and how many of those errors have occurred.
| [in] | a_id | Identifier when printing error messages (can be empty string). |
|
inlinenoexcept |
Set the inside/outside algorithm to use when computing the signed distance to polygon faces.
Computing the signed distance to faces requires testing if a point projected to a polygo face plane falls inside or outside the polygon face. There are multiple algorithms to use here.
| [in] | a_algorithm | Algorithm to use |
|
inlinenoexcept |
Search algorithm for direct signed distance computations.
| [in] | a_algorithm | Algorithm to use |
|
inlinenoexcept |
Compute the signed distance from a point to this mesh.
| [in] | a_x0 | 3D point in space. |
This function will iterate through ALL faces in the mesh and return the value with the smallest magnitude. This is horrendously slow, which is why this function is almost never called. Rather, MeshT<T, Meta> can be embedded in a bounding volume hierarchy for faster access.
|
inlinenoexcept |
Compute the signed distance from a point to this mesh.
| [in] | a_x0 | 3D point in space. |
| [in] | a_algorithm | Search algorithm |
This function will iterate through ALL faces in the mesh and return the value with the smallest magnitude. This is horrendously slow, which is why this function is almost never called. Rather, MeshT<T, Meta> can be embedded in a bounding volume hierarchy for faster access.
|
inlinenoexcept |
Compute the unsigned square distance from a point to this mesh.
| [in] | a_x0 | 3D point in space. |
This function will iterate through ALL faces in the mesh and return the value with the smallest magnitude. This is horrendously slow, which is why this function is almost never called. Rather, MeshT<T, Meta> can be embedded in a bounding volume hierarchy for faster access.