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

Rotation matrix. More...

#include <Rotation.h>

Inheritance diagram for biorbd::utils::Rotation:

Public Member Functions

 Rotation (const RigidBodyDynamics::Math::Matrix3d &matrix=RigidBodyDynamics::Math::Matrix3d::Identity())
 Construct Rotation matrix. More...
 
 Rotation (const biorbd::utils::Scalar &v00, const biorbd::utils::Scalar &v01, const biorbd::utils::Scalar &v02, const biorbd::utils::Scalar &v10, const biorbd::utils::Scalar &v11, const biorbd::utils::Scalar &v12, const biorbd::utils::Scalar &v20, const biorbd::utils::Scalar &v21, const biorbd::utils::Scalar &v22)
 Rotation Construct a Rotation matrix by elements. More...
 
 Rotation (const biorbd::utils::Vector &rotation, const biorbd::utils::String &rotationSequence)
 Contruct a Rotation matrix. More...
 
 Rotation (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...
 

Static Public Member Functions

static biorbd::utils::Rotation fromSpatialTransform (const RigidBodyDynamics::Math::SpatialTransform &st)
 set the Rotation from a spatial transform More...
 
static biorbd::utils::Rotation fromEulerAngles (const biorbd::utils::Vector &rot, const biorbd::utils::String &seq)
 Create a Rotation from Euler angles. More...
 
static biorbd::utils::Matrix fromMarkersNonNormalized (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 defined by markers More...
 
static biorbd::utils::Rotation fromMarkers (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 defined by markers More...
 
static biorbd::utils::Vector toEulerAngles (const biorbd::utils::Rotation &r, const biorbd::utils::String &seq)
 Return extracted angles from the rotation matrix into Euler angles using the provided sequence. More...
 
static biorbd::utils::Rotation mean (const std::vector< biorbd::utils::Rotation > &mToMean)
 Get the mean of the Rotation matrices. More...
 

Protected Member Functions

void checkUnitary ()
 Check if the Rotation is a unitary matrix of rotation. More...
 

Detailed Description

Rotation matrix.

Definition at line 32 of file Rotation.h.

Constructor & Destructor Documentation

◆ Rotation() [1/4]

biorbd::utils::Rotation::Rotation ( const RigidBodyDynamics::Math::Matrix3d &  matrix = RigidBodyDynamics::Math::Matrix3d::Identity())

Construct Rotation matrix.

Parameters
matrix3D identity matrix

Definition at line 12 of file Rotation.cpp.

◆ Rotation() [2/4]

biorbd::utils::Rotation::Rotation ( const biorbd::utils::Scalar &  v00,
const biorbd::utils::Scalar &  v01,
const biorbd::utils::Scalar &  v02,
const biorbd::utils::Scalar &  v10,
const biorbd::utils::Scalar &  v11,
const biorbd::utils::Scalar &  v12,
const biorbd::utils::Scalar &  v20,
const biorbd::utils::Scalar &  v21,
const biorbd::utils::Scalar &  v22 
)

Rotation Construct a Rotation matrix by elements.

Parameters
v00Row 0, Col 0
v01Row 0, Col 1
v02Row 0, Col 2
v10Row 1, Col 0
v11Row 1, Col 1
v12Row 1, Col 2
v20Row 2, Col 0
v21Row 2, Col 1
v22Row 2, Col 2

Definition at line 30 of file Rotation.cpp.

◆ Rotation() [3/4]

biorbd::utils::Rotation::Rotation ( const biorbd::utils::Vector rotation,
const biorbd::utils::String rotationSequence 
)

Contruct a Rotation matrix.

Parameters
rotationThe Euler angles vector
rotationSequenceThe rotation sequence

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

Definition at line 39 of file Rotation.cpp.

◆ Rotation() [4/4]

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

Contruct Rototrans.

Parameters
stSpatial Transform vector

Definition at line 47 of file Rotation.cpp.

Member Function Documentation

◆ axe()

biorbd::utils::Vector3d biorbd::utils::Rotation::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 54 of file Rotation.cpp.

◆ checkUnitary()

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

Check if the Rotation is a unitary matrix of rotation.

That function throws a runtime_error if the check fails

Definition at line 316 of file Rotation.cpp.

◆ fromEulerAngles()

biorbd::utils::Rotation biorbd::utils::Rotation::fromEulerAngles ( const biorbd::utils::Vector rot,
const biorbd::utils::String seq 
)
static

Create a Rotation from Euler angles.

Parameters
rotThe Euler angles vector
seqThe rotation sequence

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

Definition at line 66 of file Rotation.cpp.

◆ fromMarkers()

biorbd::utils::Rotation biorbd::utils::Rotation::fromMarkers ( 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 defined by markers

Parameters
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 179 of file Rotation.cpp.

◆ fromMarkersNonNormalized()

biorbd::utils::Matrix biorbd::utils::Rotation::fromMarkersNonNormalized ( 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 defined by markers

Parameters
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 104 of file Rotation.cpp.

◆ fromSpatialTransform()

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

set the Rotation from a spatial transform

Parameters
stThe spatial transform
Returns
The matrix of Rotation

Definition at line 60 of file Rotation.cpp.

◆ mean()

biorbd::utils::Rotation biorbd::utils::Rotation::mean ( const std::vector< biorbd::utils::Rotation > &  mToMean)
static

Get the mean of the Rotation matrices.

Parameters
mToMeanThe Rotation matrices to mean
Returns
The mean Rotation matrix

Definition at line 293 of file Rotation.cpp.

◆ toEulerAngles()

biorbd::utils::Vector biorbd::utils::Rotation::toEulerAngles ( const biorbd::utils::Rotation r,
const biorbd::utils::String seq 
)
static

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

Parameters
rThe Rotation 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 197 of file Rotation.cpp.


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