Medial Code Documentation
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Static Public Member Functions | Static Protected Member Functions | Protected Attributes
Eigen::Quaternion< _Scalar, _Options > Class Template Reference

\geometry_module More...

#include <Quaternion.h>

Inheritance diagram for Eigen::Quaternion< _Scalar, _Options >:
Eigen::QuaternionBase< Quaternion< _Scalar, _Options > > Eigen::RotationBase< Derived, _Dim >

Public Types

enum  
 
typedef QuaternionBase< Quaternion< _Scalar, _Options > > Base
 
typedef _Scalar Scalar
 
typedef internal::traits< Quaternion >::Coefficients Coefficients
 
typedef Base::AngleAxisType AngleAxisType
 
- Public Types inherited from Eigen::QuaternionBase< Quaternion< _Scalar, _Options > >
enum  
 
typedef RotationBase< Quaternion< _Scalar, _Options >, 3 > Base
 
typedef internal::traits< Quaternion< _Scalar, _Options > >::Scalar Scalar
 
typedef NumTraits< Scalar >::Real RealScalar
 
typedef internal::traits< Quaternion< _Scalar, _Options > >::Coefficients Coefficients
 
typedef Matrix< Scalar, 3, 1 > Vector3
 the type of a 3D vector
 
typedef Matrix< Scalar, 3, 3 > Matrix3
 the equivalent rotation matrix type
 
typedef AngleAxis< Scalar > AngleAxisType
 the equivalent angle-axis type
 
- Public Types inherited from Eigen::RotationBase< Derived, _Dim >
enum  { Dim = _Dim }
 
typedef internal::traits< Derived >::Scalar Scalar
 the scalar type of the coefficients
 
typedef Matrix< Scalar, Dim, Dim > RotationMatrixType
 corresponding linear transformation matrix type
 
typedef Matrix< Scalar, Dim, 1 > VectorType
 

Public Member Functions

 Quaternion ()
 Default constructor leaving the quaternion uninitialized.
 
 Quaternion (const Scalar &w, const Scalar &x, const Scalar &y, const 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:
 
template<typename OtherScalar , int OtherOptions>
 Quaternion (const Quaternion< OtherScalar, OtherOptions > &other)
 Explicit copy constructor with scalar conversion.
 
Coefficients & coeffs ()
 
const Coefficients & coeffs () const
 
template<typename Derived1 , typename Derived2 >
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.
 
- Public Member Functions inherited from Eigen::QuaternionBase< Quaternion< _Scalar, _Options > >
Scalar x () const
 
Scalar & x ()
 
Scalar y () const
 
Scalar & y ()
 
Scalar z () const
 
Scalar & z ()
 
Scalar w () const
 
Scalar & w ()
 
const VectorBlock< const Coefficients, 3 > vec () const
 
VectorBlock< Coefficients, 3 > vec ()
 
const internal::traits< Quaternion< _Scalar, _Options > >::Coefficients & coeffs () const
 
internal::traits< Quaternion< _Scalar, _Options > >::Coefficients & coeffs ()
 
EIGEN_STRONG_INLINE QuaternionBase< Quaternion< _Scalar, _Options > > & operator= (const QuaternionBase< Quaternion< _Scalar, _Options > > &other)
 
EIGEN_STRONG_INLINE Quaternion< _Scalar, _Options > & operator= (const QuaternionBase< OtherDerived > &other)
 
Quaternion< _Scalar, _Options > & operator= (const AngleAxisType &aa)
 Set *this from an angle-axis aa and returns a reference to *this.
 
Quaternion< _Scalar, _Options > & operator= (const MatrixBase< OtherDerived > &m)
 
Quaternion< _Scalar, _Options > & operator= (const MatrixBase< MatrixDerived > &xpr)
 Set *this from the expression xpr:
 
QuaternionBasesetIdentity ()
 
Scalar squaredNorm () const
 
Scalar norm () const
 
void normalize ()
 Normalizes the quaternion *this.
 
Quaternion< Scalar > normalized () const
 
Scalar dot (const QuaternionBase< OtherDerived > &other) const
 
Scalar angularDistance (const QuaternionBase< OtherDerived > &other) const
 
internal::traits< Quaternion< _Scalar, _Options > >::Scalar angularDistance (const QuaternionBase< OtherDerived > &other) const
 
Matrix3 toRotationMatrix () const
 Convert the quaternion to a 3x3 rotation matrix.
 
Quaternion< _Scalar, _Options > & setFromTwoVectors (const MatrixBase< Derived1 > &a, const MatrixBase< Derived2 > &b)
 Sets *this to be a quaternion representing a rotation between the two arbitrary vectors a and b.
 
EIGEN_STRONG_INLINE Quaternion< Scalar > operator* (const QuaternionBase< OtherDerived > &q) const
 
EIGEN_STRONG_INLINE Quaternion< typename internal::traits< Quaternion< _Scalar, _Options > >::Scalar > operator* (const QuaternionBase< OtherDerived > &other) const
 
EIGEN_STRONG_INLINE Quaternion< _Scalar, _Options > & operator*= (const QuaternionBase< OtherDerived > &q)
 
Quaternion< Scalar > inverse () const
 
Quaternion< Scalar > conjugate () const
 
Quaternion< Scalar > slerp (const Scalar &t, const QuaternionBase< OtherDerived > &other) const
 
Quaternion< typename internal::traits< Quaternion< _Scalar, _Options > >::Scalar > slerp (const Scalar &t, const QuaternionBase< OtherDerived > &other) const
 
bool isApprox (const QuaternionBase< OtherDerived > &other, const RealScalar &prec=NumTraits< Scalar >::dummy_precision()) const
 
EIGEN_STRONG_INLINE Vector3 _transformVector (const Vector3 &v) const
 return the result vector of v through the rotation
 
internal::cast_return_type< Quaternion< _Scalar, _Options >, Quaternion< NewScalarType > >::type cast () const
 
- Public Member Functions inherited from Eigen::RotationBase< Derived, _Dim >
const Derived & derived () const
 
Derived & derived ()
 
RotationMatrixType toRotationMatrix () const
 
RotationMatrixType matrix () const
 
Derived inverse () const
 
Transform< Scalar, Dim, Isometryoperator* (const Translation< Scalar, Dim > &t) const
 
RotationMatrixType operator* (const UniformScaling< Scalar > &s) const
 
template<typename OtherDerived >
EIGEN_STRONG_INLINE internal::rotation_base_generic_product_selector< Derived, OtherDerived, OtherDerived::IsVectorAtCompileTime >::ReturnType operator* (const EigenBase< OtherDerived > &e) const
 
template<int Mode, int Options>
Transform< Scalar, Dim, Mode > operator* (const Transform< Scalar, Dim, Mode, Options > &t) const
 
template<typename OtherVectorType >
VectorType _transformVector (const OtherVectorType &v) const
 

Static Public Member Functions

template<typename Derived1 , typename Derived2 >
static Quaternion FromTwoVectors (const MatrixBase< Derived1 > &a, const MatrixBase< Derived2 > &b)
 
- Static Public Member Functions inherited from Eigen::QuaternionBase< Quaternion< _Scalar, _Options > >
static Quaternion< Scalar > Identity ()
 

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 >

\geometry_module

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:

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/2]

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]

◆ Quaternion() [2/2]

template<typename _Scalar , int _Options>
template<typename Derived >
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.

Member Function Documentation

◆ FromTwoVectors()

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


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