TR-mbed 1.0
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Static Public Member Functions | Friends | List of all members
Eigen::EulerAngles< _Scalar, _System > Class Template Reference

Represents a rotation in a 3 dimensional space as three Euler angles. More...

#include <EulerAngles.h>

Inheritance diagram for Eigen::EulerAngles< _Scalar, _System >:
Eigen::RotationBase< EulerAngles< _Scalar, _System >, 3 >

Public Types

typedef RotationBase< EulerAngles< _Scalar, _System >, 3 > Base
 
typedef _Scalar Scalar
 
typedef NumTraits< Scalar >::Real RealScalar
 
typedef _System System
 
typedef Matrix< Scalar, 3, 3 > Matrix3
 
typedef Matrix< Scalar, 3, 1 > Vector3
 
typedef Quaternion< ScalarQuaternionType
 
typedef AngleAxis< ScalarAngleAxisType
 
- Public Types inherited from Eigen::RotationBase< EulerAngles< _Scalar, _System >, 3 >
enum  
 
typedef internal::traits< EulerAngles< _Scalar, _System > >::Scalar Scalar
 
typedef Matrix< Scalar, Dim, Dim > RotationMatrixType
 
typedef Matrix< Scalar, Dim, 1 > VectorType
 

Public Member Functions

 EulerAngles ()
 
 EulerAngles (const Scalar &alpha, const Scalar &beta, const Scalar &gamma)
 
 EulerAngles (const Scalar *data)
 
template<typename Derived >
 EulerAngles (const MatrixBase< Derived > &other)
 
template<typename Derived >
 EulerAngles (const RotationBase< Derived, 3 > &rot)
 
const Vector3angles () const
 
Vector3angles ()
 
Scalar alpha () const
 
Scalaralpha ()
 
Scalar beta () const
 
Scalarbeta ()
 
Scalar gamma () const
 
Scalargamma ()
 
EulerAngles inverse () const
 
EulerAngles operator- () const
 
template<class Derived >
EulerAnglesoperator= (const MatrixBase< Derived > &other)
 
template<typename Derived >
EulerAnglesoperator= (const RotationBase< Derived, 3 > &rot)
 
bool isApprox (const EulerAngles &other, const RealScalar &prec=NumTraits< Scalar >::dummy_precision()) const
 
Matrix3 toRotationMatrix () const
 
 operator QuaternionType () const
 
template<typename NewScalarType >
EulerAngles< NewScalarType, Systemcast () const
 
- Public Member Functions inherited from Eigen::RotationBase< EulerAngles< _Scalar, _System >, 3 >
EIGEN_DEVICE_FUNC const EulerAngles< _Scalar, _System > & derived () const
 
EIGEN_DEVICE_FUNC EulerAngles< _Scalar, _System > & derived ()
 
EIGEN_DEVICE_FUNC RotationMatrixType toRotationMatrix () const
 
EIGEN_DEVICE_FUNC RotationMatrixType matrix () const
 
EIGEN_DEVICE_FUNC EulerAngles< _Scalar, _System > inverse () const
 
EIGEN_DEVICE_FUNC Transform< Scalar, Dim, Isometry > operator* (const Translation< Scalar, Dim > &t) const
 
EIGEN_DEVICE_FUNC RotationMatrixType operator* (const UniformScaling< Scalar > &s) const
 
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE internal::rotation_base_generic_product_selector< EulerAngles< _Scalar, _System >, OtherDerived, OtherDerived::IsVectorAtCompileTime >::ReturnType operator* (const EigenBase< OtherDerived > &e) const
 
EIGEN_DEVICE_FUNC Transform< Scalar, Dim, Mode > operator* (const Transform< Scalar, Dim, Mode, Options > &t) const
 
EIGEN_DEVICE_FUNC VectorType _transformVector (const OtherVectorType &v) const
 

Static Public Member Functions

static Vector3 AlphaAxisVector ()
 
static Vector3 BetaAxisVector ()
 
static Vector3 GammaAxisVector ()
 

Friends

std::ostream & operator<< (std::ostream &s, const EulerAngles< Scalar, System > &eulerAngles)
 

Detailed Description

template<typename _Scalar, class _System>
class Eigen::EulerAngles< _Scalar, _System >

Represents a rotation in a 3 dimensional space as three Euler angles.

Euler rotation is a set of three rotation of three angles over three fixed axes, defined by the EulerSystem given as a template parameter.

Here is how intrinsic Euler angles works:

Note
This class support only intrinsic Euler angles for simplicity, see EulerSystem how to easily overcome this for extrinsic systems.

Rotation representation and conversions

It has been proved(see Wikipedia link below) that every rotation can be represented by Euler angles, but there is no single representation (e.g. unlike rotation matrices). Therefore, you can convert from Eigen rotation and to them (including rotation matrices, which is not called "rotations" by Eigen design).

Euler angles usually used for:

However, Euler angles are slow comparing to quaternion or matrices, because their unnatural math definition, although it's simple for human. To overcome this, this class provide easy movement from the math friendly representation to the human friendly representation, and vise-versa.

All the user need to do is a safe simple C++ type conversion, and this class take care for the math. Additionally, some axes related computation is done in compile time.

Euler angles ranges in conversions

Rotations representation as EulerAngles are not single (unlike matrices), and even have infinite EulerAngles representations.
For example, add or subtract 2*PI from either angle of EulerAngles and you'll get the same rotation. This is the general reason for infinite representation, but it's not the only general reason for not having a single representation.

When converting rotation to EulerAngles, this class convert it to specific ranges When converting some rotation to EulerAngles, the rules for ranges are as follow:

See also
EulerAngles(const MatrixBase<Derived>&)
EulerAngles(const RotationBase<Derived, 3>&)

Convenient user typedefs

Convenient typedefs for EulerAngles exist for float and double scalar, in a form of EulerAngles{A}{B}{C}{scalar}, e.g. EulerAnglesXYZd, EulerAnglesZYZf.

Only for positive axes{+x,+y,+z} Euler systems are have convenient typedef. If you need negative axes{-x,-y,-z}, it is recommended to create you own typedef with a word that represent what you need.

Example

Output:

Additional reading

If you're want to get more idea about how Euler system work in Eigen see EulerSystem.

More information about Euler angles: https://en.wikipedia.org/wiki/Euler_angles

Template Parameters
_Scalarthe scalar type, i.e. the type of the angles.
_Systemthe EulerSystem to use, which represents the axes of rotation.

Member Typedef Documentation

◆ AngleAxisType

template<typename _Scalar , class _System >
typedef AngleAxis<Scalar> Eigen::EulerAngles< _Scalar, _System >::AngleAxisType

the equivalent angle-axis type

◆ Base

template<typename _Scalar , class _System >
typedef RotationBase<EulerAngles<_Scalar, _System>, 3> Eigen::EulerAngles< _Scalar, _System >::Base

◆ Matrix3

template<typename _Scalar , class _System >
typedef Matrix<Scalar,3,3> Eigen::EulerAngles< _Scalar, _System >::Matrix3

the equivalent rotation matrix type

◆ QuaternionType

template<typename _Scalar , class _System >
typedef Quaternion<Scalar> Eigen::EulerAngles< _Scalar, _System >::QuaternionType

the equivalent quaternion type

◆ RealScalar

template<typename _Scalar , class _System >
typedef NumTraits<Scalar>::Real Eigen::EulerAngles< _Scalar, _System >::RealScalar

◆ Scalar

template<typename _Scalar , class _System >
typedef _Scalar Eigen::EulerAngles< _Scalar, _System >::Scalar

the scalar type of the angles

◆ System

template<typename _Scalar , class _System >
typedef _System Eigen::EulerAngles< _Scalar, _System >::System

the EulerSystem to use, which represents the axes of rotation.

◆ Vector3

template<typename _Scalar , class _System >
typedef Matrix<Scalar,3,1> Eigen::EulerAngles< _Scalar, _System >::Vector3

the equivalent 3 dimension vector type

Constructor & Destructor Documentation

◆ EulerAngles() [1/5]

template<typename _Scalar , class _System >
Eigen::EulerAngles< _Scalar, _System >::EulerAngles ( )
inline

Default constructor without initialization.

◆ EulerAngles() [2/5]

template<typename _Scalar , class _System >
Eigen::EulerAngles< _Scalar, _System >::EulerAngles ( const Scalar alpha,
const Scalar beta,
const Scalar gamma 
)
inline

Constructs and initialize an EulerAngles (alpha, beta, gamma).

◆ EulerAngles() [3/5]

template<typename _Scalar , class _System >
Eigen::EulerAngles< _Scalar, _System >::EulerAngles ( const Scalar data)
inlineexplicit

Constructs and initialize an EulerAngles from the array data {alpha, beta, gamma}

◆ EulerAngles() [4/5]

template<typename _Scalar , class _System >
template<typename Derived >
Eigen::EulerAngles< _Scalar, _System >::EulerAngles ( const MatrixBase< Derived > &  other)
inlineexplicit

Constructs and initializes an EulerAngles from either:

  • a 3x3 rotation matrix expression(i.e. pure orthogonal matrix with determinant of +1),
  • a 3D vector expression representing Euler angles.
Note
If other is a 3x3 rotation matrix, the angles range rules will be as follow:
Alpha and gamma angles will be in the range [-PI, PI].
As for Beta angle:
  • If the system is Tait-Bryan, the beta angle will be in the range [-PI/2, PI/2].
  • otherwise:
    • If the beta axis is positive, the beta angle will be in the range [0, PI]
    • If the beta axis is negative, the beta angle will be in the range [-PI, 0]

◆ EulerAngles() [5/5]

template<typename _Scalar , class _System >
template<typename Derived >
Eigen::EulerAngles< _Scalar, _System >::EulerAngles ( const RotationBase< Derived, 3 > &  rot)
inline

Constructs and initialize Euler angles from a rotation rot.

Note
If rot is an EulerAngles (even when it represented as RotationBase explicitly), angles ranges are undefined. Otherwise, alpha and gamma angles will be in the range [-PI, PI].
As for Beta angle:
  • If the system is Tait-Bryan, the beta angle will be in the range [-PI/2, PI/2].
  • otherwise:
    • If the beta axis is positive, the beta angle will be in the range [0, PI]
    • If the beta axis is negative, the beta angle will be in the range [-PI, 0]

Member Function Documentation

◆ alpha() [1/2]

template<typename _Scalar , class _System >
Scalar & Eigen::EulerAngles< _Scalar, _System >::alpha ( )
inline
Returns
A read-write reference to the angle of the first angle.

◆ alpha() [2/2]

template<typename _Scalar , class _System >
Scalar Eigen::EulerAngles< _Scalar, _System >::alpha ( ) const
inline
Returns
The value of the first angle.

◆ AlphaAxisVector()

template<typename _Scalar , class _System >
static Vector3 Eigen::EulerAngles< _Scalar, _System >::AlphaAxisVector ( )
inlinestatic
Returns
the axis vector of the first (alpha) rotation

◆ angles() [1/2]

template<typename _Scalar , class _System >
Vector3 & Eigen::EulerAngles< _Scalar, _System >::angles ( )
inline
Returns
A read-write reference to the angle values stored in a vector (alpha, beta, gamma).

◆ angles() [2/2]

template<typename _Scalar , class _System >
const Vector3 & Eigen::EulerAngles< _Scalar, _System >::angles ( ) const
inline
Returns
The angle values stored in a vector (alpha, beta, gamma).

◆ beta() [1/2]

template<typename _Scalar , class _System >
Scalar & Eigen::EulerAngles< _Scalar, _System >::beta ( )
inline
Returns
A read-write reference to the angle of the second angle.

◆ beta() [2/2]

template<typename _Scalar , class _System >
Scalar Eigen::EulerAngles< _Scalar, _System >::beta ( ) const
inline
Returns
The value of the second angle.

◆ BetaAxisVector()

template<typename _Scalar , class _System >
static Vector3 Eigen::EulerAngles< _Scalar, _System >::BetaAxisVector ( )
inlinestatic
Returns
the axis vector of the second (beta) rotation

◆ cast()

template<typename _Scalar , class _System >
template<typename NewScalarType >
EulerAngles< NewScalarType, System > Eigen::EulerAngles< _Scalar, _System >::cast ( ) const
inline
Returns
*this with scalar type casted to NewScalarType

◆ gamma() [1/2]

template<typename _Scalar , class _System >
Scalar & Eigen::EulerAngles< _Scalar, _System >::gamma ( )
inline
Returns
A read-write reference to the angle of the third angle.

◆ gamma() [2/2]

template<typename _Scalar , class _System >
Scalar Eigen::EulerAngles< _Scalar, _System >::gamma ( ) const
inline
Returns
The value of the third angle.

◆ GammaAxisVector()

template<typename _Scalar , class _System >
static Vector3 Eigen::EulerAngles< _Scalar, _System >::GammaAxisVector ( )
inlinestatic
Returns
the axis vector of the third (gamma) rotation

◆ inverse()

template<typename _Scalar , class _System >
EulerAngles Eigen::EulerAngles< _Scalar, _System >::inverse ( ) const
inline
Returns
The Euler angles rotation inverse (which is as same as the negative), (-alpha, -beta, -gamma).

◆ isApprox()

template<typename _Scalar , class _System >
bool Eigen::EulerAngles< _Scalar, _System >::isApprox ( const EulerAngles< _Scalar, _System > &  other,
const RealScalar prec = NumTraits<Scalar>::dummy_precision() 
) const
inline
Returns
true if *this is approximately equal to other, within the precision determined by prec.
See also
MatrixBase::isApprox()

◆ operator QuaternionType()

template<typename _Scalar , class _System >
Eigen::EulerAngles< _Scalar, _System >::operator QuaternionType ( ) const
inline

Convert the Euler angles to quaternion.

◆ operator-()

template<typename _Scalar , class _System >
EulerAngles Eigen::EulerAngles< _Scalar, _System >::operator- ( ) const
inline
Returns
The Euler angles rotation negative (which is as same as the inverse), (-alpha, -beta, -gamma).

◆ operator=() [1/2]

template<typename _Scalar , class _System >
template<class Derived >
EulerAngles & Eigen::EulerAngles< _Scalar, _System >::operator= ( const MatrixBase< Derived > &  other)
inline

Set *this from either:

  • a 3x3 rotation matrix expression(i.e. pure orthogonal matrix with determinant of +1),
  • a 3D vector expression representing Euler angles.

See EulerAngles(const MatrixBase<Derived, 3>&) for more information about angles ranges output.

◆ operator=() [2/2]

template<typename _Scalar , class _System >
template<typename Derived >
EulerAngles & Eigen::EulerAngles< _Scalar, _System >::operator= ( const RotationBase< Derived, 3 > &  rot)
inline

Set *this from a rotation.

See EulerAngles(const RotationBase<Derived, 3>&) for more information about angles ranges output.

◆ toRotationMatrix()

template<typename _Scalar , class _System >
Matrix3 Eigen::EulerAngles< _Scalar, _System >::toRotationMatrix ( ) const
inline
Returns
an equivalent 3x3 rotation matrix.

Friends And Related Symbol Documentation

◆ operator<<

template<typename _Scalar , class _System >
std::ostream & operator<< ( std::ostream &  s,
const EulerAngles< Scalar, System > &  eulerAngles 
)
friend

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