Ocean
Ocean::EulerT< T > Class Template Reference

This class implements an euler rotation with angles: yaw, pitch and roll. More...

Public Types

typedef T Type
 Definition of the used data type. More...
 

Public Member Functions

 EulerT ()
 Creates a new Euler rotation with all angles zero. More...
 
 EulerT (const T yaw, const T pitch, const T roll)
 Creates a new euler rotation by given angles. More...
 
 EulerT (const T *arrayValue)
 Creates a new euler rotation by an array of angles. More...
 
 EulerT (const HomogenousMatrixT4< T > &transformation)
 Creates a new euler rotation by a given homogeneous transformation. More...
 
 EulerT (const RotationT< T > &rotation)
 Creates a new euler rotation by a given angle-axis rotation. More...
 
 EulerT (const QuaternionT< T > &quaternion)
 Creates a new euler rotation by a given quaternion rotation. More...
 
 EulerT (const SquareMatrixT3< T > &matrix)
 Creates a new euler rotation by a given 3x3 matrix rotation. More...
 
const T & yaw () const
 Returns the yaw angle. More...
 
T & yaw ()
 Returns the yaw angle. More...
 
const T & pitch () const
 Returns the pitch angle. More...
 
T & pitch ()
 Returns the pitch angle. More...
 
const T & roll () const
 Returns the roll angle. More...
 
T & roll ()
 Returns the roll angle. More...
 
bool isValid () const
 Returns whether the euler rotation holds valid parameters. More...
 
bool operator== (const EulerT< T > &euler) const
 Returns whether two euler rotations are identical up to a small epsilon. More...
 
bool operator!= (const EulerT< T > &euler) const
 Returns whether two euler rotations are not identical up to a small epsilon. More...
 
const T & operator[] (const unsigned int index) const
 Element access operator. More...
 
T & operator[] (const unsigned int index)
 Element access operator. More...
 
const T & operator() (const unsigned int index) const
 Element access operator. More...
 
T & operator() (const unsigned int index)
 Element access operator. More...
 
const T * operator() () const
 Access operator. More...
 
T * operator() ()
 Access operator. More...
 

Static Public Member Functions

static void decomposeRotationMatrixToYXZ (const SquareMatrixT3< T > &matrix, T &yAngle, T &xAngle, T &zAngle)
 Decomposes a 3x3 rotation matrix to the corresponding yaw, pitch and roll angles as defined by the euler class. More...
 
static void decomposeRotationMatrixToXYZ (const SquareMatrixT3< T > &matrix, T &xAngle, T &yAngle, T &zAngle)
 Decomposes a 3x3 rotation matrix to the corresponding x, y and z angles. More...
 
static void adjustAngles (T &yaw, T &pitch, T &roll)
 Adjusts euler angles with arbitrary value (e.g., outside the valid value range) to euler angles within the value range of a valid Euler object. More...
 

Protected Attributes

values_ [3]
 The three angles of the euler rotation. More...
 

Detailed Description

template<typename T>
class Ocean::EulerT< T >

This class implements an euler rotation with angles: yaw, pitch and roll.

The yaw angle is defined about the positive y-axis with range [-Pi, Pi].
The pitch angle is defined about the positive x-axis with range [-Pi/2, Pi/2].
The roll angle is defined about the positive z-axis with range [-Pi, Pi].
The entire rotation can be written as matrix product: Ry(yaw) * Rx(pitch) * Rz(roll).
All angles are defined in radian.

Template Parameters
TData type of angle values_
See also
Euler, EulerF, EulerD, Rotation, Quaternion, SquareMatrix3, ExponentialMap.

Member Typedef Documentation

◆ Type

template<typename T >
typedef T Ocean::EulerT< T >::Type

Definition of the used data type.

Constructor & Destructor Documentation

◆ EulerT() [1/7]

template<typename T >
Ocean::EulerT< T >::EulerT

Creates a new Euler rotation with all angles zero.

◆ EulerT() [2/7]

template<typename T >
Ocean::EulerT< T >::EulerT ( const T  yaw,
const T  pitch,
const T  roll 
)

Creates a new euler rotation by given angles.

Parameters
yawThe yaw angle with range [-Pi, Pi]
pitchThe pitch angle with range [-Pi/2, Pi/2]
rollThe roll angle with range [-Pi, Pi]

◆ EulerT() [3/7]

template<typename T >
Ocean::EulerT< T >::EulerT ( const T *  arrayValue)
explicit

Creates a new euler rotation by an array of angles.

Parameters
arrayValueArray with three angles, with order yaw, pitch, roll, must be valid

◆ EulerT() [4/7]

template<typename T >
Ocean::EulerT< T >::EulerT ( const HomogenousMatrixT4< T > &  transformation)
explicit

Creates a new euler rotation by a given homogeneous transformation.

Parameters
transformationThe homogeneous transformation to create a euler rotation from

◆ EulerT() [5/7]

template<typename T >
Ocean::EulerT< T >::EulerT ( const RotationT< T > &  rotation)
explicit

Creates a new euler rotation by a given angle-axis rotation.

Parameters
rotationAngle-axis rotation to create a euler rotation from

◆ EulerT() [6/7]

template<typename T >
Ocean::EulerT< T >::EulerT ( const QuaternionT< T > &  quaternion)
explicit

Creates a new euler rotation by a given quaternion rotation.

Parameters
quaternionThe quaternion rotation to create a euler rotation from

◆ EulerT() [7/7]

template<typename T >
Ocean::EulerT< T >::EulerT ( const SquareMatrixT3< T > &  matrix)
explicit

Creates a new euler rotation by a given 3x3 matrix rotation.

Parameters
matrixThe rotation matrix to create a euler rotation from

Member Function Documentation

◆ adjustAngles()

template<typename T >
void Ocean::EulerT< T >::adjustAngles ( T &  yaw,
T &  pitch,
T &  roll 
)
static

Adjusts euler angles with arbitrary value (e.g., outside the valid value range) to euler angles within the value range of a valid Euler object.

Parameters
yawThe yaw angle to be adjusted, in radian, afterwards will be in the value range of [-PI, PI], with range (-infinity, infinity)
pitchThe pitch angle to be adjusted, in radian, afterwards will be in the value range of [-PI/2, PI/2], with range (-infinity, infinity)
rollThe roll angle to be adjusted, in radian, afterwards will be in the value range of [-PI, PI], with range (-infinity, infinity)

◆ decomposeRotationMatrixToXYZ()

template<typename T >
void Ocean::EulerT< T >::decomposeRotationMatrixToXYZ ( const SquareMatrixT3< T > &  matrix,
T &  xAngle,
T &  yAngle,
T &  zAngle 
)
static

Decomposes a 3x3 rotation matrix to the corresponding x, y and z angles.

The provided rotation matrix can be recreated by the matrix product: Rx(xAngle) * Ry(yAngle) * Rz(zAngle).

Parameters
matrixThe 3x3 square matrix to decompose, must be an orthonormal rotation matrix
xAngleThe resulting x angle (rotation around the x-axis), with range [-PI, PI]
yAngleThe resulting y angle (rotation around the y-axis), with range [-PI/2, PI/2]
zAngleThe resulting z angle (rotation around the z-axis), with range [-PI, PI]

Combined rotation matrix for R(x)R(y)R(z) [ cy cz -cy sz sy ] [ cx sz + sx sy cz cx cz - sx sy sz -sx cy ] [ sx sz - cx sy cz sx cz + cx sy sz cx cy ]

Combined rotation matrix for R(x)R(y)R(z), with sy == -1 and cy == 0 [ 0 0 1 ] [ 0 0 1 ] [ cx sz - sx cz cx cz + sx sz 0 ] = [ -sin(x - z) cos(x - z) 0 ] [ sx sz + cx cz sx cz - cx sz 0 ] [ cos(x - z) sin(x - z) 0 ]

Combined rotation matrix for R(x)R(y)R(z), with sy == 1 and cy == 0 [ 0 0 1 ] [ 0 0 1 ] [ cx sz + sx cz cx cz - sx sz 0 ] = [ sin(x + z) cos(x + z) 0 ] [ sx sz - cx cz sx cz + cx sz 0 ] [ -cos(x + z) sin(x + z) 0 ]

◆ decomposeRotationMatrixToYXZ()

template<typename T >
void Ocean::EulerT< T >::decomposeRotationMatrixToYXZ ( const SquareMatrixT3< T > &  matrix,
T &  yAngle,
T &  xAngle,
T &  zAngle 
)
static

Decomposes a 3x3 rotation matrix to the corresponding yaw, pitch and roll angles as defined by the euler class.

The provided rotation matrix can be recreated by the matrix product: Ry(yAngle) * Rx(xAngle) * Rz(zAngle).

Parameters
matrixThe 3x3 square matrix to decompose, must be an orthonormal rotation matrix
yAngleThe resulting (yaw) angle (rotation around the y-axis), with range [-PI, PI]
xAngleThe resulting (pitch) angle (rotation around the x-axis), with range [-PI/2, PI/2]
zAngleThe resulting (roll) angle (rotation around the z-axis), with range [-PI, PI]

Combined rotation matrix for R(y)R(x)R(z) [ cy cz + sx sy sz cz sx sy - cy sz cx sy ] [ cx sz cx cz -sx ] [ -cz sy + cy sx sz cy cz sx + sy sz cx cy ]

Combined rotation matrix for R(y)R(x)R(z), with sx == -1 and cx == 0 [ cy cz - sy sz - cz sy - cy sz 0 ] [ cos(y + z) -sin(y + z) 0 ] [ 0 0 -1 ] = [ 0 0 -1 ] [ -cz sy - cy sz - cy cz + sy sz 0 ] [ -sin(y + z) -cos(y + z) 0 ]

Combined rotation matrix for R(y)R(x)R(z), with sx == 1 and cx == 0 [ cy cz + sy sz cz sy - cy sz 0 ] [ cos(y - z) sin(y - z) 0 ] [ 0 0 -1 ] = [ 0 0 -1 ] [ -cz sy + cy sz cy cz + sy sz 0 ] [ sin(z - y) cos(y - z) 0 ]

◆ isValid()

template<typename T >
bool Ocean::EulerT< T >::isValid

Returns whether the euler rotation holds valid parameters.

Returns
True, if so

◆ operator!=()

template<typename T >
bool Ocean::EulerT< T >::operator!= ( const EulerT< T > &  euler) const
inline

Returns whether two euler rotations are not identical up to a small epsilon.

Parameters
eulerRight euler rotation
Returns
True, if so

◆ operator()() [1/4]

template<typename T >
T * Ocean::EulerT< T >::operator()
inline

Access operator.

Returns
Pointer to the elements

◆ operator()() [2/4]

template<typename T >
const T * Ocean::EulerT< T >::operator()
inline

Access operator.

Returns
Pointer to the elements

◆ operator()() [3/4]

template<typename T >
T & Ocean::EulerT< T >::operator() ( const unsigned int  index)
inline

Element access operator.

Parameters
indexThe index of the element to access, with range [0, 2]
Returns
Element of the euler rotation

◆ operator()() [4/4]

template<typename T >
const T & Ocean::EulerT< T >::operator() ( const unsigned int  index) const
inline

Element access operator.

Parameters
indexThe index of the element to access, with range [0, 2]
Returns
Element of the euler rotation

◆ operator==()

template<typename T >
bool Ocean::EulerT< T >::operator== ( const EulerT< T > &  euler) const

Returns whether two euler rotations are identical up to a small epsilon.

Parameters
eulerRight euler rotation
Returns
True, if so

◆ operator[]() [1/2]

template<typename T >
T & Ocean::EulerT< T >::operator[] ( const unsigned int  index)
inline

Element access operator.

Parameters
indexThe index of the element to access, with range [0, 2]
Returns
Element of the euler rotation

◆ operator[]() [2/2]

template<typename T >
const T & Ocean::EulerT< T >::operator[] ( const unsigned int  index) const
inline

Element access operator.

Parameters
indexThe index of the element to access, with range [0, 2]
Returns
Element of the euler rotation

◆ pitch() [1/2]

template<typename T >
T & Ocean::EulerT< T >::pitch
inline

Returns the pitch angle.

Returns
Pitch angle in radian

◆ pitch() [2/2]

template<typename T >
const T & Ocean::EulerT< T >::pitch
inline

Returns the pitch angle.

Returns
Pitch angle in radian

◆ roll() [1/2]

template<typename T >
T & Ocean::EulerT< T >::roll
inline

Returns the roll angle.

Returns
Roll angle in radian

◆ roll() [2/2]

template<typename T >
const T & Ocean::EulerT< T >::roll
inline

Returns the roll angle.

Returns
Roll angle in radian

◆ yaw() [1/2]

template<typename T >
T & Ocean::EulerT< T >::yaw
inline

Returns the yaw angle.

Returns
Yaw angle in radian

◆ yaw() [2/2]

template<typename T >
const T & Ocean::EulerT< T >::yaw
inline

Returns the yaw angle.

Returns
Yaw angle in radian

Field Documentation

◆ values_

template<typename T >
T Ocean::EulerT< T >::values_[3]
protected

The three angles of the euler rotation.


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