SurgSim::Physics::Constraint Class Reference

Base class for all physics constraints. Contains data specific to the constraint and a pair of implementations. More...

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

Inheritance diagram for SurgSim::Physics::Constraint:

## Public Member Functions

| Constraint (ConstraintType constraintType, std::shared_ptr< ConstraintData > data, std::shared_ptr< Representation > representation0, const SurgSim::DataStructures::Location &location0, std::shared_ptr< Representation > representation1, const SurgSim::DataStructures::Location &location1)
| Sets all the values for this constraints, does validation on the parameters and will throw if something is wrong with the constraint. More...
virtual | ~Constraint ()
| Destructor. More...
void | setInformation (ConstraintType constraintType, std::shared_ptr< ConstraintData > data, std::shared_ptr< Representation > representation0, const SurgSim::DataStructures::Location &location0, std::shared_ptr< Representation > representation1, const SurgSim::DataStructures::Location &location1)
| Sets all the values for this constraints, does validation on the parameters and will throw if something is wrong with the constraint. More...
const std::pair< std::shared_ptr< ConstraintImplementation >, std::shared_ptr< ConstraintImplementation > > & | getImplementations () const
| Gets both sides implementation as a pair. More...
const std::pair< std::shared_ptr< Localization >, std::shared_ptr< Localization > > & | getLocalizations () const
| Gets both sides Localization as a pair. More...
std::shared_ptr< ConstraintData > | getData () const
| Gets the data associated to this constraint. More...
size_t | getNumDof () const
| Gets the number of degree of freedom for this constraint. More...
ConstraintType | getType ()
| Gets the ConstraintType. More...
void | build (double dt, MlcpPhysicsProblem *mlcpPhysicsProblem, size_t indexOfRepresentation0, size_t indexOfRepresentation1, size_t indexOfConstraint)
| Builds subset of an Mlcp physics problem associated to this constraint. More...
bool | isActive ()
void | setActive (bool flag)

## Protected Member Functions

virtual void | doBuild (double dt, const ConstraintData &data, MlcpPhysicsProblem *mlcpPhysicsProblem, size_t indexOfRepresentation0, size_t indexOfRepresentation1, size_t indexOfConstraint)
| Builds subset of an Mlcp physics problem associated to this constraint user-defined call for extra treatment. More...

## Protected Attributes

std::array< Math::MlcpConstraintType, NUM_CONSTRAINT_TYPES > | m_mlcpMap
| Constraint-MLCP mapping. More...
std::shared_ptr< ConstraintData > | m_data
| Specific data associated to this constraint. More...
std::pair< std::shared_ptr< ConstraintImplementation >, std::shared_ptr< ConstraintImplementation > > | m_implementations
| Pair of implementations defining the 2 sides of the constraint. More...
std::pair< std::shared_ptr< Localization >, std::shared_ptr< Localization > > | m_localizations
size_t | m_numDof
| The degrees of freedom that this constraint has. More...
ConstraintType | m_constraintType
| The type of this constraint. More...
bool | m_active
| Flag to indicate whether this constraint is active or not. More...

## Detailed Description

Base class for all physics constraints. Contains data specific to the constraint and a pair of implementations.

## Constructor & Destructor Documentation

## Constraint()

SurgSim::Physics::Constraint::Constraint | ( | ConstraintType | constraintType,
|  | std::shared_ptr< ConstraintData > | data,
|  | std::shared_ptr< Representation > | representation0,
|  | const SurgSim::DataStructures::Location & | location0,
|  | std::shared_ptr< Representation > | representation1,
|  | const SurgSim::DataStructures::Location & | location1
| ) |  |

Sets all the values for this constraints, does validation on the parameters and will throw if something is wrong with the constraint.

Parameters

  constraintType | The constraint type.
  data | The data for this constraint.
  representation0,representation1 | Both representations in this constraint.
  location0,location1 | Both locations of the representations involved in this constraint.

## ~Constraint()

SurgSim::Physics::Constraint::~Constraint | ( |  | ) |

virtual

Destructor.

## Member Function Documentation

## build()

void SurgSim::Physics::Constraint::build | ( | double | dt,
|  | MlcpPhysicsProblem * | mlcpPhysicsProblem,
|  | size_t | indexOfRepresentation0,
|  | size_t | indexOfRepresentation1,
|  | size_t | indexOfConstraint
| ) |  |

Builds subset of an Mlcp physics problem associated to this constraint.

Parameters

  | dt | The time step.
  [in,out] | mlcpPhysicsProblem | The Mlcp physics problem to be filled up.
  | indexOfRepresentation0 | The index of the 1st representation in the Mlcp.
  | indexOfRepresentation1 | The index of the 2nd representation in the Mlcp.
  | indexOfConstraint | The index of this constraint in the Mlcp.

## doBuild()

void SurgSim::Physics::Constraint::doBuild | ( | double | dt,
|  | const ConstraintData & | data,
|  | MlcpPhysicsProblem * | mlcpPhysicsProblem,
|  | size_t | indexOfRepresentation0,
|  | size_t | indexOfRepresentation1,
|  | size_t | indexOfConstraint
| ) |  |

protected virtual

Builds subset of an Mlcp physics problem associated to this constraint user-defined call for extra treatment.

Parameters

  | dt | The time step
  | data | The data specific to this constraint
  [in,out] | mlcpPhysicsProblem | The Mlcp physics problem to be filled up
  | indexOfRepresentation0 | The index of the 1st representation in the Mlcp
  | indexOfRepresentation1 | The index of the 2nd representation in the Mlcp
  | indexOfConstraint | The index of this constraint in the Mlcp

Reimplemented in SurgSim::Physics::SlidingConstraint, and SurgSim::Physics::RotationVectorConstraint.

## getData()

std::shared_ptr< ConstraintData > SurgSim::Physics::Constraint::getData | ( |  | ) | const

Gets the data associated to this constraint.

Returns
  The data associated to this constraint.

## getImplementations()

const std::pair< std::shared_ptr< ConstraintImplementation >, std::shared_ptr< ConstraintImplementation > > & SurgSim::Physics::Constraint::getImplementations | ( |  | ) | const

Gets both sides implementation as a pair.

Returns
  the pair of implementations forming this constraint.

## getLocalizations()

const std::pair< std::shared_ptr< Localization >, std::shared_ptr< Localization > > & SurgSim::Physics::Constraint::getLocalizations | ( |  | ) | const

Gets both sides Localization as a pair.

Returns
  the pair of localizations forming this constraint.

## getNumDof()

size_t SurgSim::Physics::Constraint::getNumDof | ( |  | ) | const

Gets the number of degree of freedom for this constraint.

Returns
  The number of degree of freedom for this constraint.

## getType()

ConstraintType SurgSim::Physics::Constraint::getType | ( |  | ) |

Gets the ConstraintType.

Returns
  The type

## isActive()

bool SurgSim::Physics::Constraint::isActive | ( |  | ) |

Returns
  Whether this constraint is active.

## setActive()

void SurgSim::Physics::Constraint::setActive | ( | bool | flag | ) |

Parameters

  flag | Whether this constraint is active.

## setInformation()

void SurgSim::Physics::Constraint::setInformation | ( | ConstraintType | constraintType,
|  | std::shared_ptr< ConstraintData > | data,
|  | std::shared_ptr< Representation > | representation0,
|  | const SurgSim::DataStructures::Location & | location0,
|  | std::shared_ptr< Representation > | representation1,
|  | const SurgSim::DataStructures::Location & | location1
| ) |  |

Sets all the values for this constraints, does validation on the parameters and will throw if something is wrong with the constraint.

Parameters

  constraintType | The constraint type.
  data | The data for this constraint.
  representation0,representation1 | Both representations in this constraint.
  location0,location1 | Both locations of the representations involved in this constraint.

## Member Data Documentation

## m_active

bool SurgSim::Physics::Constraint::m_active

protected

Flag to indicate whether this constraint is active or not.

## m_constraintType

ConstraintType SurgSim::Physics::Constraint::m_constraintType

protected

The type of this constraint.

## m_data

std::shared_ptr<ConstraintData> SurgSim::Physics::Constraint::m_data

protected

Specific data associated to this constraint.

## m_implementations

std::pair<std::shared_ptr<ConstraintImplementation>, std::shared_ptr<ConstraintImplementation> > SurgSim::Physics::Constraint::m_implementations

protected

Pair of implementations defining the 2 sides of the constraint.

## m_localizations

std::pair<std::shared_ptr<Localization>, std::shared_ptr<Localization> > SurgSim::Physics::Constraint::m_localizations

protected

## m_mlcpMap

std::array<Math::MlcpConstraintType, NUM_CONSTRAINT_TYPES> SurgSim::Physics::Constraint::m_mlcpMap

protected

Constraint-MLCP mapping.

## m_numDof

size_t SurgSim::Physics::Constraint::m_numDof

protected

The degrees of freedom that this constraint has.

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

- SurgSim/Physics/Constraint.h
- SurgSim/Physics/Constraint.cpp