The quaternion class used to represent 3D orientations and rotations. More...
Inheritance diagram for Quaternion< _Scalar, _Options >:Public Types | |
| enum | |
| enum | |
| typedef Base::AngleAxisType | AngleAxisType |
| typedef internal::traits < Quaternion >::Coefficients | Coefficients |
| typedef Matrix< Scalar, 3, 3 > | Matrix3 |
| typedef NumTraits< Scalar >::Real | RealScalar |
| typedef Matrix< Scalar, Dim, Dim > | RotationMatrixType |
| typedef _Scalar | Scalar |
| typedef Matrix< Scalar, 3, 1 > | Vector3 |
| typedef Matrix< Scalar, Dim, 1 > | VectorType |
Public Member Functions | |
| VectorType | _transformVector (const OtherVectorType &v) const |
| Vector3 | _transformVector (Vector3 v) const |
| Scalar | angularDistance (const QuaternionBase< OtherDerived > &other) const |
| internal::cast_return_type < Quaternion< _Scalar, _Options >, Quaternion < NewScalarType > >::type | cast () const |
| Coefficients & | coeffs () |
| const Coefficients & | coeffs () const |
| Quaternion< Scalar > | conjugate () const |
| const Quaternion< _Scalar, _Options > & | derived () const |
| Quaternion< _Scalar, _Options > & | derived () |
| Scalar | dot (const QuaternionBase< OtherDerived > &other) const |
| Quaternion< Scalar > | inverse () const |
| bool | isApprox (const QuaternionBase< OtherDerived > &other, RealScalar prec=NumTraits< Scalar >::dummy_precision()) const |
| RotationMatrixType | matrix () const |
| Scalar | norm () const |
| void | normalize () |
| Quaternion< Scalar > | normalized () const |
| Transform< Scalar, Dim, Isometry > | operator* (const Translation< Scalar, Dim > &t) const |
| RotationMatrixType | operator* (const UniformScaling< Scalar > &s) const |
| internal::rotation_base_generic_product_selector < Quaternion< _Scalar, _Options >, OtherDerived, OtherDerived::IsVectorAtCompileTime > ::ReturnType | operator* (const EigenBase< OtherDerived > &e) const |
| Transform< Scalar, Dim, Mode > | operator* (const Transform< Scalar, Dim, Mode, Options > &t) const |
| Quaternion< Scalar > | operator* (const QuaternionBase< OtherDerived > &q) const |
| Quaternion< _Scalar, _Options > & | operator*= (const QuaternionBase< OtherDerived > &q) |
| Quaternion () | |
| Quaternion (Scalar w, Scalar x, Scalar y, Scalar z) | |
| Quaternion (const Scalar *data) | |
| template<class Derived > | |
| 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) | |
| Quaternion< _Scalar, _Options > & | setFromTwoVectors (const MatrixBase< Derived1 > &a, const MatrixBase< Derived2 > &b) |
| QuaternionBase & | setIdentity () |
| Quaternion< Scalar > | slerp (Scalar t, const QuaternionBase< OtherDerived > &other) const |
| Scalar | squaredNorm () const |
| Matrix3 | toRotationMatrix () const |
| const VectorBlock< const Coefficients, 3 > | vec () const |
| VectorBlock< Coefficients, 3 > | 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< Scalar > | Identity () |
Protected Attributes | |
| Coefficients | m_coeffs |
Friends | |
| RotationMatrixType | operator* (const EigenBase< OtherDerived > &l, const Quaternion< _Scalar, _Options > &r) |
| Transform< Scalar, Dim, Affine > | operator* (const DiagonalMatrix< Scalar, Dim > &l, const Quaternion< _Scalar, _Options > &r) |
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 Base::AngleAxisType AngleAxisType |
the equivalent angle-axis type
Reimplemented from QuaternionBase< Quaternion< _Scalar, _Options > >.
| typedef internal::traits<Quaternion>::Coefficients Coefficients |
Reimplemented from QuaternionBase< Quaternion< _Scalar, _Options > >.
typedef NumTraits<Scalar>::Real RealScalar [inherited] |
typedef Matrix<Scalar,Dim,Dim> RotationMatrixType [inherited] |
corresponding linear transformation matrix type
the scalar type of the coefficients
Reimplemented from QuaternionBase< Quaternion< _Scalar, _Options > >.
typedef Matrix<Scalar,Dim,1> VectorType [inherited] |
anonymous enum [inherited] |
anonymous enum [inherited] |
| 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 Scalar * | data | ) | [inline] |
Constructs and initialize a quaternion from the array data
| Quaternion | ( | const QuaternionBase< Derived > & | 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< OtherScalar, OtherOptions > & | other | ) | [inline, explicit] |
Explicit copy constructor with scalar conversion
| VectorType _transformVector | ( | const OtherVectorType & | v | ) | const [inline, inherited] |
return the result vector of v through the rotation
Rotation of a vector by a quaternion.
| Scalar angularDistance | ( | const QuaternionBase< OtherDerived > & | other | ) | const [inherited] |
| internal::cast_return_type<Quaternion< _Scalar, _Options > ,Quaternion<NewScalarType> >::type cast | ( | ) | const [inline, inherited] |
*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.
| Coefficients& coeffs | ( | ) | [inline] |
Reimplemented from QuaternionBase< Quaternion< _Scalar, _Options > >.
| const Coefficients& coeffs | ( | ) | const [inline] |
Reimplemented from QuaternionBase< Quaternion< _Scalar, _Options > >.
| Quaternion<Scalar> conjugate | ( | ) | const [inherited] |
*this which is equal to the multiplicative inverse if the quaternion is normalized. The conjugate of a quaternion represents the opposite rotation.| const Quaternion< _Scalar, _Options > & derived | ( | ) | const [inline, inherited] |
| Quaternion< _Scalar, _Options > & derived | ( | ) | [inline, inherited] |
| Scalar dot | ( | const QuaternionBase< OtherDerived > & | other | ) | const [inline, inherited] |
*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<Scalar> Identity | ( | ) | [inline, static, inherited] |
| Quaternion<Scalar> inverse | ( | ) | const [inherited] |
*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, _Options >, 3 >.
| bool isApprox | ( | const QuaternionBase< OtherDerived > & | other, |
| RealScalar | prec = NumTraits<Scalar>::dummy_precision() |
||
| ) | const [inline, inherited] |
true if *this is approximately equal to other, within the precision determined by prec.| RotationMatrixType matrix | ( | ) | const [inline, inherited] |
| Scalar norm | ( | ) | const [inline, inherited] |
| void normalize | ( | void | ) | [inline, inherited] |
Normalizes the quaternion *this
| Quaternion<Scalar> normalized | ( | ) | const [inline, inherited] |
*this | Transform<Scalar,Dim,Isometry> operator* | ( | const Translation< Scalar, Dim > & | t | ) | const [inline, inherited] |
*this with a translation t | RotationMatrixType operator* | ( | const UniformScaling< Scalar > & | s | ) | const [inline, inherited] |
*this with a uniform scaling s | internal::rotation_base_generic_product_selector<Quaternion< _Scalar, _Options > ,OtherDerived,OtherDerived::IsVectorAtCompileTime>::ReturnType operator* | ( | const EigenBase< OtherDerived > & | e | ) | const [inline, inherited] |
*this with a generic expression e e can be:| Transform<Scalar,Dim,Mode> operator* | ( | const Transform< Scalar, Dim, Mode, Options > & | t | ) | const [inline, inherited] |
*this with a transformation t | Quaternion<Scalar> operator* | ( | const QuaternionBase< OtherDerived > & | q | ) | const [inline, inherited] |
| Quaternion< _Scalar, _Options > & operator*= | ( | const QuaternionBase< OtherDerived > & | q | ) | [inline, inherited] |
| Quaternion< _Scalar, _Options > & setFromTwoVectors | ( | const MatrixBase< Derived1 > & | a, |
| const MatrixBase< Derived2 > & | b | ||
| ) | [inherited] |
Sets *this to be 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.
*this.Note that the two input vectors do not have to be normalized, and do not need to have the same norm.
| QuaternionBase& setIdentity | ( | ) | [inline, inherited] |
| Quaternion<Scalar> slerp | ( | Scalar | t, |
| const QuaternionBase< OtherDerived > & | other | ||
| ) | const [inherited] |
*this t in [0;1] see http://en.wikipedia.org/wiki/Slerp*this and other at the parameter t | Scalar squaredNorm | ( | ) | const [inline, inherited] |
| Matrix3 toRotationMatrix | ( | ) | const [inherited] |
Convert the quaternion to a 3x3 rotation matrix. The quaternion is required to be normalized, otherwise the result is undefined.
Reimplemented from RotationBase< Quaternion< _Scalar, _Options >, 3 >.
| const VectorBlock<const Coefficients,3> vec | ( | ) | const [inline, inherited] |
| VectorBlock<Coefficients,3> vec | ( | ) | [inline, inherited] |
| Scalar w | ( | ) | const [inline, inherited] |
w coefficient | Scalar& w | ( | ) | [inline, inherited] |
w coefficient | Scalar x | ( | ) | const [inline, inherited] |
x coefficient | Scalar& x | ( | ) | [inline, inherited] |
x coefficient | Scalar y | ( | ) | const [inline, inherited] |
y coefficient | Scalar& y | ( | ) | [inline, inherited] |
y coefficient | Scalar z | ( | ) | const [inline, inherited] |
z coefficient | Scalar& z | ( | ) | [inline, inherited] |
z coefficient | RotationMatrixType operator* | ( | const EigenBase< OtherDerived > & | l, |
| const Quaternion< _Scalar, _Options > & | r | ||
| ) | [friend, inherited] |
| Transform<Scalar,Dim,Affine> operator* | ( | const DiagonalMatrix< Scalar, Dim > & | l, |
| const Quaternion< _Scalar, _Options > & | r | ||
| ) | [friend, inherited] |
Coefficients m_coeffs [protected] |
1.7.5.1