SurgSim::Physics::CcdCollisionLoop Class Reference

`#include <SurgSim/Physics/CcdCollisionLoop.h>`

Inheritance diagram for SurgSim::Physics::CcdCollisionLoop:

## Public Member Functions

| CcdCollisionLoop (bool copyState)
| Constructor. More...
| ~CcdCollisionLoop ()
| Destructor. More...
| SURGSIM_CLASSNAME (SurgSim::Physics::CcdCollisionLoop)
std::shared_ptr< PhysicsManagerState > | doUpdate (const double &dt, const std::shared_ptr< PhysicsManagerState > &state) override
| Override this function to implement the computations specific behavior. More...
Public Member Functions inherited from SurgSim::Physics::Computation
| Computation (bool doCopyState)
| Constructor. More...
virtual | ~Computation ()
| Destructor. More...
std::shared_ptr< PhysicsManagerState > | update (double dt, const std::shared_ptr< PhysicsManagerState > &state)
| Public Interface execute this objects computations, dt is the time from the last update call in seconds. More...
void | setDoCopyState (bool val)
| Sets up whether the computation will copy the state of PhysicsManagerState before executing. More...
bool | isCopyingState ()
| Query if this object is copying the PhysicsManagerState. More...
virtual std::string | getClassName () const =0
| The class name for this class. More...
Framework::Timer & | getTimer ()
| Provides access to the update timer. More...

## Private Member Functions

bool | findEarliestContact (const std::vector< std::shared_ptr< Collision::CollisionPair >> &ccdPairs, double *currentTimeOfImpact)
| Takes all the contacts from ccdPairs, finds the first contact wrt contact time. More...
void | filterLaterContacts (std::vector< std::shared_ptr< Collision::CollisionPair >> *ccdPairs, double epsilon, double contactTime)
| Removes all contacts with contact time greater than the first contact time + epsilon. More...
void | backupContacts (std::vector< std::shared_ptr< Collision::CollisionPair >> *ccdPairs, std::vector< std::list< std::shared_ptr< Collision::Contact >>> *oldContacts)
| Backs up all current contacts into oldContacts and then clears the ccdPairs. More...
void | restoreContacts (std::vector< std::shared_ptr< Collision::CollisionPair >> *ccdPairs, std::vector< std::list< std::shared_ptr< Collision::Contact >>> *oldContacts)
| Adds all of the backed up contacts back into the current contacts. More...
void | printContacts (const std::vector< std::shared_ptr< Collision::CollisionPair >> &ccdPairs)
| Logs all of the contacts. More...

## Private Attributes

size_t | m_maxIterations
| maximum number of iterations to run More...
double | m_epsilonFactor
| epsilon as a fraction of dt, i.e. More...
std::shared_ptr< SurgSim::Framework::Logger > | m_logger
std::unique_ptr< CcdCollision > | m_ccdCollision
std::unique_ptr< UpdateCcdData > | m_updateCcdData
std::unique_ptr< ContactFiltering > | m_contactFilter
std::unique_ptr< ContactConstraintGeneration > | m_constraintGeneration
std::unique_ptr< BuildMlcp > | m_buildMlcp
std::unique_ptr< SolveMlcp > | m_solveMlcp
std::unique_ptr< PushResults > | m_pushResults

## Friends

class | CcdCollisionLoopTest_FilterContacts_Test
class | CcdCollisionLoopTest_FilterContactsWithEpsilon_Test

## Additional Inherited Members

## Constructor & Destructor Documentation

## CcdCollisionLoop()

SurgSim::Physics::CcdCollisionLoop::CcdCollisionLoop | ( | bool | copyState | ) |

explicit

Constructor.

## ~CcdCollisionLoop()

SurgSim::Physics::CcdCollisionLoop::~CcdCollisionLoop | ( |  | ) |

Destructor.

## Member Function Documentation

## backupContacts()

void SurgSim::Physics::CcdCollisionLoop::backupContacts | ( | std::vector< std::shared_ptr< Collision::CollisionPair >> * | ccdPairs,
|  | std::vector< std::list< std::shared_ptr< Collision::Contact >>> * | oldContacts
| ) |  |

private

Backs up all current contacts into oldContacts and then clears the ccdPairs.

Parameters

  ccdPairs | the list of current contact pairs
  oldContacts | the backup of the contacts

## doUpdate()

std::shared_ptr< PhysicsManagerState > SurgSim::Physics::CcdCollisionLoop::doUpdate | ( | const double & | dt,
|  | const std::shared_ptr< PhysicsManagerState > & | state
| ) |  |

override virtual

Override this function to implement the computations specific behavior.

Implements SurgSim::Physics::Computation.

## filterLaterContacts()

void SurgSim::Physics::CcdCollisionLoop::filterLaterContacts | ( | std::vector< std::shared_ptr< Collision::CollisionPair >> * | ccdPairs,
|  | double | epsilon,
|  | double | contactTime
| ) |  |

private

Removes all contacts with contact time greater than the first contact time + epsilon.

Parameters

  ccdPairs | the list of pairs that should be checked for contacts
  epsilon | the epsilon to be added to the first contactTime for filtering
  contactTime | times outside of epsilon from contactTime will be reomved from consideration

## findEarliestContact()

bool SurgSim::Physics::CcdCollisionLoop::findEarliestContact | ( | const std::vector< std::shared_ptr< Collision::CollisionPair >> & | ccdPairs,
|  | double * | currentTimeOfImpact
| ) |  |

private

Takes all the contacts from ccdPairs, finds the first contact wrt contact time.

Parameters

  | ccdPairs | the list of pairs that should be checked for contacts
  [out] | currentTimeOfImpact | the earliest contact time found in ccdPairs

Returns
  true if there were any contacts found in ccdPairs

## printContacts()

void SurgSim::Physics::CcdCollisionLoop::printContacts | ( | const std::vector< std::shared_ptr< Collision::CollisionPair >> & | ccdPairs | ) |

private

Logs all of the contacts.

Parameters

  ccdPairs | the list of current contact pairs

## restoreContacts()

void SurgSim::Physics::CcdCollisionLoop::restoreContacts | ( | std::vector< std::shared_ptr< Collision::CollisionPair >> * | ccdPairs,
|  | std::vector< std::list< std::shared_ptr< Collision::Contact >>> * | oldContacts
| ) |  |

private

Adds all of the backed up contacts back into the current contacts.

Contacts already in 'ccdPairs' will be kept..

Parameters

  ccdPairs | the list of current contact pairs
  oldContacts | the backup of the contacts

## SURGSIM_CLASSNAME()

SurgSim::Physics::CcdCollisionLoop::SURGSIM_CLASSNAME | ( | SurgSim::Physics::CcdCollisionLoop |  | ) |

## Friends And Related Function Documentation

## CcdCollisionLoopTest_FilterContacts_Test

friend class CcdCollisionLoopTest_FilterContacts_Test

friend

Test access

## CcdCollisionLoopTest_FilterContactsWithEpsilon_Test

friend class CcdCollisionLoopTest_FilterContactsWithEpsilon_Test

friend

Test access

## Member Data Documentation

## m_buildMlcp

std::unique_ptr<BuildMlcp> SurgSim::Physics::CcdCollisionLoop::m_buildMlcp

private

Computations

## m_ccdCollision

std::unique_ptr<CcdCollision> SurgSim::Physics::CcdCollisionLoop::m_ccdCollision

private

Computations

## m_constraintGeneration

std::unique_ptr<ContactConstraintGeneration> SurgSim::Physics::CcdCollisionLoop::m_constraintGeneration

private

Computations

## m_contactFilter

std::unique_ptr<ContactFiltering> SurgSim::Physics::CcdCollisionLoop::m_contactFilter

private

Computations

## m_epsilonFactor

double SurgSim::Physics::CcdCollisionLoop::m_epsilonFactor

private

epsilon as a fraction of dt, i.e.

if this is 100, the epsilon will be dt/100 during the iteration epsilon will be scaled to remain dt/100 as it pertains to the ever shrinking interval that is the iterations intervall

## m_logger

std::shared_ptr<SurgSim::Framework::Logger> SurgSim::Physics::CcdCollisionLoop::m_logger

private

## m_maxIterations

size_t SurgSim::Physics::CcdCollisionLoop::m_maxIterations

private

maximum number of iterations to run

## m_pushResults

std::unique_ptr<PushResults> SurgSim::Physics::CcdCollisionLoop::m_pushResults

private

Computations

## m_solveMlcp

std::unique_ptr<SolveMlcp> SurgSim::Physics::CcdCollisionLoop::m_solveMlcp

private

Computations

## m_updateCcdData

std::unique_ptr<UpdateCcdData> SurgSim::Physics::CcdCollisionLoop::m_updateCcdData

private

Computations

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

- SurgSim/Physics/CcdCollisionLoop.h
- SurgSim/Physics/CcdCollisionLoop.cpp