The quaternion class used to represent 3D orientations and rotations. More...
#include <Quaternion.h>
Public Types | |
typedef AngleAxis< Scalar > | AngleAxisType |
typedef Base::AngleAxisType | AngleAxisType |
typedef Matrix< Scalar, 4, 1 > | Coefficients |
typedef internal::traits < Quaternion >::Coefficients | Coefficients |
typedef Matrix< Scalar, 3, 3 > | Matrix3 |
typedef _Scalar | Scalar |
typedef _Scalar | Scalar |
typedef Matrix< Scalar, 3, 1 > | Vector3 |
Public Member Functions | |
Scalar | angularDistance (const Quaternion &other) const |
template<typename NewScalarType > | |
internal::cast_return_type < Quaternion, Quaternion < NewScalarType > >::type | cast () const |
const Coefficients & | coeffs () const |
Coefficients & | coeffs () |
Coefficients & | coeffs () |
const Coefficients & | coeffs () const |
Quaternion | conjugate (void) const |
Scalar | eigen2_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) | |
Quaternion () | |
Quaternion (const Scalar &w, const Scalar &x, const Scalar &y, const Scalar &z) | |
Quaternion (const Scalar *data) | |
template<class Derived > | |
EIGEN_STRONG_INLINE | 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) | |
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< const 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 | |
template<typename Derived1 , typename Derived2 > | |
static Quaternion | FromTwoVectors (const MatrixBase< Derived1 > &a, const MatrixBase< Derived2 > &b) |
static Quaternion | Identity () |
Static Protected Member Functions | |
static EIGEN_STRONG_INLINE void | _check_template_params () |
Protected Attributes | |
Coefficients | m_coeffs |
Private Types | |
enum | { IsAligned = internal::traits<Quaternion>::IsAligned } |
typedef RotationBase < Quaternion< _Scalar >, 3 > | Base |
typedef QuaternionBase < Quaternion< _Scalar, _Options > > | Base |
The quaternion class used to represent 3D orientations and rotations.
_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
_Scalar | the scalar type, i.e., the type of the coefficients |
_Options | controls the memory alignment of the coefficients. Can be # AutoAlign or # DontAlign. Default is AutoAlign. |
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, quaternions offer the following advantages:
The following two typedefs are provided for convenience:
Quaternionf
for float
Quaterniond
for double
Definition at line 47 of file Eigen2Support/Geometry/Quaternion.h.
typedef AngleAxis<Scalar> Eigen::Quaternion< _Scalar >::AngleAxisType |
the equivalent angle-axis type
Reimplemented from Eigen::QuaternionBase< Quaternion< _Scalar, _Options > >.
Definition at line 66 of file Eigen2Support/Geometry/Quaternion.h.
typedef Base::AngleAxisType Eigen::Quaternion< _Scalar >::AngleAxisType |
the equivalent angle-axis type
Reimplemented from Eigen::QuaternionBase< Quaternion< _Scalar, _Options > >.
Definition at line 238 of file Geometry/Quaternion.h.
typedef RotationBase<Quaternion<_Scalar>,3> Eigen::Quaternion< _Scalar >::Base [private] |
Reimplemented from Eigen::QuaternionBase< Quaternion< _Scalar, _Options > >.
Definition at line 49 of file Eigen2Support/Geometry/Quaternion.h.
typedef QuaternionBase<Quaternion<_Scalar,_Options> > Eigen::Quaternion< _Scalar >::Base [private] |
Reimplemented from Eigen::QuaternionBase< Quaternion< _Scalar, _Options > >.
Definition at line 228 of file Geometry/Quaternion.h.
typedef Matrix<Scalar, 4, 1> Eigen::Quaternion< _Scalar >::Coefficients |
the type of the Coefficients 4-vector
Reimplemented from Eigen::QuaternionBase< Quaternion< _Scalar, _Options > >.
Definition at line 60 of file Eigen2Support/Geometry/Quaternion.h.
typedef internal::traits<Quaternion>::Coefficients Eigen::Quaternion< _Scalar >::Coefficients |
Reimplemented from Eigen::QuaternionBase< Quaternion< _Scalar, _Options > >.
Definition at line 237 of file Geometry/Quaternion.h.
typedef Matrix<Scalar,3,3> Eigen::Quaternion< _Scalar >::Matrix3 |
the equivalent rotation matrix type
Reimplemented from Eigen::QuaternionBase< Quaternion< _Scalar, _Options > >.
Definition at line 64 of file Eigen2Support/Geometry/Quaternion.h.
typedef _Scalar Eigen::Quaternion< _Scalar >::Scalar |
the scalar type of the coefficients
Reimplemented from Eigen::RotationBase< Quaternion< _Scalar >, 3 >.
Definition at line 57 of file Eigen2Support/Geometry/Quaternion.h.
typedef _Scalar Eigen::Quaternion< _Scalar >::Scalar |
the scalar type of the coefficients
Reimplemented from Eigen::RotationBase< Quaternion< _Scalar >, 3 >.
Definition at line 232 of file Geometry/Quaternion.h.
typedef Matrix<Scalar,3,1> Eigen::Quaternion< _Scalar >::Vector3 |
the type of a 3D vector
Reimplemented from Eigen::QuaternionBase< Quaternion< _Scalar, _Options > >.
Definition at line 62 of file Eigen2Support/Geometry/Quaternion.h.
anonymous enum [private] |
Definition at line 229 of file Geometry/Quaternion.h.
Eigen::Quaternion< _Scalar >::Quaternion | ( | ) | [inline] |
Default constructor leaving the quaternion uninitialized.
Definition at line 99 of file Eigen2Support/Geometry/Quaternion.h.
Eigen::Quaternion< _Scalar >::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
] Definition at line 108 of file Eigen2Support/Geometry/Quaternion.h.
Eigen::Quaternion< _Scalar >::Quaternion | ( | const Quaternion< _Scalar > & | other | ) | [inline] |
Copy constructor
Definition at line 112 of file Eigen2Support/Geometry/Quaternion.h.
Eigen::Quaternion< _Scalar >::Quaternion | ( | const AngleAxisType & | aa | ) | [inline, explicit] |
Constructs and initializes a quaternion from the angle-axis aa
Definition at line 115 of file Eigen2Support/Geometry/Quaternion.h.
Eigen::Quaternion< _Scalar >::Quaternion | ( | const MatrixBase< Derived > & | other | ) | [inline, explicit] |
Constructs and initializes a quaternion from either:
Definition at line 123 of file Eigen2Support/Geometry/Quaternion.h.
Eigen::Quaternion< _Scalar >::Quaternion | ( | const Quaternion< OtherScalarType > & | other | ) | [inline, explicit] |
Copy constructor with scalar type conversion
Definition at line 192 of file Eigen2Support/Geometry/Quaternion.h.
Eigen::Quaternion< _Scalar >::Quaternion | ( | ) | [inline] |
Default constructor leaving the quaternion uninitialized.
Definition at line 241 of file Geometry/Quaternion.h.
Eigen::Quaternion< _Scalar >::Quaternion | ( | const Scalar & | w, |
const Scalar & | x, | ||
const Scalar & | y, | ||
const Scalar & | z | ||
) | [inline] |
Constructs and initializes the quaternion from its four coefficients w, x, y and z.
x
, y
, z
, w
] Definition at line 250 of file Geometry/Quaternion.h.
Eigen::Quaternion< _Scalar >::Quaternion | ( | const Scalar * | data | ) | [inline] |
Constructs and initialize a quaternion from the array data
Definition at line 253 of file Geometry/Quaternion.h.
EIGEN_STRONG_INLINE Eigen::Quaternion< _Scalar >::Quaternion | ( | const QuaternionBase< Derived > & | other | ) | [inline] |
Copy constructor
Definition at line 256 of file Geometry/Quaternion.h.
Eigen::Quaternion< _Scalar >::Quaternion | ( | const AngleAxisType & | aa | ) | [inline, explicit] |
Constructs and initializes a quaternion from the angle-axis aa
Definition at line 259 of file Geometry/Quaternion.h.
Eigen::Quaternion< _Scalar >::Quaternion | ( | const MatrixBase< Derived > & | other | ) | [inline, explicit] |
Constructs and initializes a quaternion from either:
Definition at line 266 of file Geometry/Quaternion.h.
Eigen::Quaternion< _Scalar >::Quaternion | ( | const Quaternion< OtherScalar, OtherOptions > & | other | ) | [inline, explicit] |
Explicit copy constructor with scalar conversion
Definition at line 270 of file Geometry/Quaternion.h.
static EIGEN_STRONG_INLINE void Eigen::Quaternion< _Scalar >::_check_template_params | ( | ) | [inline, static, protected] |
Definition at line 285 of file Geometry/Quaternion.h.
Scalar Eigen::Quaternion< Scalar >::angularDistance | ( | const Quaternion< _Scalar > & | other | ) | const [inline] |
Definition at line 404 of file Eigen2Support/Geometry/Quaternion.h.
internal::cast_return_type<Quaternion,Quaternion<NewScalarType> >::type Eigen::Quaternion< _Scalar >::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
.
Reimplemented from Eigen::QuaternionBase< Quaternion< _Scalar, _Options > >.
Definition at line 187 of file Eigen2Support/Geometry/Quaternion.h.
const Coefficients& Eigen::Quaternion< _Scalar >::coeffs | ( | ) | const [inline] |
Reimplemented from Eigen::QuaternionBase< Quaternion< _Scalar, _Options > >.
Definition at line 93 of file Eigen2Support/Geometry/Quaternion.h.
Coefficients& Eigen::Quaternion< _Scalar >::coeffs | ( | ) | [inline] |
Reimplemented from Eigen::QuaternionBase< Quaternion< _Scalar, _Options > >.
Definition at line 96 of file Eigen2Support/Geometry/Quaternion.h.
Coefficients& Eigen::Quaternion< _Scalar >::coeffs | ( | ) | [inline] |
Reimplemented from Eigen::QuaternionBase< Quaternion< _Scalar, _Options > >.
Definition at line 276 of file Geometry/Quaternion.h.
const Coefficients& Eigen::Quaternion< _Scalar >::coeffs | ( | ) | const [inline] |
Reimplemented from Eigen::QuaternionBase< Quaternion< _Scalar, _Options > >.
Definition at line 277 of file Geometry/Quaternion.h.
Quaternion< Scalar > Eigen::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.Reimplemented from Eigen::QuaternionBase< Quaternion< _Scalar, _Options > >.
Definition at line 395 of file Eigen2Support/Geometry/Quaternion.h.
Scalar Eigen::Quaternion< _Scalar >::eigen2_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. Definition at line 161 of file Eigen2Support/Geometry/Quaternion.h.
Quaternion< Scalar, Options > Eigen::Quaternion< Scalar, Options >::FromTwoVectors | ( | const MatrixBase< Derived1 > & | a, |
const MatrixBase< Derived2 > & | b | ||
) | [static] |
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.
Note that the two input vectors do not have to be normalized, and do not need to have the same norm.
Definition at line 621 of file Geometry/Quaternion.h.
static Quaternion Eigen::Quaternion< _Scalar >::Identity | ( | ) | [inline, static] |
Reimplemented from Eigen::QuaternionBase< Quaternion< _Scalar, _Options > >.
Definition at line 133 of file Eigen2Support/Geometry/Quaternion.h.
Quaternion< Scalar > Eigen::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 Eigen::RotationBase< Quaternion< _Scalar >, 3 >.
Definition at line 375 of file Eigen2Support/Geometry/Quaternion.h.
bool Eigen::Quaternion< _Scalar >::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.Definition at line 199 of file Eigen2Support/Geometry/Quaternion.h.
Scalar Eigen::Quaternion< _Scalar >::norm | ( | ) | const [inline] |
Reimplemented from Eigen::QuaternionBase< Quaternion< _Scalar, _Options > >.
Definition at line 147 of file Eigen2Support/Geometry/Quaternion.h.
void Eigen::Quaternion< _Scalar >::normalize | ( | void | ) | [inline] |
Normalizes the quaternion *this
Reimplemented from Eigen::QuaternionBase< Quaternion< _Scalar, _Options > >.
Definition at line 151 of file Eigen2Support/Geometry/Quaternion.h.
Quaternion Eigen::Quaternion< _Scalar >::normalized | ( | ) | const [inline] |
*this
Reimplemented from Eigen::QuaternionBase< Quaternion< _Scalar, _Options > >.
Definition at line 154 of file Eigen2Support/Geometry/Quaternion.h.
Quaternion< Scalar > Eigen::Quaternion< Scalar >::operator* | ( | const Quaternion< _Scalar > & | other | ) | const [inline] |
Definition at line 228 of file Eigen2Support/Geometry/Quaternion.h.
Quaternion< Scalar >::Vector3 Eigen::Quaternion< Scalar >::operator* | ( | const MatrixBase< Derived > & | v | ) | const [inline] |
Rotation of a vector by a quaternion.
Definition at line 250 of file Eigen2Support/Geometry/Quaternion.h.
Quaternion< Scalar > & Eigen::Quaternion< Scalar >::operator*= | ( | const Quaternion< _Scalar > & | other | ) | [inline] |
Definition at line 235 of file Eigen2Support/Geometry/Quaternion.h.
Quaternion< Scalar > & Eigen::Quaternion< Scalar >::operator= | ( | const Quaternion< _Scalar > & | other | ) | [inline] |
Definition at line 263 of file Eigen2Support/Geometry/Quaternion.h.
Quaternion< Scalar > & Eigen::Quaternion< Scalar >::operator= | ( | const AngleAxisType & | aa | ) | [inline] |
Set *this
from an angle-axis aa and returns a reference to *this
Reimplemented from Eigen::QuaternionBase< Quaternion< _Scalar, _Options > >.
Definition at line 272 of file Eigen2Support/Geometry/Quaternion.h.
Quaternion< Scalar > & Eigen::Quaternion< Scalar >::operator= | ( | const MatrixBase< Derived > & | xpr | ) | [inline] |
Set *this
from the expression xpr:
Definition at line 287 of file Eigen2Support/Geometry/Quaternion.h.
Quaternion< Scalar > & Eigen::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.
Reimplemented from Eigen::QuaternionBase< Quaternion< _Scalar, _Options > >.
Definition at line 338 of file Eigen2Support/Geometry/Quaternion.h.
Quaternion& Eigen::Quaternion< _Scalar >::setIdentity | ( | ) | [inline] |
Reimplemented from Eigen::QuaternionBase< Quaternion< _Scalar, _Options > >.
Definition at line 137 of file Eigen2Support/Geometry/Quaternion.h.
Quaternion< Scalar > Eigen::Quaternion< Scalar >::slerp | ( | Scalar | t, |
const Quaternion< _Scalar > & | other | ||
) | const |
*this
and other at the parameter t Definition at line 416 of file Eigen2Support/Geometry/Quaternion.h.
Scalar Eigen::Quaternion< _Scalar >::squaredNorm | ( | ) | const [inline] |
Reimplemented from Eigen::QuaternionBase< Quaternion< _Scalar, _Options > >.
Definition at line 142 of file Eigen2Support/Geometry/Quaternion.h.
Quaternion< Scalar >::Matrix3 Eigen::Quaternion< Scalar >::toRotationMatrix | ( | void | ) | const [inline] |
Convert the quaternion to a 3x3 rotation matrix
Reimplemented from Eigen::RotationBase< Quaternion< _Scalar >, 3 >.
Definition at line 296 of file Eigen2Support/Geometry/Quaternion.h.
const Block<const Coefficients,3,1> Eigen::Quaternion< _Scalar >::vec | ( | ) | const [inline] |
Reimplemented from Eigen::QuaternionBase< Quaternion< _Scalar, _Options > >.
Definition at line 87 of file Eigen2Support/Geometry/Quaternion.h.
Block<Coefficients,3,1> Eigen::Quaternion< _Scalar >::vec | ( | ) | [inline] |
Reimplemented from Eigen::QuaternionBase< Quaternion< _Scalar, _Options > >.
Definition at line 90 of file Eigen2Support/Geometry/Quaternion.h.
Scalar Eigen::Quaternion< _Scalar >::w | ( | ) | const [inline] |
w
coefficient Reimplemented from Eigen::QuaternionBase< Quaternion< _Scalar, _Options > >.
Definition at line 75 of file Eigen2Support/Geometry/Quaternion.h.
Scalar& Eigen::Quaternion< _Scalar >::w | ( | ) | [inline] |
w
coefficient Reimplemented from Eigen::QuaternionBase< Quaternion< _Scalar, _Options > >.
Definition at line 84 of file Eigen2Support/Geometry/Quaternion.h.
Scalar Eigen::Quaternion< _Scalar >::x | ( | ) | const [inline] |
x
coefficient Reimplemented from Eigen::QuaternionBase< Quaternion< _Scalar, _Options > >.
Definition at line 69 of file Eigen2Support/Geometry/Quaternion.h.
Scalar& Eigen::Quaternion< _Scalar >::x | ( | ) | [inline] |
x
coefficient Reimplemented from Eigen::QuaternionBase< Quaternion< _Scalar, _Options > >.
Definition at line 78 of file Eigen2Support/Geometry/Quaternion.h.
Scalar Eigen::Quaternion< _Scalar >::y | ( | ) | const [inline] |
y
coefficient Reimplemented from Eigen::QuaternionBase< Quaternion< _Scalar, _Options > >.
Definition at line 71 of file Eigen2Support/Geometry/Quaternion.h.
Scalar& Eigen::Quaternion< _Scalar >::y | ( | ) | [inline] |
y
coefficient Reimplemented from Eigen::QuaternionBase< Quaternion< _Scalar, _Options > >.
Definition at line 80 of file Eigen2Support/Geometry/Quaternion.h.
Scalar Eigen::Quaternion< _Scalar >::z | ( | ) | const [inline] |
z
coefficient Reimplemented from Eigen::QuaternionBase< Quaternion< _Scalar, _Options > >.
Definition at line 73 of file Eigen2Support/Geometry/Quaternion.h.
Scalar& Eigen::Quaternion< _Scalar >::z | ( | ) | [inline] |
z
coefficient Reimplemented from Eigen::QuaternionBase< Quaternion< _Scalar, _Options > >.
Definition at line 82 of file Eigen2Support/Geometry/Quaternion.h.
Coefficients Eigen::Quaternion< _Scalar >::m_coeffs [protected] |
Definition at line 203 of file Eigen2Support/Geometry/Quaternion.h.