opensurgsim
Public Member Functions | List of all members
SurgSim::Physics::MassSpringLocalization Class Reference

Implementation of Localization for MassSpringRepresentation. More...

#include <MassSpringLocalization.h>

Inheritance diagram for SurgSim::Physics::MassSpringLocalization:
SurgSim::Physics::Localization

Public Member Functions

 MassSpringLocalization ()
 Default constructor.
 
 MassSpringLocalization (std::shared_ptr< Representation > representation)
 Constructor. More...
 
virtual ~MassSpringLocalization ()
 Destructor.
 
void setLocalNode (size_t nodeID)
 Sets the local node. More...
 
const DataStructures::OptionalValue< size_t > & getLocalNode () const
 Gets the local node. More...
 
void setLocalPosition (const SurgSim::DataStructures::IndexedLocalCoordinate &localPosition)
 Sets the local position. More...
 
const DataStructures::OptionalValue< SurgSim::DataStructures::IndexedLocalCoordinate > & getLocalPosition () const
 Gets the local position. More...
 
bool isValidRepresentation (std::shared_ptr< Representation > representation) override
 Queries whether Representation can be assigned to this class. More...
 
bool moveClosestTo (const Math::Vector3d &point, bool *hasReachedEnd) override
 
std::shared_ptr< LocalizationdoCopy () const override
 
- Public Member Functions inherited from SurgSim::Physics::Localization
 Localization ()
 Default constructor.
 
 Localization (std::shared_ptr< Representation > representation)
 Constructor. More...
 
virtual ~Localization ()
 Destructor.
 
void setRepresentation (std::shared_ptr< Representation > representation)
 Sets the representation. More...
 
std::shared_ptr< RepresentationgetRepresentation () 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...
 
std::shared_ptr< Localizationcopy () const
 

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 either the ID of a node contained within the associated MassSpringRepresentation, or the barycentric coordinates of an element (1D, 2D, or 3D) in that MassSpringRepresentation, and it provides a helper function MassSpringLocalization::calculatePosition to find the position in global coordinates in the current state.

Constructor & Destructor Documentation

§ MassSpringLocalization()

SurgSim::Physics::MassSpringLocalization::MassSpringLocalization ( std::shared_ptr< Representation representation)
explicit

Constructor.

Parameters
representationThe representation to assign to this localization.

Member Function Documentation

§ doCopy()

std::shared_ptr< Localization > SurgSim::Physics::MassSpringLocalization::doCopy ( ) const
overridevirtual
Returns
A copy.

Implements SurgSim::Physics::Localization.

§ getLocalNode()

const DataStructures::OptionalValue< size_t > & SurgSim::Physics::MassSpringLocalization::getLocalNode ( ) const

Gets the local node.

Returns
Node set for this localization.

§ getLocalPosition()

const DataStructures::OptionalValue< DataStructures::IndexedLocalCoordinate > & SurgSim::Physics::MassSpringLocalization::getLocalPosition ( ) const

Gets the local position.

Returns
The local position set for this localization.

§ isValidRepresentation()

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

Queries whether Representation can be assigned to this class.

Parameters
representationRepresentation to check.
Returns
true if Representation is valid.

Reimplemented from SurgSim::Physics::Localization.

§ moveClosestTo()

bool SurgSim::Physics::MassSpringLocalization::moveClosestTo ( const Math::Vector3d point,
bool *  hasReachedEnd 
)
overridevirtual
Parameters
pointMove this localization closest to this point
hasReachedEnd[out] Flag to set, when the localization reaches the end of the representation.
Returns
Whether the localization was moved or not.

Reimplemented from SurgSim::Physics::Localization.

§ setLocalNode()

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

Sets the local node.

Parameters
nodeIDNode set for this localization.

§ setLocalPosition()

void SurgSim::Physics::MassSpringLocalization::setLocalPosition ( const SurgSim::DataStructures::IndexedLocalCoordinate localPosition)

Sets the local position.

Parameters
localPositionThe local position to set the localization at.

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