SurgSim::Physics::RotationVectorConstraint Class Reference

Specific class for rotation vector constraints. More...

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

Inheritance diagram for SurgSim::Physics::RotationVectorConstraint:

## Public Member Functions

| RotationVectorConstraint (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)
virtual | ~RotationVectorConstraint ()
| Destructor. More...
Public Member Functions inherited from 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. 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

void | doBuild (double dt, const ConstraintData &data, MlcpPhysicsProblem *mlcpPhysicsProblem, size_t indexOfRepresentation0, size_t indexOfRepresentation1, size_t indexOfConstraint) override

## Additional Inherited Members

Protected Attributes inherited from SurgSim::Physics::Constraint
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

Specific class for rotation vector constraints.

It handles the specificity of the rotation vector in the constraint calculation.

## Constructor & Destructor Documentation

## RotationVectorConstraint()

SurgSim::Physics::RotationVectorConstraint::RotationVectorConstraint | ( | 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
| ) |  |

## ~RotationVectorConstraint()

SurgSim::Physics::RotationVectorConstraint::~RotationVectorConstraint | ( |  | ) |

virtual

Destructor.

## Member Function Documentation

## doBuild()

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

override protected virtual

Note
  The rotation vector violation being calculated based on a quaternion interpolation (slerp), and this type of interpolation being highly non-linear, the classical way of using the implementation one after the other one won't work. Therefore, this method temporarily uses the vector mlcpPhysicsProblem->b to retrieve both representation's rotation vectors, then calculate the proper slerp and set the violation back in mlcpPhysicsProblem->b

Reimplemented from SurgSim::Physics::Constraint.

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

- SurgSim/Physics/RotationVectorConstraint.h
- SurgSim/Physics/RotationVectorConstraint.cpp