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 Types inherited from RotationBase< Quaternion< _Scalar >, 3 > | |
| enum | |
| typedef Matrix< Scalar, Dim, Dim > | RotationMatrixType |
| typedef ei_traits< Quaternion < _Scalar > >::Scalar | Scalar |
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 () |
Public Member Functions inherited from RotationBase< Quaternion< _Scalar >, 3 > | |
| const Quaternion< _Scalar > & | derived () const |
| Quaternion< _Scalar > & | derived () |
| Transform< Scalar, Dim > | operator* (const Translation< Scalar, Dim > &t) const |
| RotationMatrixType | operator* (const Scaling< Scalar, Dim > &s) const |
| Transform< Scalar, Dim > | operator* (const Transform< Scalar, Dim > &t) const |
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.
| _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
|
inline |
Default constructor leaving the quaternion uninitialized.
|
inline |
Constructs and initializes the quaternion
from its four coefficients w, x, y and z.
x, y, z, w]
|
inline |
Copy constructor
|
inlineexplicit |
Constructs and initializes a quaternion from the angle-axis aa
|
inlineexplicit |
Constructs and initializes a quaternion from either:
|
inlineexplicit |
Copy constructor with scalar type conversion
|
inline |
|
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.
|
inline |
|
inline |
|
inline |
*this which is equal to the multiplicative inverse if the quaternion is normalized. The conjugate of a quaternion represents the opposite rotation.
|
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.
|
inlinestatic |
|
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 >.
|
inline |
true if *this is approximately equal to other, within the precision determined by prec.
|
inline |
|
inline |
Normalizes the quaternion *this
|
inline |
*this
|
inline |
|
inline |
Rotation of a vector by a quaternion.
|
inline |
|
inline |
Set *this from an angle-axis aa and returns a reference to *this
|
inline |
Set *this from the expression xpr:
|
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.
|
inline |
| Quaternion< Scalar > slerp | ( | Scalar | t, |
| const Quaternion< _Scalar > & | other | ||
| ) | const |
*this and other at the parameter t
|
inline |
|
inline |
Convert the quaternion to a 3x3 rotation matrix
Reimplemented from RotationBase< Quaternion< _Scalar >, 3 >.
|
inline |
|
inline |
|
inline |
w coefficient
|
inline |
w coefficient
|
inline |
x coefficient
|
inline |
x coefficient
|
inline |
y coefficient
|
inline |
y coefficient
|
inline |
z coefficient
|
inline |
z coefficient
1.8.1.2