PhysicsBasedAnimationToolkit 0.0.10
Cross-platform C++20 library of algorithms and data structures commonly used in computer graphics research on physically-based simulation.
|
Static environment geometry for contact simulation. More...
#include <Environment.h>
Public Types | |
using | ScalarType = TScalar |
Scalar type. | |
using | SdfType = pbat::geometry::sdf::Forest<ScalarType> |
Public Member Functions | |
Environment ()=default | |
Construct a new Environment object. | |
Environment (SdfType sdf, Eigen::Index nPrimitives=0) | |
Construct a new Environment object. | |
void | SetSdf (SdfType sdf) |
Set the signed distance field representing the environment. | |
void | Reserve (Eigen::Index nPrimitives) |
Reserve space for contact primitives. | |
template<common::CIndex TIndex = Index> | |
void | DetectContactCandidates (MultibodyTetrahedralMeshSystem< TIndex, ScalarType > const &meshes) |
Eigen::Index | NumContactCandidates () const |
Get the number of contact candidates. | |
bool | IsContactCandidate (Eigen::Index i) const |
Check if a primitive is a contact candidate. | |
auto | ContactCandidates () const |
Get the contact candidates. | |
void | Serialize (io::Archive &archive) const |
Serialize the environment to an archive. | |
void | Deserialize (io::Archive const &archive) |
Deserialize the environment from an archive. | |
Public Attributes | |
Eigen::Vector< bool, Eigen::Dynamic > | mIsCandidate |
|# primitives| whether each point is in contact | |
Eigen::Vector< Eigen::Index, Eigen::Dynamic > | mCandidates |
|# primitives| indices of active primitives in [0, nCandidates) | |
Eigen::Index | nCandidates |
Number of active primitives. | |
Eigen::Vector< ScalarType, Eigen::Dynamic > | mPhi |
Eigen::Matrix< ScalarType, 3, Eigen::Dynamic > | mPoint |
Eigen::Matrix< ScalarType, 3 *3, Eigen::Dynamic > | mBasis |
pbat::geometry::sdf::Forest< ScalarType > | mSdf |
Signed distance field representing the environment. | |
Static environment geometry for contact simulation.
TScalar | Scalar type |
pbat::sim::contact::Environment< TScalar >::Environment | ( | SdfType | sdf, |
Eigen::Index | nPrimitives = 0 ) |
Construct a new Environment object.
sdf | Signed distance field representing the environment |
nPrimitives | Number of primitives to reserve space for |
|
inline |
Get the contact candidates.
|# candidates| x 1
indices of contact candidate primitives in [0, |# primitives|) void pbat::sim::contact::Environment< TScalar >::Deserialize | ( | io::Archive const & | archive | ) |
Deserialize the environment from an archive.
archive | Archive to deserialize from |
void pbat::sim::contact::Environment< TScalar >::DetectContactCandidates | ( | MultibodyTetrahedralMeshSystem< TIndex, ScalarType > const & | meshes | ) |
|
inline |
Check if a primitive is a contact candidate.
i | Index of the primitive in [0, |# primitives|) |
|
inline |
Get the number of contact candidates.
void pbat::sim::contact::Environment< TScalar >::Reserve | ( | Eigen::Index | nPrimitives | ) |
Reserve space for contact primitives.
nPrimitives | Number of primitives to reserve space for |
void pbat::sim::contact::Environment< TScalar >::Serialize | ( | io::Archive & | archive | ) | const |
Serialize the environment to an archive.
archive | Archive to serialize to |
void pbat::sim::contact::Environment< TScalar >::SetSdf | ( | SdfType | sdf | ) |
Set the signed distance field representing the environment.
sdf | Signed distance field representing the environment |
Eigen::Matrix<ScalarType, 3 * 3, Eigen::Dynamic> pbat::sim::contact::Environment< TScalar >::mBasis |
3*3 x |# primitives|
contact basis \( \begin{bmatrix} \mathbf{n} &
< \mathbf{t} & \mathbf{b} \end{bmatrix} \) at each contact point (undefined if phi > 0), such that mBasis.col(i).reshaped<3,3>() is the basis for primitive i
Eigen::Vector<ScalarType, Eigen::Dynamic> pbat::sim::contact::Environment< TScalar >::mPhi |
|# primitives|
signed distance values at each contact point (negative inside, positive outside)
Eigen::Matrix<ScalarType, 3, Eigen::Dynamic> pbat::sim::contact::Environment< TScalar >::mPoint |
3 x |# primitives|
contact point on the surface of each primitive (undefined if phi > 0)