PhysicsBasedAnimationToolkit 0.0.10
Cross-platform C++20 library of algorithms and data structures commonly used in computer graphics research on physically-based simulation.
|
Discrete contact detection system for vertex-tetrahedron contacts between multiple tetrahedral meshes. More...
#include <MeshVertexTetrahedronDcd.h>
Public Types | |
using | ScalarType = Scalar |
Scalar type used in the contact detection system. | |
using | IndexType = Index |
Index type used in the contact detection system. | |
Public Member Functions | |
PBAT_API | MeshVertexTetrahedronDcd (Eigen::Ref< Eigen::Matrix< ScalarType, kDims, Eigen::Dynamic > > X, Eigen::Ref< Eigen::Matrix< IndexType, 4, Eigen::Dynamic > > T) |
Construct a new MeshVertexTetrahedronDcd object from input tetrahedron meshes. | |
PBAT_API void | UpdateActiveSet (Eigen::Ref< Eigen::Matrix< ScalarType, kDims, Eigen::Dynamic > const > const &X, Eigen::Ref< Eigen::Matrix< IndexType, 4, Eigen::Dynamic > const > const &T) |
Update the active set of vertex-triangle contacts. | |
template<class FOnVertexTriangleContactPair> | |
void | ForEachActiveVertexTriangleContact (IndexType v, FOnVertexTriangleContactPair fOnVertexTriangleContactPair) const |
Visit the triangles in active vertex-triangle contacts. | |
PBAT_API MultibodyTetrahedralMeshSystem< IndexType > const & | MultibodySystem () const |
Get the multibody tetrahedral mesh system. | |
Static Public Attributes | |
static constexpr int | kMaxVertexTriangleContacts |
Maximum number of contacting triangles per vertex. | |
static constexpr int | kDims = 3 |
Number of dimensions in the contact detection system. | |
Protected Member Functions | |
template<class TDerivedX> | |
void | ComputeTriangleAabbs (Eigen::DenseBase< TDerivedX > const &X) |
Compute axis-aligned bounding boxes for triangles for DCD. | |
template<class TDerivedX, class TDerivedT> | |
void | ComputeTetrahedronMeshAabbs (IndexType o, Eigen::DenseBase< TDerivedX > const &X, Eigen::DenseBase< TDerivedT > const &T) |
Computes AABBs for tetrahedra from mesh vertex positions. | |
PBAT_API void | ComputeBodyAabbs () |
Computes body AABBs from mesh vertex BVHs. | |
PBAT_API void | UpdateMeshTriangleBvhs () |
Recompute mesh triangle BVH bounding boxes. | |
PBAT_API void | UpdateMeshTetrahedronHashGrid (IndexType bodyIndex) |
Recompute mesh tetrahedron hash grid for a specific body. | |
PBAT_API void | RecomputeBodiesBvh () |
Recompute bodies BVH tree and internal node bounding boxes. | |
template<class FOnBodyPair> | |
void | ForEachBodyPair (FOnBodyPair &&fOnBodyPair) const |
Compute and visit all contacting body pairs. | |
template<class TDerivedX, class TDerivedT> | |
void | MarkPenetratingVertices (IndexType ov, IndexType ot, Eigen::DenseBase< TDerivedX > const &X, Eigen::DenseBase< TDerivedT > const &T) |
Register all collision vertices of body ov that penetrate into body ot | |
template<class TDerivedX> | |
void | FindNearestTrianglesToPenetratingVertices (IndexType ov, IndexType of, Eigen::DenseBase< TDerivedX > const &X) |
Find the nearest triangles on the triangle mesh of to penetrating vertices of body ov | |
Discrete contact detection system for vertex-tetrahedron contacts between multiple tetrahedral meshes.
Uses an AABB tree hierarchy for the mesh vertices and an AABB tree hierarchy for the mesh triangles, as well as a spatial hash grid for the tetrahedra.
For each vertex, stores up to kMaxVertexTriangleContacts
contacting triangles.
pbat::sim::contact::MeshVertexTetrahedronDcd::MeshVertexTetrahedronDcd | ( | Eigen::Ref< Eigen::Matrix< ScalarType, kDims, Eigen::Dynamic > > | X, |
Eigen::Ref< Eigen::Matrix< IndexType, 4, Eigen::Dynamic > > | T ) |
Construct a new MeshVertexTetrahedronDcd object from input tetrahedron meshes.
TDerivedX | Eigen type of the input vertex positions |
X | kDims x |# vertices| matrix of vertex positions |
T | 4 x |# tetrahedra| tetrahedron array |
|
protected |
Computes body AABBs from mesh vertex BVHs.
UpdateMeshVertexBvhs
|
inlineprotected |
Computes AABBs for tetrahedra from mesh vertex positions.
TDerivedX | Eigen type of vertex positions |
TDerivedT | Eigen type of tetrahedron mesh elements/connectivity |
o | Index of the body to compute tetrahedron AABBs for |
X | kDims x |# vertices| matrix of vertex positions |
T | 4 x |# tetrahedra| tetrahedron mesh elements/connectivity |
|
inlineprotected |
Compute axis-aligned bounding boxes for triangles for DCD.
TDerivedX | Eigen type of vertex positions |
X | kDims x |# vertices| matrix of vertex positions |
|
inlineprotected |
Find the nearest triangles on the triangle mesh of
to penetrating vertices of body ov
TDerivedX | Eigen type of vertex positions |
|
inline |
Visit the triangles in active vertex-triangle contacts.
FOnVertexTriangleContactPair | Callable type with signature void(
IndexType f, IndexType k) where f is the index of the triangle and 0 <= k < kMaxVertexTriangleContacts is the index of the contact |
v | Index of the vertex whose active triangle contacts to visit |
fOnVertexTriangleContactPair | Function to call for each vertex-triangle contact pair |
|
inlineprotected |
Compute and visit all contacting body pairs.
FOnBodyPair | Callable type with signature void(IndexType oi, IndexType oj) |
fOnBodyPair | Function to call for each body pair |
|
inlineprotected |
Register all collision vertices of body ov
that penetrate into body ot
TDerivedX | Eigen type of vertex positions |
TDerivedT | Eigen type of tetrahedron mesh elements/connectivity |
void pbat::sim::contact::MeshVertexTetrahedronDcd::UpdateActiveSet | ( | Eigen::Ref< Eigen::Matrix< ScalarType, kDims, Eigen::Dynamic > const > const & | X, |
Eigen::Ref< Eigen::Matrix< IndexType, 4, Eigen::Dynamic > const > const & | T ) |
Update the active set of vertex-triangle contacts.
TDerivedX | Eigen type of vertex positions |
X | kDims x |# vertices| matrix of vertex positions |
T | 4 x |# tetrahedra| tetrahedron array |
|
protected |
Recompute mesh tetrahedron hash grid for a specific body.
bodyIndex | Index of the body to update the tetrahedron hash grid for |
|
staticconstexpr |
Maximum number of contacting triangles per vertex.