MOAB  4.9.3pre
Eigen::Quaternion< _Scalar, _Options > Class Template Reference

The quaternion class used to represent 3D orientations and rotations. More...

#include <Quaternion.h>

Inheritance diagram for Eigen::Quaternion< _Scalar, _Options >:
Collaboration diagram for Eigen::Quaternion< _Scalar, _Options >:

List of all members.

Public Types

enum  
typedef QuaternionBase
< Quaternion< _Scalar,
_Options > > 
Base
typedef _Scalar Scalar
typedef internal::traits
< Quaternion >::Coefficients 
Coefficients
typedef Base::AngleAxisType AngleAxisType

Public Member Functions

 Quaternion ()
 Quaternion (const Scalar &w, const Scalar &x, const Scalar &y, const Scalar &z)
 Quaternion (const Scalar *data)
template<class Derived >
EIGEN_STRONG_INLINE Quaternion (const QuaternionBase< Derived > &other)
 Quaternion (const AngleAxisType &aa)
template<typename Derived >
 Quaternion (const MatrixBase< Derived > &other)
template<typename OtherScalar , int OtherOptions>
 Quaternion (const Quaternion< OtherScalar, OtherOptions > &other)
Coefficientscoeffs ()
const Coefficientscoeffs () const

Static Public Member Functions

template<typename Derived1 , typename Derived2 >
static Quaternion FromTwoVectors (const MatrixBase< Derived1 > &a, const MatrixBase< Derived2 > &b)

Static Protected Member Functions

static EIGEN_STRONG_INLINE void _check_template_params ()

Protected Attributes

Coefficients m_coeffs

Detailed Description

template<typename _Scalar, int _Options>
class Eigen::Quaternion< _Scalar, _Options >

The quaternion class used to represent 3D orientations and rotations.

Template Parameters:
_Scalarthe scalar type, i.e., the type of the coefficients
_Optionscontrols the memory alignment of the coefficients. Can be # AutoAlign or # DontAlign. Default is AutoAlign.

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, quaternions offer the following advantages:

  • compact storage (4 scalars)
  • efficient to compose (28 flops),
  • stable spherical interpolation

The following two typedefs are provided for convenience:

  • Quaternionf for float
  • Quaterniond for double
Warning:
Operations interpreting the quaternion as rotation have undefined behavior if the quaternion is not normalized.
See also:
class AngleAxis, class Transform

Definition at line 227 of file Quaternion.h.


Member Typedef Documentation

template<typename _Scalar, int _Options>
typedef Base::AngleAxisType Eigen::Quaternion< _Scalar, _Options >::AngleAxisType

the equivalent angle-axis type

Reimplemented from Eigen::QuaternionBase< Quaternion< _Scalar, _Options > >.

Definition at line 239 of file Quaternion.h.

template<typename _Scalar, int _Options>
typedef QuaternionBase<Quaternion<_Scalar,_Options> > Eigen::Quaternion< _Scalar, _Options >::Base

Reimplemented from Eigen::QuaternionBase< Quaternion< _Scalar, _Options > >.

Definition at line 230 of file Quaternion.h.

template<typename _Scalar, int _Options>
typedef internal::traits<Quaternion>::Coefficients Eigen::Quaternion< _Scalar, _Options >::Coefficients

Reimplemented from Eigen::QuaternionBase< Quaternion< _Scalar, _Options > >.

Definition at line 238 of file Quaternion.h.

template<typename _Scalar, int _Options>
typedef _Scalar Eigen::Quaternion< _Scalar, _Options >::Scalar

the scalar type of the coefficients

Reimplemented from Eigen::QuaternionBase< Quaternion< _Scalar, _Options > >.

Definition at line 233 of file Quaternion.h.


Member Enumeration Documentation

template<typename _Scalar, int _Options>
anonymous enum

Definition at line 231 of file Quaternion.h.

{ NeedsAlignment = internal::traits<Quaternion>::Alignment>0 };

Constructor & Destructor Documentation

template<typename _Scalar, int _Options>
Eigen::Quaternion< _Scalar, _Options >::Quaternion ( ) [inline]

Default constructor leaving the quaternion uninitialized.

Definition at line 242 of file Quaternion.h.

{}
template<typename _Scalar, int _Options>
Eigen::Quaternion< _Scalar, _Options >::Quaternion ( const Scalar w,
const Scalar x,
const Scalar y,
const 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 251 of file Quaternion.h.

: m_coeffs(x, y, z, w){}
template<typename _Scalar, int _Options>
Eigen::Quaternion< _Scalar, _Options >::Quaternion ( const Scalar data) [inline, explicit]

Constructs and initialize a quaternion from the array data

Definition at line 254 of file Quaternion.h.

: m_coeffs(data) {}
template<typename _Scalar, int _Options>
template<class Derived >
EIGEN_STRONG_INLINE Eigen::Quaternion< _Scalar, _Options >::Quaternion ( const QuaternionBase< Derived > &  other) [inline]

Copy constructor

Definition at line 257 of file Quaternion.h.

{ this->Base::operator=(other); }
template<typename _Scalar, int _Options>
Eigen::Quaternion< _Scalar, _Options >::Quaternion ( const AngleAxisType aa) [inline, explicit]

Constructs and initializes a quaternion from the angle-axis aa

Definition at line 260 of file Quaternion.h.

{ *this = aa; }
template<typename _Scalar, int _Options>
template<typename Derived >
Eigen::Quaternion< _Scalar, _Options >::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 267 of file Quaternion.h.

{ *this = other; }
template<typename _Scalar, int _Options>
template<typename OtherScalar , int OtherOptions>
Eigen::Quaternion< _Scalar, _Options >::Quaternion ( const Quaternion< OtherScalar, OtherOptions > &  other) [inline, explicit]

Explicit copy constructor with scalar conversion

Definition at line 271 of file Quaternion.h.

  { m_coeffs = other.coeffs().template cast<Scalar>(); }

Member Function Documentation

template<typename _Scalar, int _Options>
static EIGEN_STRONG_INLINE void Eigen::Quaternion< _Scalar, _Options >::_check_template_params ( ) [inline, static, protected]

Definition at line 290 of file Quaternion.h.

    {
      EIGEN_STATIC_ASSERT( (_Options & DontAlign) == _Options,
        INVALID_MATRIX_TEMPLATE_PARAMETERS)
    }
template<typename _Scalar, int _Options>
Coefficients& Eigen::Quaternion< _Scalar, _Options >::coeffs ( ) [inline]
Returns:
a vector expression of the coefficients (x,y,z,w)

Reimplemented from Eigen::QuaternionBase< Quaternion< _Scalar, _Options > >.

Definition at line 277 of file Quaternion.h.

{ return m_coeffs;}
template<typename _Scalar, int _Options>
const Coefficients& Eigen::Quaternion< _Scalar, _Options >::coeffs ( ) const [inline]
Returns:
a read-only vector expression of the coefficients (x,y,z,w)

Reimplemented from Eigen::QuaternionBase< Quaternion< _Scalar, _Options > >.

Definition at line 278 of file Quaternion.h.

{ return m_coeffs;}
template<typename Scalar , int Options>
template<typename Derived1 , typename Derived2 >
Quaternion< Scalar, Options > Eigen::Quaternion< Scalar, Options >::FromTwoVectors ( const MatrixBase< Derived1 > &  a,
const MatrixBase< Derived2 > &  b 
) [static]

Returns a quaternion representing a rotation between the two arbitrary vectors a and b. In other words, the built rotation represent a rotation sending the line of direction a to the line of direction b, both lines passing through the origin.

Returns:
resulting quaternion

Note that the two input vectors do not have to be normalized, and do not need to have the same norm.

Definition at line 625 of file Quaternion.h.

{
    Quaternion quat;
    quat.setFromTwoVectors(a, b);
    return quat;
}

Member Data Documentation

template<typename _Scalar, int _Options>
Coefficients Eigen::Quaternion< _Scalar, _Options >::m_coeffs [protected]

Definition at line 287 of file Quaternion.h.


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines