Biorbd
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
biorbd::muscles::Geometry Class Reference

Class Geometry of the muscle. More...

#include <Geometry.h>

Public Member Functions

 Geometry ()
 Construct geometry.
 
 Geometry (const biorbd::utils::Vector3d &origin, const biorbd::utils::Vector3d &insertion)
 Construct geometry. More...
 
biorbd::muscles::Geometry DeepCopy () const
 Deep copy of a geometry. More...
 
void DeepCopy (const biorbd::muscles::Geometry &other)
 Deep copy of a geometry from another geometry. More...
 
void updateKinematics (biorbd::rigidbody::Joints &model, const biorbd::rigidbody::GeneralizedCoordinates *Q=nullptr, const biorbd::rigidbody::GeneralizedVelocity *Qdot=nullptr, int updateKin=2)
 Updates the position and dynamic elements of the muscles. More...
 
void updateKinematics (biorbd::rigidbody::Joints &model, const biorbd::muscles::Characteristics &characteristics, biorbd::muscles::PathModifiers &pathModifiers, const biorbd::rigidbody::GeneralizedCoordinates *Q=nullptr, const biorbd::rigidbody::GeneralizedVelocity *Qdot=nullptr, int updateKin=2)
 Updates the position and dynamic elements of the muscles. More...
 
void updateKinematics (std::vector< biorbd::utils::Vector3d > &musclePointsInGlobal, biorbd::utils::Matrix &jacoPointsInGlobal, const biorbd::rigidbody::GeneralizedVelocity *Qdot=nullptr)
 Updates the position and dynamic elements of the muscles by hand. More...
 
void updateKinematics (std::vector< biorbd::utils::Vector3d > &musclePointsInGlobal, biorbd::utils::Matrix &jacoPointsInGlobal, const biorbd::muscles::Characteristics &characteristics, const biorbd::rigidbody::GeneralizedVelocity *Qdot=nullptr)
 Updates the position and dynamic elements of the muscles by hand. More...
 
void setOrigin (const biorbd::utils::Vector3d &position)
 Set the origin position in the local reference frame of the muscle. More...
 
const biorbd::utils::Vector3doriginInLocal () const
 Return the origin position. More...
 
void setInsertionInLocal (const biorbd::utils::Vector3d &position)
 Set the insertion position. More...
 
const biorbd::utils::Vector3dinsertionInLocal () const
 Return the insertion position. More...
 
const biorbd::utils::Vector3doriginInGlobal () const
 Return the origin position in the global reference. More...
 
const biorbd::utils::Vector3dinsertionInGlobal () const
 Return the insertion position in the global reference. More...
 
const std::vector< biorbd::utils::Vector3d > & musclesPointsInGlobal () const
 Return the muscles points in the global reference. More...
 
const biorbd::utils::Scalar & length () const
 Return the previously computed muscle length. More...
 
const biorbd::utils::Scalar & musculoTendonLength () const
 Return the previously computed muscle-tendon length. More...
 
const biorbd::utils::Scalar & velocity () const
 Return the previously computed velocity. More...
 
const biorbd::utils::Matrixjacobian () const
 Return the previously computed muscle jacobian. More...
 
biorbd::utils::Matrix jacobianOrigin () const
 Return the gradient of the jacobian for the origin node. More...
 
biorbd::utils::Matrix jacobianInsertion () const
 Return the gradient of the jacobian for the insertion node. More...
 
biorbd::utils::Matrix jacobian (unsigned int idxViaPoint) const
 Return the gradient of the jacobian for the via specified node. More...
 
const biorbd::utils::MatrixjacobianLength () const
 Return the jacobian length of the muscle. More...
 

Protected Member Functions

void _updateKinematics (const biorbd::rigidbody::GeneralizedVelocity *Qdot, const biorbd::muscles::Characteristics *characteristics=nullptr, biorbd::muscles::PathModifiers *pathModifiers=nullptr)
 Actual function that implements the update of the kinematics. More...
 
const biorbd::utils::Vector3doriginInGlobal (biorbd::rigidbody::Joints &model, const biorbd::rigidbody::GeneralizedCoordinates &Q)
 Updates the kinematics and return the position of the origin node. More...
 
const biorbd::utils::Vector3dinsertionInGlobal (biorbd::rigidbody::Joints &model, const biorbd::rigidbody::GeneralizedCoordinates &Q)
 Updates the kinematics and return the position of the insertion node. More...
 
void setMusclesPointsInGlobal (std::vector< biorbd::utils::Vector3d > &ptsInGlobal)
 Set the muscle points in global. More...
 
void setMusclesPointsInGlobal (biorbd::rigidbody::Joints &model, const biorbd::rigidbody::GeneralizedCoordinates &Q, biorbd::muscles::PathModifiers *pathModifiers=nullptr)
 Set the muscle points in global. More...
 
const biorbd::utils::Scalar & length (const biorbd::muscles::Characteristics *characteristics=nullptr, biorbd::muscles::PathModifiers *pathModifiers=nullptr)
 Update the kinematics, compute and return the muscle length. More...
 
const biorbd::utils::Scalar & velocity (const biorbd::rigidbody::GeneralizedVelocity &Qdot)
 Update the kinematics, compute and return the muscle velocity assuming not via points nor wrapping objects. More...
 
void setJacobianDimension (biorbd::rigidbody::Joints &model)
 Set the jacobian dimensions. More...
 
void jacobian (const biorbd::utils::Matrix &jaco)
 Force a jacobian computed from the user. More...
 
void jacobian (biorbd::rigidbody::Joints &model, const biorbd::rigidbody::GeneralizedCoordinates &Q)
 Compute the jacobian. More...
 
void computeJacobianLength ()
 Compute the muscle length jacobian.
 

Protected Attributes

std::shared_ptr< biorbd::utils::Vector3dm_origin
 Origin node.
 
std::shared_ptr< biorbd::utils::Vector3dm_insertion
 Insertion node.
 
std::shared_ptr< biorbd::utils::Vector3dm_originInGlobal
 Position of the origin in the global reference.
 
std::shared_ptr< biorbd::utils::Vector3dm_insertionInGlobal
 Position of the insertion node in the global reference.
 
std::shared_ptr< std::vector< biorbd::utils::Vector3d > > m_pointsInGlobal
 Position of all the points in the global reference.
 
std::shared_ptr< std::vector< biorbd::utils::Vector3d > > m_pointsInLocal
 Position of all the points in local.
 
std::shared_ptr< biorbd::utils::Matrixm_jacobian
 The jacobian matrix.
 
std::shared_ptr< biorbd::utils::Matrixm_G
 Internal matrix of the jacobian dimension to speed up calculation.
 
std::shared_ptr< biorbd::utils::Matrixm_jacobianLength
 The muscle length jacobian.
 
std::shared_ptr< biorbd::utils::Scalar > m_length
 Muscle length.
 
std::shared_ptr< biorbd::utils::Scalar > m_muscleTendonLength
 Muscle tendon length.
 
std::shared_ptr< biorbd::utils::Scalar > m_velocity
 Velocity of the muscular elongation.
 
std::shared_ptr< bool > m_isGeometryComputed
 To know if the geometry was computed at least once.
 
std::shared_ptr< bool > m_isVelocityComputed
 To know if the velocity was computed in the last update.
 
std::shared_ptr< bool > m_posAndJacoWereForced
 To know if the override was used on the muscle position and the Jacobian.
 

Detailed Description

Class Geometry of the muscle.

Definition at line 29 of file Geometry.h.

Constructor & Destructor Documentation

◆ Geometry()

biorbd::muscles::Geometry::Geometry ( const biorbd::utils::Vector3d origin,
const biorbd::utils::Vector3d insertion 
)

Construct geometry.

Parameters
originThe origin node of the muscle
insertionThe insertion node of the muscle

Definition at line 38 of file Geometry.cpp.

Member Function Documentation

◆ _updateKinematics()

void biorbd::muscles::Geometry::_updateKinematics ( const biorbd::rigidbody::GeneralizedVelocity Qdot,
const biorbd::muscles::Characteristics characteristics = nullptr,
biorbd::muscles::PathModifiers pathModifiers = nullptr 
)
protected

Actual function that implements the update of the kinematics.

Parameters
QdotThe generalized velocities
characteristicsThe muscle characteristics
pathModifiersThe set of path modifiers

Definition at line 269 of file Geometry.cpp.

◆ DeepCopy() [1/2]

biorbd::muscles::Geometry biorbd::muscles::Geometry::DeepCopy ( ) const

Deep copy of a geometry.

Returns
A deep copy of a geometry

Definition at line 60 of file Geometry.cpp.

◆ DeepCopy() [2/2]

void biorbd::muscles::Geometry::DeepCopy ( const biorbd::muscles::Geometry other)

Deep copy of a geometry from another geometry.

Parameters
otherThe geometry to copy

Definition at line 67 of file Geometry.cpp.

◆ insertionInGlobal() [1/2]

const biorbd::utils::Vector3d & biorbd::muscles::Geometry::insertionInGlobal ( ) const

Return the insertion position in the global reference.

Returns
The insertion position in the global reference

Geometry (updateKin) must be computed at least once before calling

Definition at line 211 of file Geometry.cpp.

◆ insertionInGlobal() [2/2]

const biorbd::utils::Vector3d & biorbd::muscles::Geometry::insertionInGlobal ( biorbd::rigidbody::Joints model,
const biorbd::rigidbody::GeneralizedCoordinates Q 
)
protected

Updates the kinematics and return the position of the insertion node.

Parameters
modelThe joint model
QThe generalized coordinates of the model
Returns
The origin position in the global reference

Definition at line 297 of file Geometry.cpp.

◆ insertionInLocal()

const biorbd::utils::Vector3d & biorbd::muscles::Geometry::insertionInLocal ( ) const

Return the insertion position.

Returns
The insertion position

Definition at line 200 of file Geometry.cpp.

◆ jacobian() [1/4]

const biorbd::utils::Matrix & biorbd::muscles::Geometry::jacobian ( ) const

Return the previously computed muscle jacobian.

Returns
The muscle jacobian

Definition at line 240 of file Geometry.cpp.

◆ jacobian() [2/4]

void biorbd::muscles::Geometry::jacobian ( biorbd::rigidbody::Joints model,
const biorbd::rigidbody::GeneralizedCoordinates Q 
)
protected

Compute the jacobian.

Parameters
modelThe joint model
QThe generalize coordinates

Definition at line 445 of file Geometry.cpp.

◆ jacobian() [3/4]

void biorbd::muscles::Geometry::jacobian ( const biorbd::utils::Matrix jaco)
protected

Force a jacobian computed from the user.

Parameters
jacoThe jacobian

Definition at line 439 of file Geometry.cpp.

◆ jacobian() [4/4]

biorbd::utils::Matrix biorbd::muscles::Geometry::jacobian ( unsigned int  idxViaPoint) const

Return the gradient of the jacobian for the via specified node.

idxViaPoint the index of the via point (0 being the the origin)

Returns
The via point's node jacobian

Definition at line 255 of file Geometry.cpp.

◆ jacobianInsertion()

biorbd::utils::Matrix biorbd::muscles::Geometry::jacobianInsertion ( ) const

Return the gradient of the jacobian for the insertion node.

Returns
The insertion's node jacobian

Definition at line 250 of file Geometry.cpp.

◆ jacobianLength()

const biorbd::utils::Matrix & biorbd::muscles::Geometry::jacobianLength ( ) const

Return the jacobian length of the muscle.

Returns
The jacobian length

Definition at line 261 of file Geometry.cpp.

◆ jacobianOrigin()

biorbd::utils::Matrix biorbd::muscles::Geometry::jacobianOrigin ( ) const

Return the gradient of the jacobian for the origin node.

Returns
The origin's node jacobian

Definition at line 245 of file Geometry.cpp.

◆ length() [1/2]

const biorbd::utils::Scalar & biorbd::muscles::Geometry::length ( ) const

Return the previously computed muscle length.

Returns
The muscle lengh

Definition at line 223 of file Geometry.cpp.

◆ length() [2/2]

const biorbd::utils::Scalar & biorbd::muscles::Geometry::length ( const biorbd::muscles::Characteristics characteristics = nullptr,
biorbd::muscles::PathModifiers pathModifiers = nullptr 
)
protected

Update the kinematics, compute and return the muscle length.

Parameters
characteristicsThe muscle characteristics
pathModifiersThe set of path modifiers
Returns
The muscle length

Definition at line 389 of file Geometry.cpp.

◆ musclesPointsInGlobal()

const std::vector< biorbd::utils::Vector3d > & biorbd::muscles::Geometry::musclesPointsInGlobal ( ) const

Return the muscles points in the global reference.

Returns
The muscle points in the global reference

Geometry (updateKin) must be computed at least once before calling. Return already computed via points

Definition at line 216 of file Geometry.cpp.

◆ musculoTendonLength()

const biorbd::utils::Scalar & biorbd::muscles::Geometry::musculoTendonLength ( ) const

Return the previously computed muscle-tendon length.

Returns
The muscle-tendon length

Definition at line 228 of file Geometry.cpp.

◆ originInGlobal() [1/2]

const biorbd::utils::Vector3d & biorbd::muscles::Geometry::originInGlobal ( ) const

Return the origin position in the global reference.

Returns
The origin position in the global reference

Geometry (updateKin) must be computed at least once before calling originInLocal()

Definition at line 206 of file Geometry.cpp.

◆ originInGlobal() [2/2]

const biorbd::utils::Vector3d & biorbd::muscles::Geometry::originInGlobal ( biorbd::rigidbody::Joints model,
const biorbd::rigidbody::GeneralizedCoordinates Q 
)
protected

Updates the kinematics and return the position of the origin node.

Parameters
modelThe joint model
QThe generalized coordinates of the model
Returns
The origin position in the global reference

Definition at line 288 of file Geometry.cpp.

◆ originInLocal()

const biorbd::utils::Vector3d & biorbd::muscles::Geometry::originInLocal ( ) const

Return the origin position.

Returns
The origin position

Definition at line 190 of file Geometry.cpp.

◆ setInsertionInLocal()

void biorbd::muscles::Geometry::setInsertionInLocal ( const biorbd::utils::Vector3d position)

Set the insertion position.

Parameters
positionThe insertion position value to set

Definition at line 195 of file Geometry.cpp.

◆ setJacobianDimension()

void biorbd::muscles::Geometry::setJacobianDimension ( biorbd::rigidbody::Joints model)
protected

Set the jacobian dimensions.

Parameters
modelThe joint model

Definition at line 433 of file Geometry.cpp.

◆ setMusclesPointsInGlobal() [1/2]

void biorbd::muscles::Geometry::setMusclesPointsInGlobal ( biorbd::rigidbody::Joints model,
const biorbd::rigidbody::GeneralizedCoordinates Q,
biorbd::muscles::PathModifiers pathModifiers = nullptr 
)
protected

Set the muscle points in global.

Parameters
modelThe joint model
QThe generalized coordinates of the model
pathModifiersThe set of path modifiers

Definition at line 314 of file Geometry.cpp.

◆ setMusclesPointsInGlobal() [2/2]

void biorbd::muscles::Geometry::setMusclesPointsInGlobal ( std::vector< biorbd::utils::Vector3d > &  ptsInGlobal)
protected

Set the muscle points in global.

Parameters
ptsInGlobalThe new muscle points in global

Definition at line 306 of file Geometry.cpp.

◆ setOrigin()

void biorbd::muscles::Geometry::setOrigin ( const biorbd::utils::Vector3d position)

Set the origin position in the local reference frame of the muscle.

Parameters
positionThe origin position to set

Definition at line 185 of file Geometry.cpp.

◆ updateKinematics() [1/4]

void biorbd::muscles::Geometry::updateKinematics ( biorbd::rigidbody::Joints model,
const biorbd::muscles::Characteristics characteristics,
biorbd::muscles::PathModifiers pathModifiers,
const biorbd::rigidbody::GeneralizedCoordinates Q = nullptr,
const biorbd::rigidbody::GeneralizedVelocity Qdot = nullptr,
int  updateKin = 2 
)

Updates the position and dynamic elements of the muscles.

Parameters
modelThe joint model
characteristicsThe muscle characteristics
pathModifiersThe path modifiers
QThe generalized coordinates of the joints (not needed if updateKin is less than 2)
QdotThe generalized velocities of the joints (not needed if updateKin is less than 2)
updateKinUpdate kinematics (0: don't update, 1:only muscles, [2: both kinematics and muscles])

updateKinematics MUST be called before retreiving data that are dependent on Q and/or Qdot

Definition at line 120 of file Geometry.cpp.

◆ updateKinematics() [2/4]

void biorbd::muscles::Geometry::updateKinematics ( biorbd::rigidbody::Joints model,
const biorbd::rigidbody::GeneralizedCoordinates Q = nullptr,
const biorbd::rigidbody::GeneralizedVelocity Qdot = nullptr,
int  updateKin = 2 
)

Updates the position and dynamic elements of the muscles.

Parameters
modelThe joint model
QThe generalized coordinates of the joints (not needed if updateKin is less than 2)
QdotThe generalized velocities of the joints (not needed if updateKin is less than 2)
updateKinUpdate kinematics (0: don't update, 1:only muscles, [2: both kinematics and muscles])

updateKinematics MUST be called before retreiving data that are dependent on Q and/or Qdot

Definition at line 92 of file Geometry.cpp.

◆ updateKinematics() [3/4]

void biorbd::muscles::Geometry::updateKinematics ( std::vector< biorbd::utils::Vector3d > &  musclePointsInGlobal,
biorbd::utils::Matrix jacoPointsInGlobal,
const biorbd::muscles::Characteristics characteristics,
const biorbd::rigidbody::GeneralizedVelocity Qdot = nullptr 
)

Updates the position and dynamic elements of the muscles by hand.

Parameters
musclePointsInGlobalPosition of all the points in global
jacoPointsInGlobalPosition of all the Jacobian points in global
characteristicsThe muscle characteristics
QdotThe generalized velocities of the joints

updateKinematics MUST be called before retreiving data that are dependent on Q and/or Qdot

Definition at line 166 of file Geometry.cpp.

◆ updateKinematics() [4/4]

void biorbd::muscles::Geometry::updateKinematics ( std::vector< biorbd::utils::Vector3d > &  musclePointsInGlobal,
biorbd::utils::Matrix jacoPointsInGlobal,
const biorbd::rigidbody::GeneralizedVelocity Qdot = nullptr 
)

Updates the position and dynamic elements of the muscles by hand.

Parameters
musclePointsInGlobalPosition of all the points in global
jacoPointsInGlobalPosition of all the Jacobian points in global
QdotThe generalized velocities of the joints

updateKinematics MUST be called before retreiving data that are dependent on Q and/or Qdot

Definition at line 149 of file Geometry.cpp.

◆ velocity() [1/2]

const biorbd::utils::Scalar & biorbd::muscles::Geometry::velocity ( ) const

Return the previously computed velocity.

Returns
The computed velocity

Definition at line 233 of file Geometry.cpp.

◆ velocity() [2/2]

const biorbd::utils::Scalar & biorbd::muscles::Geometry::velocity ( const biorbd::rigidbody::GeneralizedVelocity Qdot)
protected

Update the kinematics, compute and return the muscle velocity assuming not via points nor wrapping objects.

Parameters
QdotThe generalized velocities
Returns
The muscle velocity

Definition at line 425 of file Geometry.cpp.


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