SurgSim::Physics::MassSpringLocalization Class Reference

Implementation of Localization for MassSpringRepresentation. More...

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

Inheritance diagram for SurgSim::Physics::MassSpringLocalization:

## Public Member Functions

| MassSpringLocalization ()
| Default constructor. More...
| MassSpringLocalization (std::shared_ptr< Representation > representation)
| Constructor. More...
virtual | ~MassSpringLocalization ()
| Destructor. More...
void | setLocalNode (size_t nodeID)
| Sets the local node. More...
const size_t & | getLocalNode () const
| Gets the local node. More...
bool | isValidRepresentation (std::shared_ptr< Representation > representation) override
| Queries whether Representation can be assigned to this class. More...
Public Member Functions inherited from SurgSim::Physics::Localization
| Localization ()
| Default constructor. More...
| Localization (std::shared_ptr< Representation > representation)
| Constructor. More...
virtual | ~Localization ()
| Destructor. More...
void | setRepresentation (std::shared_ptr< Representation > representation)
| Sets the representation. More...
std::shared_ptr< Representation > | getRepresentation () const
| Gets the representation. More...
SurgSim::Math::Vector3d | calculatePosition (double time=1.0) const
| Calculates the global position of this localization. More...
SurgSim::Math::Vector3d | calculateVelocity (double time=1.0) const
| Calculates the global velocity of this localization. More...
virtual Math::RigidTransform3d | getElementPose ()
| Find a pose that the localization is represented with respect to. More...
virtual bool | moveClosestTo (const Math::Vector3d &point, bool *hasReachedEnd)

## Private Member Functions

SurgSim::Math::Vector3d | doCalculatePosition (double time) const override
| Calculates the global position of this localization. More...
SurgSim::Math::Vector3d | doCalculateVelocity (double time) const override
| Calculates the global velocity of this localization. More...

## Private Attributes

size_t | m_nodeID
| Node defining the localization. More...

## Detailed Description

Implementation of Localization for MassSpringRepresentation.

MassSpringLocalization tracks the global coordinates of a node contained in an associated MassSpringRepresentation. It is used, for example, as a helper class for filling out the MlcpPhysicsProblem in MassSpringRepresentationContact::doBuild, which constrains the motion of MassSpringRepresentation at a frictionless contact.

MassSpringLocalization stores a pointer to a MassSpringRepresentation in an abstract Representation object. It tracks the ID of a node contained within the associated MassSpringRepresentation, and it provides a helper function MassSpringLocalization::calculatePosition to find the node's position in global coordinates in the current state.

## Constructor & Destructor Documentation

## MassSpringLocalization() [1/2]

SurgSim::Physics::MassSpringLocalization::MassSpringLocalization | ( |  | ) |

Default constructor.

## MassSpringLocalization() [2/2]

SurgSim::Physics::MassSpringLocalization::MassSpringLocalization | ( | std::shared_ptr< Representation > | representation | ) |

explicit

Constructor.

Parameters

  representation | The representation to assign to this localization.

## ~MassSpringLocalization()

SurgSim::Physics::MassSpringLocalization::~MassSpringLocalization | ( |  | ) |

virtual

Destructor.

## Member Function Documentation

## doCalculatePosition()

SurgSim::Math::Vector3d SurgSim::Physics::MassSpringLocalization::doCalculatePosition | ( | double | time | ) | const

override private virtual

Calculates the global position of this localization.

Parameters

  time | Interpolation parameter [0..1] for calcuting position between the previous state (0.0) and current state (1.0).

Returns
  The global position of the localization using an interpolation between the previous and current states.

Note
  The time parameter can useful when dealing with Continuous Collision Detection.

Implements SurgSim::Physics::Localization.

## doCalculateVelocity()

SurgSim::Math::Vector3d SurgSim::Physics::MassSpringLocalization::doCalculateVelocity | ( | double | time | ) | const

override private virtual

Calculates the global velocity of this localization.

Parameters

  time | The time in [0..1] at which the velocity should be calculated

Returns
  The global velocity of the localization at the requested time

Note
  time can useful when dealing with CCD

Implements SurgSim::Physics::Localization.

## getLocalNode()

const size_t & SurgSim::Physics::MassSpringLocalization::getLocalNode | ( |  | ) | const

Gets the local node.

Returns
  Node set for this localization.

## isValidRepresentation()

bool SurgSim::Physics::MassSpringLocalization::isValidRepresentation | ( | std::shared_ptr< Representation > | representation | ) |

override virtual

Queries whether Representation can be assigned to this class.

Parameters

  representation | Representation to check.

Returns
  true if Representation is valid.

Reimplemented from SurgSim::Physics::Localization.

## setLocalNode()

void SurgSim::Physics::MassSpringLocalization::setLocalNode | ( | size_t | nodeID | ) |

Sets the local node.

Parameters

  nodeID | Node set for this localization.

## Member Data Documentation

## m_nodeID

size_t SurgSim::Physics::MassSpringLocalization::m_nodeID

private

Node defining the localization.

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

- SurgSim/Physics/MassSpringLocalization.h
- SurgSim/Physics/MassSpringLocalization.cpp