Main MRPT website > C++ reference
MRPT logo
Public Types | Public Member Functions | Protected Attributes | Private Types

Quaternion< _Scalar > Class Template Reference


Detailed Description

template<typename _Scalar>
class Quaternion< _Scalar >

The quaternion class used to represent 3D orientations and rotations

Parameters:
_Scalarthe scalar type, i.e., the type of the coefficients

This class represents a quaternion $ w+xi+yj+zk $ that is a convenient representation of orientations and rotations of objects in three dimensions. Compared to other representations like Euler angles or 3x3 matrices, quatertions offer the following advantages:

The following two typedefs are provided for convenience:

See also:
class AngleAxis, class Transform

Definition at line 231 of file Quaternion.h.

#include <src/Geometry/Quaternion.h>

Inheritance diagram for Quaternion< _Scalar >:
Inheritance graph
[legend]

List of all members.

Public Types

typedef _Scalar Scalar
 the scalar type of the coefficients
typedef internal::traits
< Quaternion< Scalar >
>::Coefficients 
Coefficients
typedef Base::AngleAxisType AngleAxisType
 the equivalent angle-axis type

Public Member Functions

 Quaternion ()
 Default constructor leaving the quaternion uninitialized.
 Quaternion (Scalar w, Scalar x, Scalar y, Scalar z)
 Constructs and initializes the quaternion $ w+xi+yj+zk $ from its four coefficients w, x, y and z.
 Quaternion (const Scalar *data)
 Constructs and initialize a quaternion from the array data.
template<class Derived >
EIGEN_STRONG_INLINE Quaternion (const QuaternionBase< Derived > &other)
 Copy constructor.
 Quaternion (const AngleAxisType &aa)
 Constructs and initializes a quaternion from the angle-axis aa.
template<typename Derived >
 Quaternion (const MatrixBase< Derived > &other)
 Constructs and initializes a quaternion from either:

  • a rotation matrix expression,
  • a 4D vector expression representing quaternion coefficients.

Coefficientscoeffs ()
const Coefficientscoeffs () const

Protected Attributes

Coefficients m_coeffs

Private Types

typedef QuaternionBase
< Quaternion< _Scalar > > 
Base

Member Typedef Documentation

template<typename _Scalar>
typedef Base::AngleAxisType Quaternion< _Scalar >::AngleAxisType

the equivalent angle-axis type

Reimplemented from QuaternionBase< Quaternion< _Scalar > >.

Definition at line 240 of file Quaternion.h.

template<typename _Scalar>
typedef QuaternionBase<Quaternion<_Scalar> > Quaternion< _Scalar >::Base [private]

Reimplemented from QuaternionBase< Quaternion< _Scalar > >.

Definition at line 232 of file Quaternion.h.

template<typename _Scalar>
typedef internal::traits<Quaternion<Scalar> >::Coefficients Quaternion< _Scalar >::Coefficients

Reimplemented from QuaternionBase< Quaternion< _Scalar > >.

Definition at line 239 of file Quaternion.h.

template<typename _Scalar>
typedef _Scalar Quaternion< _Scalar >::Scalar

the scalar type of the coefficients

Reimplemented from QuaternionBase< Quaternion< _Scalar > >.

Definition at line 234 of file Quaternion.h.


Constructor & Destructor Documentation

template<typename _Scalar>
Quaternion< _Scalar >::Quaternion ( ) [inline]

Default constructor leaving the quaternion uninitialized.

Definition at line 243 of file Quaternion.h.

template<typename _Scalar>
Quaternion< _Scalar >::Quaternion ( Scalar  w,
Scalar  x,
Scalar  y,
Scalar  z 
) [inline]

Constructs and initializes the quaternion $ w+xi+yj+zk $ from its four coefficients w, x, y and z.

Warning:
Note the order of the arguments: the real w coefficient first, while internally the coefficients are stored in the following order: [x, y, z, w]

Definition at line 252 of file Quaternion.h.

template<typename _Scalar>
Quaternion< _Scalar >::Quaternion ( const Scalar data) [inline]

Constructs and initialize a quaternion from the array data.

Definition at line 255 of file Quaternion.h.

template<typename _Scalar>
template<class Derived >
EIGEN_STRONG_INLINE Quaternion< _Scalar >::Quaternion ( const QuaternionBase< Derived > &  other) [inline]

Copy constructor.

Definition at line 258 of file Quaternion.h.

References QuaternionBase< Quaternion< _Scalar > >::operator=().

template<typename _Scalar>
Quaternion< _Scalar >::Quaternion ( const AngleAxisType aa) [inline, explicit]

Constructs and initializes a quaternion from the angle-axis aa.

Definition at line 261 of file Quaternion.h.

template<typename _Scalar>
template<typename Derived >
Quaternion< _Scalar >::Quaternion ( const MatrixBase< Derived > &  other) [inline, explicit]

Constructs and initializes a quaternion from either:

  • a rotation matrix expression,
  • a 4D vector expression representing quaternion coefficients.

Definition at line 268 of file Quaternion.h.


Member Function Documentation

template<typename _Scalar>
Coefficients& Quaternion< _Scalar >::coeffs ( ) [inline]
Returns:
a vector expression of the coefficients (x,y,z,w)

Reimplemented from QuaternionBase< Quaternion< _Scalar > >.

Definition at line 270 of file Quaternion.h.

References Quaternion< _Scalar >::m_coeffs.

template<typename _Scalar>
const Coefficients& Quaternion< _Scalar >::coeffs ( ) const [inline]
Returns:
a read-only vector expression of the coefficients (x,y,z,w)

Reimplemented from QuaternionBase< Quaternion< _Scalar > >.

Definition at line 271 of file Quaternion.h.

References Quaternion< _Scalar >::m_coeffs.


Member Data Documentation

template<typename _Scalar>
Coefficients Quaternion< _Scalar >::m_coeffs [protected]

Definition at line 274 of file Quaternion.h.

Referenced by Quaternion< _Scalar >::coeffs().




Page generated by Doxygen 1.7.3 for MRPT 0.9.4 SVN: at Sat Mar 26 06:40:17 UTC 2011