SurgSim::Physics::ContactConstraintGeneration Class Reference

Generate a constraint for every contact that was calculated. More...

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

Inheritance diagram for SurgSim::Physics::ContactConstraintGeneration:

## Public Member Functions

| ContactConstraintGeneration (bool doCopyState=false)
| Constructor. More...
| SURGSIM_CLASSNAME (SurgSim::Physics::ContactConstraintGeneration)
| ~ContactConstraintGeneration ()
| Destructor. 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

std::shared_ptr< PhysicsManagerState > | doUpdate (const double &dt, const std::shared_ptr< PhysicsManagerState > &state) override
| Overridden function from Computation, the actual work is done here. More...
std::shared_ptr< SurgSim::DataStructures::Location > | makeLocation (std::shared_ptr< SurgSim::Physics::Representation > physicsRepresentation, std::shared_ptr< SurgSim::Collision::Representation > collisionRepresentation, const SurgSim::DataStructures::Location &location)
| Generate a location from a Collision Representation. More...

## Private Attributes

std::shared_ptr< SurgSim::Framework::Logger > | m_logger
| The logger for this class. More...

## Additional Inherited Members

## Detailed Description

Generate a constraint for every contact that was calculated.

The general algorithm is such, for each pair of Collision Representations that has Contacts For each contact:

- Generate a localization for each side of the pair
- Find the correct CollisionImplementation for the Representation and type of constraint, note that currently we use only one type of constraint for the collision
- Create the ConstraintData for the contact with
- Create a constraint from, the ContactImplmentation, Localization and ConstraintData
- Add it to the list of Constraints At the end those constraints are added as contact constraints to the physics state

## Constructor & Destructor Documentation

## ContactConstraintGeneration()

SurgSim::Physics::ContactConstraintGeneration::ContactConstraintGeneration | ( | bool | doCopyState = `false` | ) |

explicit

Constructor.

Parameters

  doCopyState | Specify if the output state in Computation::Update() is a copy or not of the input state

## ~ContactConstraintGeneration()

SurgSim::Physics::ContactConstraintGeneration::~ContactConstraintGeneration | ( |  | ) |

Destructor.

## Member Function Documentation

## doUpdate()

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

override private virtual

Overridden function from Computation, the actual work is done here.

Parameters

  dt | The time passed from the last update in seconds.
  state | The physics state.

Returns
  The changed state of the, depending on the setting of doCopyState this is either the same instance or a copied instance of the physics state.

Implements SurgSim::Physics::Computation.

## makeLocation()

std::shared_ptr< SurgSim::DataStructures::Location > SurgSim::Physics::ContactConstraintGeneration::makeLocation | ( | std::shared_ptr< SurgSim::Physics::Representation > | physicsRepresentation,
|  | std::shared_ptr< SurgSim::Collision::Representation > | collisionRepresentation,
|  | const SurgSim::DataStructures::Location & | location
| ) |  |

private

Generate a location from a Collision Representation.

Parameters

  physicsRepresentation | The physics representation.
  collisionRepresentation | The collision representation.
  location | The location generated by the contact calculation.

Returns
  The localization for the collision representations physics representation.

Note
  Asserts if cannot Location create shared object.

## SURGSIM_CLASSNAME()

SurgSim::Physics::ContactConstraintGeneration::SURGSIM_CLASSNAME | ( | SurgSim::Physics::ContactConstraintGeneration |  | ) |

## Member Data Documentation

## m_logger

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

private

The logger for this class.

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

- SurgSim/Physics/ContactConstraintGeneration.h
- SurgSim/Physics/ContactConstraintGeneration.cpp