iMSTK
Interactive Medical Simulation Toolkit
|
This class implements a constraint based rigid body linear system with pgs solver. More...
#include <imstkRigidBodyModel2.h>
Public Types | |
using | StorageIndex = Eigen::SparseMatrix< double >::StorageIndex |
![]() | |
enum | StateUpdateType { Displacement, Velocity, DeltaDisplacement, DeltaVelocity, None } |
Type of the update of the state of the body. | |
Public Member Functions | |
virtual void | setTimeStep (const double timeStep) override |
Set the time step size. | |
virtual double | getTimeStep () const override |
Returns the time step size. | |
std::shared_ptr< RigidBodyModel2Config > | getConfig () const |
const std::list< std::shared_ptr< RbdConstraint > > & | getConstraints () const |
std::shared_ptr< ProjectedGaussSeidelSolver< double > > | getSolver () const |
std::shared_ptr< RigidBody > | addRigidBody () |
Adds a body to the system, must call initialize for changes to effect returns its reference. | |
void | addConstraint (std::shared_ptr< RbdConstraint > constraint) |
Adds a constraint to be solved. | |
void | removeRigidBody (std::shared_ptr< RigidBody > body) |
Removes a body from the system, must call initialize for changes to effect. | |
bool | initialize () override |
Initialize the RigidBody model to the initial state. | |
void | updateMass () |
Updates mass and inertia matrices to those provided by the bodies. Not often needed unless mass/inertia is changing at runtime. | |
void | configure (std::shared_ptr< RigidBodyModel2Config > config) |
Configure the model. | |
void | computeTentativeVelocities () |
Computes the velocities. | |
void | solveConstraints () |
Solve the current constraints of the model, then discards. | |
void | integrate () |
Integrate the model state. | |
std::shared_ptr< TaskNode > | getComputeTentativeVelocitiesNode () const |
std::shared_ptr< TaskNode > | getSolveNode () const |
std::shared_ptr< TaskNode > | getIntegrateNode () const |
![]() | |
DynamicalModel (DynamicalModelType type=DynamicalModelType::None) | |
std::shared_ptr< RigidBodyState2 > | getInitialState () const |
Return the initial state of the problem. | |
std::shared_ptr< RigidBodyState2 > | getCurrentState () const |
Return the current state of the problem. | |
std::shared_ptr< RigidBodyState2 > | getPreviousState () const |
Return the previous state of the problem. | |
void | resetToInitialState () override |
Reset the current state to the initial state. | |
![]() | |
std::shared_ptr< TaskGraph > | getTaskGraph () const |
const DynamicalModelType & | getType () const |
Get the type of the object. | |
virtual void | updatePhysicsGeometry () |
Update the geometry of the model. | |
void | setModelGeometry (std::shared_ptr< Geometry > geometry) |
Sets the model geometry. | |
bool | isGeometryValid (const std::shared_ptr< Geometry > geometry) |
Checks if the given geometry is a valid geometry type for the model. | |
std::shared_ptr< Geometry > | getModelGeometry () const |
Gets the model geometry. | |
void | initGraphEdges () |
Initializes the edges of the graph. | |
std::size_t | getNumDegreeOfFreedom () const |
Get/Set the number of degrees of freedom. | |
void | setNumDegreeOfFreedom (const size_t nDof) |
virtual void | setTimeStepSizeType (const TimeSteppingType type) |
Get/Set the type of approach used to update the time step size after every frame. | |
TimeSteppingType | getTimeStepSizeType () const |
Protected Member Functions | |
void | initGraphEdges (std::shared_ptr< TaskNode > source, std::shared_ptr< TaskNode > sink) override |
Setup the task graph of the RigidBodyModel. | |
![]() | |
AbstractDynamicalModel (DynamicalModelType type=DynamicalModelType::None) | |
Protected Attributes | |
std::shared_ptr< RigidBodyModel2Config > | m_config |
std::shared_ptr< TaskNode > | m_computeTentativeVelocities |
std::shared_ptr< TaskNode > | m_solveNode |
std::shared_ptr< TaskNode > | m_integrateNode |
std::shared_ptr< ProjectedGaussSeidelSolver< double > > | m_pgsSolver |
Eigen::SparseMatrix< double > | m_Minv |
std::list< std::shared_ptr< RbdConstraint > > | m_constraints |
std::vector< std::shared_ptr< RigidBody > > | m_bodies |
std::unordered_map< RigidBody *, StorageIndex > | m_locations |
bool | m_modified = true |
size_t | m_maxBodiesParallel = 10 |
Eigen::VectorXd | F |
![]() | |
std::shared_ptr< RigidBodyState2 > | m_initialState |
Initial state. | |
std::shared_ptr< RigidBodyState2 > | m_currentState |
Current state. | |
std::shared_ptr< RigidBodyState2 > | m_previousState |
Previous state. | |
![]() | |
DynamicalModelType | m_type |
Mathematical model type. | |
std::size_t | m_numDof |
Total number of degree of freedom. | |
std::shared_ptr< Geometry > | m_geometry = nullptr |
Physics geometry of the model. | |
std::set< std::string > | m_validGeometryTypes |
Valid geometry types of this model. | |
TimeSteppingType | m_timeStepSizeType = TimeSteppingType::Fixed |
std::shared_ptr< TaskGraph > | m_taskGraph = nullptr |
This class implements a constraint based rigid body linear system with pgs solver.
References: David Baraff. 1997. An Introduction to Physically Based Modeling: Rigid Body Simulation II - Nonpenetration Constraints Marijn Tamis and Giuseppe Maggiore. 2015. Constraint based physics solver. David Baraff. 1989. Analyltical Methods for Dynamic Simulation of Non-Penetrating Rigid Bodies. In Computer Graphics (Proc. SIGGRAPH), volume 23, pages 223-232. ACM.
Definition at line 44 of file imstkRigidBodyModel2.h.