The quaternion class used to represent 3D orientations and rotations. More...
Public Types | |
| typedef AngleAxis< Scalar > | AngleAxisType |
| typedef Matrix< Scalar, 4, 1 > | Coefficients |
| typedef Matrix< Scalar, 3, 3 > | Matrix3 |
| typedef _Scalar | Scalar |
| typedef Matrix< Scalar, 3, 1 > | Vector3 |
Public Member Functions | |
| Scalar | angularDistance (const Quaternion &other) const |
| template<typename NewScalarType > | |
| ei_cast_return_type < Quaternion, Quaternion < NewScalarType > >::type | cast () const |
| const Coefficients & | coeffs () const |
| Coefficients & | coeffs () |
| Quaternion | conjugate (void) const |
| Scalar | dot (const Quaternion &other) const |
| Quaternion | inverse (void) const |
| bool | isApprox (const Quaternion &other, typename NumTraits< Scalar >::Real prec=precision< Scalar >()) const |
| Scalar | norm () const |
| void | normalize () |
| Quaternion | normalized () const |
| Quaternion | operator* (const Quaternion &q) const |
| template<typename Derived > | |
| Vector3 | operator* (const MatrixBase< Derived > &vec) const |
| Quaternion & | operator*= (const Quaternion &q) |
| Quaternion & | operator= (const Quaternion &other) |
| Quaternion & | operator= (const AngleAxisType &aa) |
| template<typename Derived > | |
| Quaternion & | operator= (const MatrixBase< Derived > &m) |
| Quaternion () | |
| Quaternion (Scalar w, Scalar x, Scalar y, Scalar z) | |
| Quaternion (const Quaternion &other) | |
| Quaternion (const AngleAxisType &aa) | |
| template<typename Derived > | |
| Quaternion (const MatrixBase< Derived > &other) | |
| template<typename OtherScalarType > | |
| Quaternion (const Quaternion< OtherScalarType > &other) | |
| template<typename Derived1 , typename Derived2 > | |
| Quaternion & | setFromTwoVectors (const MatrixBase< Derived1 > &a, const MatrixBase< Derived2 > &b) |
| Quaternion & | setIdentity () |
| Quaternion | slerp (Scalar t, const Quaternion &other) const |
| Scalar | squaredNorm () const |
| Matrix3 | toRotationMatrix (void) const |
| const Block< Coefficients, 3, 1 > | vec () const |
| Block< Coefficients, 3, 1 > | vec () |
| Scalar | w () const |
| Scalar & | w () |
| Scalar | x () const |
| Scalar & | x () |
| Scalar | y () const |
| Scalar & | y () |
| Scalar | z () const |
| Scalar & | z () |
Static Public Member Functions | |
| static Quaternion | Identity () |
Protected Attributes | |
| Coefficients | m_coeffs |
The quaternion class used to represent 3D orientations and rotations.
This is defined in the Geometry module.
#include <Eigen/Geometry>
| _Scalar | the scalar type, i.e., the type of the coefficients |
This class represents a quaternion
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:
Quaternionf for float Quaterniond for double | typedef AngleAxis<Scalar> AngleAxisType |
the equivalent angle-axis type
| typedef Matrix<Scalar, 4, 1> Coefficients |
the type of the Coefficients 4-vector
| typedef _Scalar Scalar |
the scalar type of the coefficients
Reimplemented from RotationBase< Quaternion< _Scalar >, 3 >.
| Quaternion | ( | ) | [inline] |
Default constructor leaving the quaternion uninitialized.
| Quaternion | ( | Scalar | w, |
| Scalar | x, | ||
| Scalar | y, | ||
| Scalar | z | ||
| ) | [inline] |
Constructs and initializes the quaternion
from its four coefficients w, x, y and z.
x, y, z, w] | Quaternion | ( | const Quaternion< _Scalar > & | other | ) | [inline] |
Copy constructor
| Quaternion | ( | const AngleAxisType & | aa | ) | [inline, explicit] |
Constructs and initializes a quaternion from the angle-axis aa
| Quaternion | ( | const MatrixBase< Derived > & | other | ) | [inline, explicit] |
Constructs and initializes a quaternion from either:
| Quaternion | ( | const Quaternion< OtherScalarType > & | other | ) | [inline, explicit] |
Copy constructor with scalar type conversion
| Scalar angularDistance | ( | const Quaternion< _Scalar > & | other | ) | const [inline] |
| ei_cast_return_type<Quaternion,Quaternion<NewScalarType> >::type cast | ( | ) | const [inline] |
*this with scalar type casted to NewScalarType Note that if NewScalarType is equal to the current scalar type of *this then this function smartly returns a const reference to *this.
| const Coefficients& coeffs | ( | ) | const [inline] |
| Coefficients& coeffs | ( | ) | [inline] |
| Quaternion< Scalar > conjugate | ( | void | ) | const [inline] |
*this which is equal to the multiplicative inverse if the quaternion is normalized. The conjugate of a quaternion represents the opposite rotation.| Scalar dot | ( | const Quaternion< _Scalar > & | other | ) | const [inline] |
*this and other Geometrically speaking, the dot product of two unit quaternions corresponds to the cosine of half the angle between the two rotations. | static Quaternion Identity | ( | ) | [inline, static] |
| Quaternion< Scalar > inverse | ( | void | ) | const [inline] |
*this Note that in most cases, i.e., if you simply want the opposite rotation, and/or the quaternion is normalized, then it is enough to use the conjugate.Reimplemented from RotationBase< Quaternion< _Scalar >, 3 >.
| bool isApprox | ( | const Quaternion< _Scalar > & | other, |
| typename NumTraits< Scalar >::Real | prec = precision<Scalar>() |
||
| ) | const [inline] |
true if *this is approximately equal to other, within the precision determined by prec.| void normalize | ( | ) | [inline] |
Normalizes the quaternion *this
| Quaternion normalized | ( | ) | const [inline] |
*this | Quaternion< Scalar > operator* | ( | const Quaternion< _Scalar > & | other | ) | const [inline] |
| Quaternion< Scalar >::Vector3 operator* | ( | const MatrixBase< Derived > & | v | ) | const [inline] |
Rotation of a vector by a quaternion.
| Quaternion< Scalar > & operator*= | ( | const Quaternion< _Scalar > & | other | ) | [inline] |
| Quaternion< Scalar > & operator= | ( | const AngleAxisType & | aa | ) | [inline] |
Set *this from an angle-axis aa and returns a reference to *this
| Quaternion< Scalar > & operator= | ( | const MatrixBase< Derived > & | xpr | ) | [inline] |
Set *this from the expression xpr:
| Quaternion< Scalar > & setFromTwoVectors | ( | const MatrixBase< Derived1 > & | a, |
| const MatrixBase< Derived2 > & | b | ||
| ) | [inline] |
Sets *this to be a quaternion representing a rotation sending the vector a to the vector b.
Note that the two input vectors do not have to be normalized.
| Quaternion& setIdentity | ( | ) | [inline] |
| Quaternion< Scalar > slerp | ( | Scalar | t, |
| const Quaternion< _Scalar > & | other | ||
| ) | const |
*this and other at the parameter t | Scalar squaredNorm | ( | ) | const [inline] |
| Quaternion< Scalar >::Matrix3 toRotationMatrix | ( | void | ) | const [inline] |
Convert the quaternion to a 3x3 rotation matrix
Reimplemented from RotationBase< Quaternion< _Scalar >, 3 >.
| const Block<Coefficients,3,1> vec | ( | ) | const [inline] |
| Block<Coefficients,3,1> vec | ( | ) | [inline] |
1.7.6.1