|
EBGeometry
Compact, header-only C++ library for fast evaluation of signed distance functions
|
Signed distance function for a pure triangle mesh using SoA-grouped primitives in a compact (linearized) BVH. More...
#include <EBGeometry_MeshDistanceFunctions.hpp>


Public Types | |
| using | Mesh = EBGeometry::DCEL::MeshT< T, Meta > |
| Alias for DCEL mesh type. | |
| using | Tri = typename EBGeometry::Triangle< T, Meta > |
| Alias for DCEL face type. | |
| using | TriSoA = TriangleSoAT< T, W > |
| Alias for the SoA triangle group type. | |
| using | Root = typename EBGeometry::BVH::PackedBVH< T, TriSoA, K, StoragePolicy > |
| Alias for which BVH root node. | |
Public Member Functions | |
| TriMeshSDF ()=delete | |
| Default disallowed constructor. | |
| TriMeshSDF (const std::shared_ptr< Mesh > &a_mesh, const BVH::Build a_build, const size_t a_maxLeafGroups) noexcept | |
| Full constructor. Takes a DCEL mesh and creates the input triangles. Then creates the BVH. | |
| TriMeshSDF (const std::vector< std::shared_ptr< Tri > > &a_triangles, const BVH::Build a_build, const size_t a_maxLeafGroups) noexcept | |
| Full constructor. Takes the input triangles and creates the BVH. | |
| ~TriMeshSDF () override=default | |
| Destructor. | |
| TriMeshSDF (const TriMeshSDF &a_other)=default | |
| Copy constructor. | |
| TriMeshSDF & | operator= (const TriMeshSDF &a_other)=default |
| Copy assignment operator. | |
| TriMeshSDF (TriMeshSDF &&a_other) noexcept=default | |
| Move constructor. | |
| TriMeshSDF & | operator= (TriMeshSDF &&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 triangle mesh. | |
| virtual std::shared_ptr< Root > & | getRoot () noexcept |
| Get the PackedBVH storing SoA triangle groups. | |
| virtual const std::shared_ptr< Root > & | getRoot () const noexcept |
| Get the PackedBVH storing SoA triangle groups (const overload). | |
| EBGeometry::BoundingVolumes::AABBT< T > | computeBoundingVolume () const noexcept |
| Compute the AABB enclosing the entire triangle 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. | |
Static Protected Member Functions | |
| static std::vector< TriSoA > | groupTrianglesIntoSoA (const std::vector< std::shared_ptr< const Tri > > &a_triangles, uint32_t a_offset, uint32_t a_count) |
| Leaf-conversion callback for TreeBVH::packWith: groups a BVH leaf's triangles into SoA blocks of width W. | |
Protected Attributes | |
| std::shared_ptr< Root > | m_bvh |
| Bounding volume hierarchy storing SoA triangle groups. | |
Signed distance function for a pure triangle mesh using SoA-grouped primitives in a compact (linearized) BVH.
Triangles are packed into SoA groups of W triangles each (TriangleSoAT<T,W>), enabling SIMD evaluation of up to W signed distances simultaneously.
No default arguments: this is a low-level constructor, and callers who excavate down to it must consciously choose K and W. Use Parser::readIntoTriangleBVH for sensible ISA-tuned defaults (BVH::DefaultBranchingRatio<T>() for K, TriangleSoA::DefaultWidth<T>() for W).
| T | Floating-point precision type (float or double). |
| Meta | Triangle metadata type. |
| K | BVH branching factor (number of children per internal node). Must be >= 2. |
| W | SoA width: number of triangles per SIMD group. Must be > 0. |
| StoragePolicy | PackedBVH primitive storage policy (see BVH::SharedPtrStorage / BVH::ValueStorage). Defaults to BVH::ValueStorage<TriangleSoAT<T, W>>, storing each SoA group inline with no pointer indirection – unlike MeshSDF's faces, these groups are freshly constructed by groupTrianglesIntoSoA() during packing and shared with nothing else, so there is no aliasing benefit to give up. Note that instancing the same mesh multiple times (e.g. via Translate/Rotate/Scale or a CSG union) is unaffected either way: those wrappers hold a shared_ptr to the whole TriMeshSDF, so its packed data – however StoragePolicy stores it – is never duplicated per placement. See the user documentation for the full rationale. |
|
noexcept |
Full constructor. Takes a DCEL mesh and creates the input triangles. Then creates the BVH.
No default arguments: this is a low-level constructor, and callers who excavate down to it must consciously choose every parameter. Use Parser::readIntoTriangleBVH for sensible defaults.
| [in] | a_mesh | DCEL mesh. |
| [in] | a_build | BVH build strategy. SAH (binned Surface Area Heuristic) produces near-optimal traversal cost; TopDown (centroid median) is faster to build but yields deeper trees. |
| [in] | a_maxLeafGroups | Maximum number of full W-sized TriangleSoA groups per BVH leaf; the actual raw-triangle leaf-size bound used is a_maxLeafGroups * W. This bounds the pre-packing tree's leaf size, not the packed representation directly: each leaf's triangles become their own TriangleSoA group(s) during packing, with no batching across leaves, so a leaf smaller than W wastes some of its group's SIMD lanes on padding. It is an upper bound, not a target — the SAH/TopDown partitioner still splits down to tighter, more selective leaves wherever the geometry warrants it. Expressing this as a count of W-sized groups (rather than a raw triangle count) makes it impossible to accidentally pick a leaf size that isn't a multiple of W. Must be > 0. |
|
noexcept |
Full constructor. Takes the input triangles and creates the BVH.
| [in] | a_triangles | Input triangle soup. |
| [in] | a_build | BVH build strategy (see the mesh-based constructor for details). |
| [in] | a_maxLeafGroups | Maximum number of full W-sized TriangleSoA groups per BVH leaf (see the mesh-based constructor for the tree-quality/SIMD-occupancy trade-off). Must be > 0. |
|
default |
Copy constructor.
Explicitly defaulted for documentation purposes: TriMeshSDF's only member (m_bvh) is a 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 triangle mesh.
|
virtualnoexcept |
Get the PackedBVH storing SoA triangle groups (const overload).
|
virtualnoexcept |
Get the PackedBVH storing SoA triangle groups.
|
staticprotected |
Leaf-conversion callback for TreeBVH::packWith: groups a BVH leaf's triangles into SoA blocks of width W.
Shared by both constructors; stateless (captures nothing), so it is a static member rather than a per-constructor lambda.
| [in] | a_triangles | Leaf's triangle list. |
| [in] | a_offset | Index of the first triangle in this leaf to convert. |
| [in] | a_count | Number of triangles in this leaf to convert. |
|
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 triangle mesh.
| [in] | a_point | Query point. |
Implements EBGeometry::SignedDistanceFunction< T >.