|
EBGeometry
Compact, header-only C++ library for fast evaluation of signed distance functions
|
Signed distance function for a DCEL mesh. Stores the mesh in a PackedBVH for SIMD-accelerated traversal. Accepts any polygon, not just triangles. More...
#include <EBGeometry_MeshDistanceFunctions.hpp>


Public Types | |
| using | Face = typename EBGeometry::DCEL::FaceT< T, Meta > |
| Alias for DCEL face type. | |
| using | Mesh = typename EBGeometry::DCEL::MeshT< T, Meta > |
| Alias for DCEL mesh type. | |
| using | Root = EBGeometry::BVH::PackedBVH< T, Face, K > |
| Alias for the linearized BVH root. | |
| using | Node = typename Root::Node |
| Alias for a single linearized node. | |
Public Member Functions | |
| MeshSDF ()=delete | |
| Default disallowed constructor. | |
| MeshSDF (const std::shared_ptr< Mesh > &a_mesh, const BVH::Build a_build) | |
| Full constructor. Takes the input mesh and creates the BVH. | |
| ~MeshSDF () override=default | |
| Destructor. | |
| MeshSDF (const MeshSDF &a_other)=default | |
| Copy constructor. | |
| MeshSDF & | operator= (const MeshSDF &a_other)=default |
| Copy assignment operator. | |
| MeshSDF (MeshSDF &&a_other) noexcept=default | |
| Move constructor. | |
| MeshSDF & | operator= (MeshSDF &&a_other) noexcept=default |
| Move assignment operator. | |
| T | signedDistance (const Vec3T< T > &a_point) const noexcept override |
| Compute the signed distance from a_point to the mesh. | |
| virtual std::vector< std::pair< std::shared_ptr< const Face >, T > > | getClosestFaces (const Vec3T< T > &a_point, const bool a_sorted) const |
| Return faces within BVH-pruned candidate distance of a_point. | |
| virtual std::shared_ptr< Root > & | getRoot () noexcept |
| Get the PackedBVH enclosing the mesh. | |
| virtual const std::shared_ptr< Root > & | getRoot () const noexcept |
| Get the PackedBVH enclosing the mesh (const overload). | |
| EBGeometry::BoundingVolumes::AABBT< T > | computeBoundingVolume () const noexcept |
| Compute the AABB enclosing the entire mesh. | |
Public Member Functions inherited from EBGeometry::SignedDistanceFunction< T > | |
| SignedDistanceFunction ()=default | |
| Default constructor. | |
| ~SignedDistanceFunction () override=default | |
| Destructor. | |
| T | value (const Vec3T< T > &a_point) const noexcept final |
| Implementation of ImplicitFunction::value; delegates to signedDistance(). | |
| virtual Vec3T< T > | normal (const Vec3T< T > &a_point, const T &a_delta) const noexcept |
| Compute the outward normal using central finite differences. | |
Public Member Functions inherited from EBGeometry::ImplicitFunction< T > | |
| ImplicitFunction ()=default | |
| Default constructor. | |
| virtual | ~ImplicitFunction ()=default |
| Default destructor. | |
| T | operator() (const Vec3T< T > &a_point) const noexcept |
| Call operator — alternative signature for the value function. | |
| template<class BV > | |
| BV | approximateBoundingVolumeOctree (const Vec3T< T > &a_initialLowCorner, const Vec3T< T > &a_initialHighCorner, const unsigned int a_maxTreeDepth, const T &a_safety=0.0) const |
| Compute an approximation to the bounding volume for the implicit surface using octree subdivision. | |
Protected Attributes | |
| std::shared_ptr< Root > | m_bvh |
| Linearized BVH. | |
| std::shared_ptr< Mesh > | m_mesh |
| Source DCEL mesh. | |
Signed distance function for a DCEL mesh. Stores the mesh in a PackedBVH for SIMD-accelerated traversal. Accepts any polygon, not just triangles.
The mesh faces are packed into a flat-array PackedBVH. SIMD traversal is used when T and K match an available ISA path. Unlike TriMeshSDF, MeshSDF does not expose a PackedBVH StoragePolicy choice: its PackedBVH always uses BVH::SharedPtrStorage<Face>, sharing each packed face with the DCEL mesh's own face list rather than copying it. This is not just a default – DCEL::FaceT's copy constructor deliberately does not copy its cached 2D polygon embedding (m_poly2, used by signedDistance()'s point-in-face test), so a naive by-value copy (as BVH::ValueStorage would produce) is left with a null embedding and crashes on first query; see FaceT's copy-constructor documentation. See the user documentation for the full rationale, including why TriMeshSDF's SoA groups do not have this restriction.
| EBGeometry::MeshSDF< T, Meta, K >::MeshSDF | ( | const std::shared_ptr< Mesh > & | a_mesh, |
| const BVH::Build | a_build | ||
| ) |
Full constructor. Takes the input mesh and creates the BVH.
No default arguments: this is a low-level constructor, and callers working at this level must consciously choose a build strategy. Use Parser::readIntoPackedBVH for sensible defaults.
| [in] | a_mesh | Input mesh. |
| [in] | a_build | BVH build strategy. SAH (binned Surface Area Heuristic) is recommended. |
|
default |
Copy constructor.
Explicitly defaulted for documentation purposes: MeshSDF's members (m_bvh, m_mesh) are both shared_ptr, so the implicitly-generated copy is a cheap, correct handle-copy.
| [in] | a_other | Other instance to copy. |
|
defaultnoexcept |
Move constructor.
Explicitly defaulted: the user-declared destructor above would otherwise suppress the implicitly-generated move constructor.
| [in,out] | a_other | Other instance to move from. |
|
noexcept |
Compute the AABB enclosing the entire mesh.
|
virtual |
Return faces within BVH-pruned candidate distance of a_point.
Traverses the PackedBVH and collects candidate faces. The result pairs each face with its unsigned distance to a_point.
| [in] | a_point | Query point. |
| [in] | a_sorted | If true, the returned vector is sorted by ascending unsigned distance (closest face first). |
|
virtualnoexcept |
Get the PackedBVH enclosing the mesh (const overload).
|
virtualnoexcept |
Get the PackedBVH enclosing the mesh.
|
default |
Copy assignment operator.
| [in] | a_other | Other instance to copy. |
|
defaultnoexcept |
Move assignment operator.
| [in,out] | a_other | Other instance to move from. |
|
overridevirtualnoexcept |
Compute the signed distance from a_point to the mesh.
| [in] | a_point | Query point. |
Implements EBGeometry::SignedDistanceFunction< T >.
|
protected |
Source DCEL mesh.
Retained so that the faces held by m_bvh – whose half-edges (and the edges/vertices reachable from them) are only weakly referenced, not owned, see DCEL::FaceT::m_halfEdge – stay valid. The mesh's own vertex/edge/face vectors are the sole owners of that topology.