Path Tracer
Public Types | Public Member Functions | Static Public Member Functions | Static Protected Member Functions | Protected Attributes | List of all members
Eigen::Quaternion< _Scalar, _Options > Class Template Reference

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

#include <Quaternion.h>

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

EIGEN_DEVICE_FUNC Quaternion ()
 
EIGEN_DEVICE_FUNC Quaternion (const Scalar &w, const Scalar &x, const Scalar &y, const Scalar &z)
 
EIGEN_DEVICE_FUNC Quaternion (const Scalar *data)
 
template<class Derived >
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Quaternion (const QuaternionBase< Derived > &other)
 
EIGEN_DEVICE_FUNC Quaternion (const AngleAxisType &aa)
 
template<typename Derived >
EIGEN_DEVICE_FUNC Quaternion (const MatrixBase< Derived > &other)
 
template<typename OtherScalar , int OtherOptions>
EIGEN_DEVICE_FUNC Quaternion (const Quaternion< OtherScalar, OtherOptions > &other)
 
EIGEN_DEVICE_FUNC Coefficients & coeffs ()
 
EIGEN_DEVICE_FUNC const Coefficients & coeffs () const
 
template<typename Derived1 , typename Derived2 >
EIGEN_DEVICE_FUNC Quaternion< Scalar, Options > FromTwoVectors (const MatrixBase< Derived1 > &a, const MatrixBase< Derived2 > &b)
 
template<class OtherDerived >
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived & operator*= (const QuaternionBase< OtherDerived > &q)
 

Static Public Member Functions

static EIGEN_DEVICE_FUNC Quaternion UnitRandom ()
 
template<typename Derived1 , typename Derived2 >
static EIGEN_DEVICE_FUNC 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.

\geometry_module

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:

The following two typedefs are provided for convenience:

Warning
Operations interpreting the quaternion as rotation have undefined behavior if the quaternion is not normalized.
See also
class AngleAxis, class Transform

Constructor & Destructor Documentation

◆ Quaternion() [1/7]

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

Default constructor leaving the quaternion uninitialized.

◆ Quaternion() [2/7]

template<typename _Scalar , int _Options>
EIGEN_DEVICE_FUNC 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]

◆ Quaternion() [3/7]

template<typename _Scalar , int _Options>
EIGEN_DEVICE_FUNC Eigen::Quaternion< _Scalar, _Options >::Quaternion ( const Scalar *  data)
inlineexplicit

Constructs and initialize a quaternion from the array data

◆ Quaternion() [4/7]

template<typename _Scalar , int _Options>
template<class Derived >
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Eigen::Quaternion< _Scalar, _Options >::Quaternion ( const QuaternionBase< Derived > &  other)
inline

Copy constructor

◆ Quaternion() [5/7]

template<typename _Scalar , int _Options>
EIGEN_DEVICE_FUNC Eigen::Quaternion< _Scalar, _Options >::Quaternion ( const AngleAxisType aa)
inlineexplicit

Constructs and initializes a quaternion from the angle-axis aa

◆ Quaternion() [6/7]

template<typename _Scalar , int _Options>
template<typename Derived >
EIGEN_DEVICE_FUNC Eigen::Quaternion< _Scalar, _Options >::Quaternion ( const MatrixBase< Derived > &  other)
inlineexplicit

Constructs and initializes a quaternion from either:

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

◆ Quaternion() [7/7]

template<typename _Scalar , int _Options>
template<typename OtherScalar , int OtherOptions>
EIGEN_DEVICE_FUNC Eigen::Quaternion< _Scalar, _Options >::Quaternion ( const Quaternion< OtherScalar, OtherOptions > &  other)
inlineexplicit

Explicit copy constructor with scalar conversion

Member Function Documentation

◆ FromTwoVectors()

template<typename _Scalar , int _Options>
template<typename Derived1 , typename Derived2 >
EIGEN_DEVICE_FUNC Quaternion<Scalar,Options> Eigen::Quaternion< _Scalar, _Options >::FromTwoVectors ( const MatrixBase< Derived1 > &  a,
const MatrixBase< Derived2 > &  b 
)

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.

◆ operator*=()

template<typename _Scalar , int _Options>
template<class OtherDerived >
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived & Eigen::QuaternionBase< Derived >::operator*= ( class OtherDerived  )
See also
operator*(Quaternion)

◆ UnitRandom()

template<typename Scalar , int Options>
EIGEN_DEVICE_FUNC Quaternion< Scalar, Options > Eigen::Quaternion< Scalar, Options >::UnitRandom
static
Returns
a random unit quaternion following a uniform distribution law on SO(3)
Note
The implementation is based on http://planning.cs.uiuc.edu/node198.html

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