iMSTK
Interactive Medical Simulation Toolkit
Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
imstk::RigidBodyModel2 Class Reference

This class implements a constraint based rigid body linear system with pgs solver. More...

#include <imstkRigidBodyModel2.h>

Inheritance diagram for imstk::RigidBodyModel2:
Inheritance graph
[legend]
Collaboration diagram for imstk::RigidBodyModel2:
Collaboration graph
[legend]

Public Types

using StorageIndex = Eigen::SparseMatrix< double >::StorageIndex
 
- Public Types inherited from imstk::AbstractDynamicalModel
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< RigidBodyModel2ConfiggetConfig () const
 
const std::list< std::shared_ptr< RbdConstraint > > & getConstraints () const
 
std::shared_ptr< ProjectedGaussSeidelSolver< double > > getSolver () const
 
std::shared_ptr< RigidBodyaddRigidBody ()
 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< TaskNodegetComputeTentativeVelocitiesNode () const
 
std::shared_ptr< TaskNodegetSolveNode () const
 
std::shared_ptr< TaskNodegetIntegrateNode () const
 
- Public Member Functions inherited from imstk::DynamicalModel< RigidBodyState2 >
 DynamicalModel (DynamicalModelType type=DynamicalModelType::None)
 
std::shared_ptr< RigidBodyState2getInitialState () const
 Return the initial state of the problem.
 
std::shared_ptr< RigidBodyState2getCurrentState () const
 Return the current state of the problem.
 
std::shared_ptr< RigidBodyState2getPreviousState () const
 Return the previous state of the problem.
 
void resetToInitialState () override
 Reset the current state to the initial state.
 
- Public Member Functions inherited from imstk::AbstractDynamicalModel
std::shared_ptr< TaskGraphgetTaskGraph () const
 
const DynamicalModelTypegetType () 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< GeometrygetModelGeometry () 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.
 
- Protected Member Functions inherited from imstk::AbstractDynamicalModel
 AbstractDynamicalModel (DynamicalModelType type=DynamicalModelType::None)
 

Protected Attributes

std::shared_ptr< RigidBodyModel2Configm_config
 
std::shared_ptr< TaskNodem_computeTentativeVelocities
 
std::shared_ptr< TaskNodem_solveNode
 
std::shared_ptr< TaskNodem_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
 
- Protected Attributes inherited from imstk::DynamicalModel< RigidBodyState2 >
std::shared_ptr< RigidBodyState2m_initialState
 Initial state.
 
std::shared_ptr< RigidBodyState2m_currentState
 Current state.
 
std::shared_ptr< RigidBodyState2m_previousState
 Previous state.
 
- Protected Attributes inherited from imstk::AbstractDynamicalModel
DynamicalModelType m_type
 Mathematical model type.
 
std::size_t m_numDof
 Total number of degree of freedom.
 
std::shared_ptr< Geometrym_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< TaskGraphm_taskGraph = nullptr
 

Detailed Description

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.


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