Biorbd
Public Member Functions | Static Public Member Functions | Protected Member Functions | List of all members
biorbd::utils::RotoTrans Class Reference

Homogenous matrix to describe translations and rotations simultaneously. More...

#include <RotoTrans.h>

Inheritance diagram for biorbd::utils::RotoTrans:
biorbd::utils::RotoTransNode biorbd::rigidbody::IMU

Public Member Functions

 RotoTrans (const RigidBodyDynamics::Math::Matrix4d &matrix=RigidBodyDynamics::Math::Matrix4d::Identity())
 Construct RotoTrans matrix. More...
 
 RotoTrans (const biorbd::utils::Scalar &v00, const biorbd::utils::Scalar &v01, const biorbd::utils::Scalar &v02, const biorbd::utils::Scalar &v03, const biorbd::utils::Scalar &v10, const biorbd::utils::Scalar &v11, const biorbd::utils::Scalar &v12, const biorbd::utils::Scalar &v13, const biorbd::utils::Scalar &v20, const biorbd::utils::Scalar &v21, const biorbd::utils::Scalar &v22, const biorbd::utils::Scalar &v23, const biorbd::utils::Scalar &v30, const biorbd::utils::Scalar &v31, const biorbd::utils::Scalar &v32, const biorbd::utils::Scalar &v33)
 RotoTrans Construct a RotoTrans matrix by elements. More...
 
 RotoTrans (const biorbd::utils::Rotation &rot)
 Contruct Rototrans. More...
 
 RotoTrans (const biorbd::utils::Rotation &rot, const biorbd::utils::Vector3d &trans)
 Contruct Rototrans. More...
 
 RotoTrans (const biorbd::utils::Vector &rotation, const biorbd::utils::Vector3d &translation, const biorbd::utils::String &rotationSequence)
 Contruct Rototrans. More...
 
 RotoTrans (const RigidBodyDynamics::Math::SpatialTransform &st)
 Contruct Rototrans. More...
 
biorbd::utils::Vector3d axe (unsigned int idx) const
 Get a particular axis of the rotation matrix. More...
 
biorbd::utils::RotoTrans transpose () const
 Return the tranposed matrix. More...
 
biorbd::utils::Vector3d trans () const
 Return the translation vector. More...
 
biorbd::utils::Rotation rot () const
 Return the rotation matrix. More...
 

Static Public Member Functions

static biorbd::utils::RotoTrans fromMarkers (const biorbd::rigidbody::NodeSegment &origin, const std::pair< biorbd::rigidbody::NodeSegment, biorbd::rigidbody::NodeSegment > &axis1markers, const std::pair< biorbd::rigidbody::NodeSegment, biorbd::rigidbody::NodeSegment > &axis2markers, const std::pair< biorbd::utils::String, biorbd::utils::String > &axesNames, const biorbd::utils::String &axisToRecalculate)
 fromMarkers Creates a system of axes from two axes and an origin defined by markers More...
 
static biorbd::utils::RotoTrans combineRotAndTrans (const biorbd::utils::Rotation &rot, const biorbd::utils::Vector3d &trans)
 Set the RotoTrans from a rotation and a translation. More...
 
static biorbd::utils::RotoTrans fromSpatialTransform (const RigidBodyDynamics::Math::SpatialTransform &st)
 set the RotoTrans from a spatial transform More...
 
static biorbd::utils::RotoTrans fromEulerAngles (const biorbd::utils::Vector &rot, const biorbd::utils::Vector3d &trans, const biorbd::utils::String &seq)
 Create a RotoTrans from Euler angles. More...
 
static biorbd::utils::Vector toEulerAngles (const biorbd::utils::RotoTrans &rt, const biorbd::utils::String &seq)
 Return extracted angles from the rotation matrix into Euler angles using the provided sequence. More...
 
static biorbd::utils::RotoTrans mean (const std::vector< biorbd::utils::RotoTrans > &rt)
 Get the mean of the 4x4 matrices. More...
 

Protected Member Functions

RigidBodyDynamics::Math::Vector4d expand3dTo4d (const biorbd::utils::Vector3d &v1)
 Expand 3D vector to 4D (padding with an extra 1) More...
 
void checkUnitary ()
 Check if the RotoTrans has a unitary matrix of rotation and the last row is (0, 0, 0, 1) More...
 

Detailed Description

Homogenous matrix to describe translations and rotations simultaneously.

Definition at line 32 of file RotoTrans.h.

Constructor & Destructor Documentation

◆ RotoTrans() [1/6]

biorbd::utils::RotoTrans::RotoTrans ( const RigidBodyDynamics::Math::Matrix4d &  matrix = RigidBodyDynamics::Math::Matrix4d::Identity())

Construct RotoTrans matrix.

Parameters
matrix4D identity matrix

Definition at line 12 of file RotoTrans.cpp.

◆ RotoTrans() [2/6]

biorbd::utils::RotoTrans::RotoTrans ( const biorbd::utils::Scalar &  v00,
const biorbd::utils::Scalar &  v01,
const biorbd::utils::Scalar &  v02,
const biorbd::utils::Scalar &  v03,
const biorbd::utils::Scalar &  v10,
const biorbd::utils::Scalar &  v11,
const biorbd::utils::Scalar &  v12,
const biorbd::utils::Scalar &  v13,
const biorbd::utils::Scalar &  v20,
const biorbd::utils::Scalar &  v21,
const biorbd::utils::Scalar &  v22,
const biorbd::utils::Scalar &  v23,
const biorbd::utils::Scalar &  v30,
const biorbd::utils::Scalar &  v31,
const biorbd::utils::Scalar &  v32,
const biorbd::utils::Scalar &  v33 
)

RotoTrans Construct a RotoTrans matrix by elements.

Parameters
v00Row 0, Col 0
v01Row 0, Col 1
v02Row 0, Col 2
v03Row 0, Col 3
v10Row 1, Col 0
v11Row 1, Col 1
v12Row 1, Col 2
v13Row 1, Col 3
v20Row 2, Col 0
v21Row 2, Col 1
v22Row 2, Col 2
v23Row 2, Col 3
v30Row 3, Col 0
v31Row 3, Col 1
v32Row 3, Col 2
v33Row 3, Col 3

Definition at line 19 of file RotoTrans.cpp.

◆ RotoTrans() [3/6]

biorbd::utils::RotoTrans::RotoTrans ( const biorbd::utils::Rotation rot)

Contruct Rototrans.

Parameters
rotThe rotation matrix

Definition at line 32 of file RotoTrans.cpp.

◆ RotoTrans() [4/6]

biorbd::utils::RotoTrans::RotoTrans ( const biorbd::utils::Rotation rot,
const biorbd::utils::Vector3d trans 
)

Contruct Rototrans.

Parameters
rotThe rotation matrix
transTranslation vector

Definition at line 39 of file RotoTrans.cpp.

◆ RotoTrans() [5/6]

biorbd::utils::RotoTrans::RotoTrans ( const biorbd::utils::Vector rotation,
const biorbd::utils::Vector3d translation,
const biorbd::utils::String rotationSequence 
)

Contruct Rototrans.

Parameters
rotationThe Euler angles vector
translationThe translation vector
rotationSequenceThe rotation sequence

The number of rotation must match the number of axes in the rotation sequence

Definition at line 47 of file RotoTrans.cpp.

◆ RotoTrans() [6/6]

biorbd::utils::RotoTrans::RotoTrans ( const RigidBodyDynamics::Math::SpatialTransform &  st)

Contruct Rototrans.

Parameters
stSpatial Transform vector

Definition at line 56 of file RotoTrans.cpp.

Member Function Documentation

◆ axe()

biorbd::utils::Vector3d biorbd::utils::RotoTrans::axe ( unsigned int  idx) const

Get a particular axis of the rotation matrix.

Parameters
idxThe index of axis (x = 0, y = 1 and z = 2)
Returns
The axis

Definition at line 76 of file RotoTrans.cpp.

◆ checkUnitary()

void biorbd::utils::RotoTrans::checkUnitary ( )
protected

Check if the RotoTrans has a unitary matrix of rotation and the last row is (0, 0, 0, 1)

That function throws a runtime_error if the check fails

Definition at line 169 of file RotoTrans.cpp.

◆ combineRotAndTrans()

biorbd::utils::RotoTrans biorbd::utils::RotoTrans::combineRotAndTrans ( const biorbd::utils::Rotation rot,
const biorbd::utils::Vector3d trans 
)
static

Set the RotoTrans from a rotation and a translation.

Parameters
rotThe matrix of rotation
transThe vector of translation
Returns
The matrix of RotoTrans

Definition at line 102 of file RotoTrans.cpp.

◆ expand3dTo4d()

RigidBodyDynamics::Math::Vector4d biorbd::utils::RotoTrans::expand3dTo4d ( const biorbd::utils::Vector3d v1)
protected

Expand 3D vector to 4D (padding with an extra 1)

Parameters
v1Vector to expand

Definition at line 161 of file RotoTrans.cpp.

◆ fromEulerAngles()

biorbd::utils::RotoTrans biorbd::utils::RotoTrans::fromEulerAngles ( const biorbd::utils::Vector rot,
const biorbd::utils::Vector3d trans,
const biorbd::utils::String seq 
)
static

Create a RotoTrans from Euler angles.

Parameters
rotThe Euler angles vector
transThe translation vector
seqThe rotation sequence

The number of rotation umust match the number of axes in the rotation sequence

Definition at line 118 of file RotoTrans.cpp.

◆ fromMarkers()

biorbd::utils::RotoTrans biorbd::utils::RotoTrans::fromMarkers ( const biorbd::rigidbody::NodeSegment origin,
const std::pair< biorbd::rigidbody::NodeSegment, biorbd::rigidbody::NodeSegment > &  axis1markers,
const std::pair< biorbd::rigidbody::NodeSegment, biorbd::rigidbody::NodeSegment > &  axis2markers,
const std::pair< biorbd::utils::String, biorbd::utils::String > &  axesNames,
const biorbd::utils::String axisToRecalculate 
)
static

fromMarkers Creates a system of axes from two axes and an origin defined by markers

Parameters
originThe position of the origin
axis1markersThe beginning and ending of the vector of the first axis
axis2markersThe beginning and ending of the vector of the second axis
axesNamesThe names ("x", "y" or "z") of the axes
axisToRecalculateThe axis to recalculate to ensure orthonormal system of axes
Returns
The system of axes

Definition at line 63 of file RotoTrans.cpp.

◆ fromSpatialTransform()

biorbd::utils::RotoTrans biorbd::utils::RotoTrans::fromSpatialTransform ( const RigidBodyDynamics::Math::SpatialTransform &  st)
static

set the RotoTrans from a spatial transform

Parameters
stThe spatial transform
Returns
The matrix of RotoTrans

Definition at line 112 of file RotoTrans.cpp.

◆ mean()

biorbd::utils::RotoTrans biorbd::utils::RotoTrans::mean ( const std::vector< biorbd::utils::RotoTrans > &  rt)
static

Get the mean of the 4x4 matrices.

Parameters
rtThe RotoTrans matrices to mean
Returns
The mean RotoTrans

Definition at line 140 of file RotoTrans.cpp.

◆ rot()

biorbd::utils::Rotation biorbd::utils::RotoTrans::rot ( ) const

Return the rotation matrix.

Returns
The rotation matrix

Definition at line 97 of file RotoTrans.cpp.

◆ toEulerAngles()

biorbd::utils::Vector biorbd::utils::RotoTrans::toEulerAngles ( const biorbd::utils::RotoTrans rt,
const biorbd::utils::String seq 
)
static

Return extracted angles from the rotation matrix into Euler angles using the provided sequence.

Parameters
rtThe RotoTrans matrix to extract angles from
seqThe angle sequence
Returns
The angles (the length of the vector will match the length of sequence)

The rotation sequence can be any combination of x, y and z

Definition at line 132 of file RotoTrans.cpp.

◆ trans()

biorbd::utils::Vector3d biorbd::utils::RotoTrans::trans ( ) const

Return the translation vector.

Returns
The translation vector

Definition at line 92 of file RotoTrans.cpp.

◆ transpose()

biorbd::utils::RotoTrans biorbd::utils::RotoTrans::transpose ( ) const

Return the tranposed matrix.

Returns
The transposed matrix

Definition at line 83 of file RotoTrans.cpp.


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