EBGeometry 1.0
|
Mesh class. More...
#include <EBGeometry_DCEL_Mesh.hpp>
Public Types | |
enum class | SearchAlgorithm { Direct , Direct2 } |
Possible search algorithms for DCEL::MeshT. More... | |
enum class | VertexNormalWeight { None , Angle } |
How to weight vertex normal. | |
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 constructor. Leaves unobject in an unusable state. | |
MeshT (const Mesh &a_otherMesh)=delete | |
Disallowed copy construction. | |
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. | |
virtual | ~MeshT () noexcept |
Destructor (does nothing) | |
void | define (std::vector< FacePtr > &a_faces, std::vector< EdgePtr > &a_edges, std::vector< VertexPtr > &a_vertices) noexcept |
Define function. Puts Mesh in usable state. | |
void | sanityCheck () const noexcept |
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 | flipFaces () noexcept |
Flip all face normals. | |
void | flipEdges () noexcept |
Flip all edge normals. | |
void | flipVertices () noexcept |
Flip all vertex normal. | |
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 noexcept |
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 noexcept |
Print all warnings to std::cerr. | |
Protected Attributes | |
SearchAlgorithm | m_algorithm |
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. | |
Mesh class.
Mesh class which stores a full DCEL mesh (with signed distance functions)
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.
Possible search algorithms for DCEL::MeshT.
Direct means compute the signed distance for all primitives, Direct2 means compute the squared signed distance for all primitives.
Disallowed copy construction.
[in] | a_otherMesh | Other mesh |
|
noexcept |
Full constructor. This provides the faces, edges, and vertices to the mesh.
Calls define(a_faces, a_edges, a_vertices)
[in] | a_faces | Polygon faces |
[in] | a_edges | Half-edges |
[in] | a_vertices | Vertices |
|
inlinenoexcept |
Define function. Puts Mesh in usable state.
[in] | a_faces | Polygon faces |
[in] | a_edges | Half-edges |
[in] | a_vertices | Vertices |
|
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.
|
inlineprotectednoexcept |
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 |
|
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 |
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.
|
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 |
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.
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.