PhysicsBasedAnimationToolkit 0.0.10
Cross-platform C++20 library of algorithms and data structures commonly used in computer graphics research on physically-based simulation.
Loading...
Searching...
No Matches
pbat::geometry::TetrahedralAabbHierarchy Class Reference

Tetrahedral AABB hierarchy class. More...

#include <TetrahedralAabbHierarchy.h>

Inheritance diagram for pbat::geometry::TetrahedralAabbHierarchy:
pbat::geometry::BoundingVolumeHierarchy< TetrahedralAabbHierarchy, AxisAlignedBoundingBox< 3 >, IndexVector< 4 >, 3 >

Public Types

using SelfType = TetrahedralAabbHierarchy
 Type of this class.
 
using BaseType
 Base type.
 
- Public Types inherited from pbat::geometry::BoundingVolumeHierarchy< TetrahedralAabbHierarchy, AxisAlignedBoundingBox< 3 >, IndexVector< 4 >, 3 >
using DerivedType
 Actual type.
 
using BoundingVolumeType
 Type of bounding volumes.
 
using PrimitiveType
 Type of primitives.
 

Public Member Functions

PBAT_API TetrahedralAabbHierarchy (Eigen::Ref< MatrixX const > const &V, Eigen::Ref< IndexMatrixX const > const &C, Index maxPointsInLeaf=10)
 Construct a TetrahedralAabbHierarchy from a tetrahedral mesh (V,C)
 
PBAT_API PrimitiveType Primitive (Index p) const
 Returns the primitive at index p.
 
PBAT_API Vector< kDimsPrimitiveLocation (PrimitiveType const &primitive) const
 Returns the location of the primitive.
 
template<class RPrimitiveIndices>
BoundingVolumeType BoundingVolumeOf (RPrimitiveIndices &&pinds) const
 Returns the bounding volume of the primitive.
 
PBAT_API void Update ()
 Updates the AABBs.
 
PBAT_API IndexMatrixX OverlappingPrimitives (TetrahedralAabbHierarchy const &bvh, std::size_t reserve=1000ULL) const
 Returns the overlapping primitives of this BVH and another BVH.
 
template<class TDerivedP, class FCull>
IndexVectorX PrimitivesContainingPoints (Eigen::MatrixBase< TDerivedP > const &P, FCull fCull, bool bParallelize=true) const
 For each point in P, returns the index of the primitive containing it.
 
template<class TDerivedP>
IndexVectorX PrimitivesContainingPoints (Eigen::MatrixBase< TDerivedP > const &P, bool bParallelize=true) const
 For each point in P, returns the index of the primitive containing it.
 
template<class TDerivedP>
auto NearestPrimitivesToPoints (Eigen::MatrixBase< TDerivedP > const &P, bool bParallelize=true) const -> std::pair< IndexVectorX, VectorX >
 For each point in P, returns the index of the nearest primitive to it.
 
auto const & GetBoundingVolumes () const
 Returns this BVH's bounding volumes.
 
template<class TDerivedP>
void SetV (Eigen::MatrixBase< TDerivedP > const &P)
 Updates this BVH's mesh's vertex positions.
 
auto GetV () const
 Returns this BVH's mesh's vertex positions.
 
auto GetC () const
 Returns this BVH's mesh's cell indices.
 
- Public Member Functions inherited from pbat::geometry::BoundingVolumeHierarchy< TetrahedralAabbHierarchy, AxisAlignedBoundingBox< 3 >, IndexVector< 4 >, 3 >
void Construct (Index nPrimitives, Index maxPointsInLeaf=10)
 Construct the BVH from a set of primitives.
 
auto BoundingVolumes () const -> std::vector< BoundingVolumeType > const &
 Returns the bounding volumes of this BVH.
 
auto PrimitivesInBoundingVolume (Index bvIdx) const
 Returns the indices of the primitives contained in the bounding volume bvIdx.
 
std::vector< IndexPrimitivesIntersecting (FIntersectsBoundingVolume &&ibv, FIntersectsPrimitive &&ip, std::size_t reserve=50ULL) const
 Returns the indices of the primitives intersecting the bounding volume bv.
 
auto NearestPrimitivesTo (FDistanceToBoundingVolume &&db, FDistanceToPrimitive &&dp, std::size_t K) const -> std::pair< std::vector< Index >, std::vector< Scalar > >
 Obtains the k nearest neighbours (primitives of this BVH)
 
void Update ()
 Update the bounding volumes of this BVH.
 
PrimitiveType Primitive (Index p) const
 Returns the primitive at index p.
 
auto PrimitiveLocation (PrimitiveType const &primitive) const
 Returns the location of the primitive.
 
BoundingVolumeType BoundingVolumeOf (RPrimitiveIndices &&primitiveIndexRange) const
 Returns the bounding volume of the primitives in the range [first, last)
 

Public Attributes

Eigen::Ref< MatrixX const > V
 |kDims|x|# verts| vertex positions
 
Eigen::Ref< IndexMatrixX const > C
 4x|# tetrahedra| cell indices into V
 

Static Public Attributes

static auto constexpr kDims = 3
 Dimension of the space.
 
- Static Public Attributes inherited from pbat::geometry::BoundingVolumeHierarchy< TetrahedralAabbHierarchy, AxisAlignedBoundingBox< 3 >, IndexVector< 4 >, 3 >
static auto constexpr kDims
 Embedding dimensionality.
 

Additional Inherited Members

- Protected Member Functions inherited from pbat::geometry::BoundingVolumeHierarchy< TetrahedralAabbHierarchy, AxisAlignedBoundingBox< 3 >, IndexVector< 4 >, 3 >
IndexMatrixX OverlappingPrimitivesImpl (BoundingVolumeHierarchy< TDerived2, TBoundingVolume2, TPrimitive2, Dims2 > const &other, FBoundingVolumesOverlap &&bvo, FPrimitivesOverlap &&po, FPrimitivesAreAdjacent &&PrimitivesAreAdjacent=[](PrimitiveType const &p1, TPrimitive2 const &p2) -> bool { return false;}, std::size_t reserve=50ULL) const
 Returns the indices of the primitives overlapping between this BVH and another BVH.
 
- Protected Attributes inherited from pbat::geometry::BoundingVolumeHierarchy< TetrahedralAabbHierarchy, AxisAlignedBoundingBox< 3 >, IndexVector< 4 >, 3 >
std::vector< BoundingVolumeTypemBoundingVolumes
 Bounding volumes of the BVH.
 
KdTree< kDimsmKdTree
 K-d tree used to store the primitives and the BVH tree.
 

Detailed Description

Tetrahedral AABB hierarchy class.

Member Typedef Documentation

◆ BaseType

Initial value:
BoundingVolumeHierarchy<
Axis-aligned bounding box class.
Definition AxisAlignedBoundingBox.h:29
TetrahedralAabbHierarchy SelfType
Type of this class.
Definition TetrahedralAabbHierarchy.h:41
static auto constexpr kDims
Dimension of the space.
Definition TetrahedralAabbHierarchy.h:40
Eigen::Vector< Index, N > IndexVector
Fixed-size index vector type.
Definition Aliases.h:40

Base type.

Constructor & Destructor Documentation

◆ TetrahedralAabbHierarchy()

pbat::geometry::TetrahedralAabbHierarchy::TetrahedralAabbHierarchy ( Eigen::Ref< MatrixX const > const & V,
Eigen::Ref< IndexMatrixX const > const & C,
Index maxPointsInLeaf = 10 )

Construct a TetrahedralAabbHierarchy from a tetrahedral mesh (V,C)

Parameters
V|kDims|x|# verts| vertex positions
C4x|# tetrahedra| cell vertex indices into V
maxPointsInLeafMaximum number of simplices in a leaf node

Member Function Documentation

◆ BoundingVolumeOf()

template<class RPrimitiveIndices>
TetrahedralAabbHierarchy::BoundingVolumeType pbat::geometry::TetrahedralAabbHierarchy::BoundingVolumeOf ( RPrimitiveIndices && pinds) const
inline

Returns the bounding volume of the primitive.

Template Parameters
RPrimitiveIndicesIndex range type
Parameters
pindsRange of primitive indices
Returns
The bounding volume of the primitives pinds

◆ GetBoundingVolumes()

auto const & pbat::geometry::TetrahedralAabbHierarchy::GetBoundingVolumes ( ) const
inline

Returns this BVH's bounding volumes.

Returns
This BVH's bounding volumes

◆ GetC()

auto pbat::geometry::TetrahedralAabbHierarchy::GetC ( ) const
inline

Returns this BVH's mesh's cell indices.

Returns
This BVH's mesh's cell indices

◆ GetV()

auto pbat::geometry::TetrahedralAabbHierarchy::GetV ( ) const
inline

Returns this BVH's mesh's vertex positions.

Returns
This BVH's mesh's vertex positions

◆ NearestPrimitivesToPoints()

template<class TDerivedP>
auto pbat::geometry::TetrahedralAabbHierarchy::NearestPrimitivesToPoints ( Eigen::MatrixBase< TDerivedP > const & P,
bool bParallelize = true ) const -> std::pair<IndexVectorX, VectorX>
inline

For each point in P, returns the index of the nearest primitive to it.

Template Parameters
TDerivedPEigen matrix type
Parameters
P|kDims|x|# points| matrix of points
bParallelizeWhether to parallelize the computation
Returns
|# points| vector of nearest primitive indices to the points

◆ OverlappingPrimitives()

IndexMatrixX pbat::geometry::TetrahedralAabbHierarchy::OverlappingPrimitives ( TetrahedralAabbHierarchy const & bvh,
std::size_t reserve = 1000ULL ) const

Returns the overlapping primitives of this BVH and another BVH.

Parameters
bvhThe other BVH
reserveEstimated number of overlapping primitives to reserve memory for
Returns
2x|# overlaps| matrix O of overlapping primitive pairs s.t. primitives O(0,o) in this bvh, and O(1,o) in the other bvh overlap.

◆ Primitive()

TetrahedralAabbHierarchy::PrimitiveType pbat::geometry::TetrahedralAabbHierarchy::Primitive ( Index p) const

Returns the primitive at index p.

Parameters
pIndex of the primitive
Returns
The primitive at index p

◆ PrimitiveLocation()

Vector< TetrahedralAabbHierarchy::kDims > pbat::geometry::TetrahedralAabbHierarchy::PrimitiveLocation ( PrimitiveType const & primitive) const

Returns the location of the primitive.

Parameters
primitiveThe primitive
Returns
The location of the primitive

◆ PrimitivesContainingPoints() [1/2]

template<class TDerivedP>
IndexVectorX pbat::geometry::TetrahedralAabbHierarchy::PrimitivesContainingPoints ( Eigen::MatrixBase< TDerivedP > const & P,
bool bParallelize = true ) const
inline

For each point in P, returns the index of the primitive containing it.

Template Parameters
TDerivedPEigen matrix type
Parameters
P|kDims|x|# points| matrix of points
bParallelizeWhether to parallelize the computation
Returns
|# points| vector of primitive indices containing the points

◆ PrimitivesContainingPoints() [2/2]

template<class TDerivedP, class FCull>
IndexVectorX pbat::geometry::TetrahedralAabbHierarchy::PrimitivesContainingPoints ( Eigen::MatrixBase< TDerivedP > const & P,
FCull fCull,
bool bParallelize = true ) const
inline

For each point in P, returns the index of the primitive containing it.

Template Parameters
TDerivedPEigen matrix type
FCullCulling function type
Parameters
P|kDims|x|# points| matrix of points
fCullCulling function
bParallelizeWhether to parallelize the computation
Returns
|# points| vector of primitive indices containing the points

◆ SetV()

template<class TDerivedP>
void pbat::geometry::TetrahedralAabbHierarchy::SetV ( Eigen::MatrixBase< TDerivedP > const & P)
inline

Updates this BVH's mesh's vertex positions.

Template Parameters
TDerivedPEigen matrix type
Parameters
P|kDims|x|# verts| matrix of vertex positions

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