Quaternion< _Scalar > Class Template Reference
[Geometry module]
The quaternion class used to represent 3D orientations and rotations.
More...
List of all members.
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 |
Coefficients & | coeffs () |
const Coefficients & | coeffs () const |
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 |
template<typename Derived > |
Vector3 | operator* (const MatrixBase< Derived > &vec) const |
Quaternion | operator* (const Quaternion &q) const |
Quaternion & | operator*= (const Quaternion &q) |
template<typename Derived > |
Quaternion & | operator= (const MatrixBase< Derived > &m) |
Quaternion & | operator= (const AngleAxisType &aa) |
Quaternion & | operator= (const Quaternion &other) |
template<typename OtherScalarType > |
| Quaternion (const Quaternion< OtherScalarType > &other) |
template<typename Derived > |
| Quaternion (const MatrixBase< Derived > &other) |
| Quaternion (const AngleAxisType &aa) |
| Quaternion (const Quaternion &other) |
| Quaternion (Scalar w, Scalar x, Scalar y, Scalar z) |
| Quaternion () |
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 |
Block< Coefficients, 3, 1 > | vec () |
const Block< Coefficients, 3, 1 > | vec () const |
Scalar & | w () |
Scalar | w () const |
Scalar & | x () |
Scalar | x () const |
Scalar & | y () |
Scalar | y () const |
Scalar & | z () |
Scalar | z () const |
Static Public Member Functions |
static Quaternion | Identity () |
Protected Attributes |
Coefficients | m_coeffs |
Detailed Description
template<typename _Scalar>
class Eigen::Quaternion< _Scalar >
The quaternion class used to represent 3D orientations and rotations.
This is defined in the Geometry module.
#include <Eigen/Geometry>
- Parameters:
-
| _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:
- compact storage (4 scalars)
- efficient to compose (28 flops),
- stable spherical interpolation
The following two typedefs are provided for convenience:
Quaternionf
for float
Quaterniond
for double
- See also:
- class AngleAxis, class Transform
Member Typedef Documentation
the equivalent angle-axis type
the type of the Coefficients 4-vector
the equivalent rotation matrix type
Constructor & Destructor Documentation
Default constructor leaving the quaternion uninitialized.
Constructs and initializes the quaternion
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
]
Constructs and initializes a quaternion from the angle-axis aa
Constructs and initializes a quaternion from either:
- a rotation matrix expression,
- a 4D vector expression representing quaternion coefficients.
- See also:
- operator=(MatrixBase<Derived>)
Copy constructor with scalar type conversion
Member Function Documentation
- Returns:
- the angle (in radian) between two rotations
- See also:
- dot()
- Returns:
*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
.
- Returns:
- a vector expression of the coefficients (x,y,z,w)
- Returns:
- a read-only vector expression of the coefficients (x,y,z,w)
- Returns:
- the conjugate of the
*this
which is equal to the multiplicative inverse if the quaternion is normalized. The conjugate of a quaternion represents the opposite rotation.
- See also:
- Quaternion::inverse()
- Returns:
- the dot product of
*this
and other Geometrically speaking, the dot product of two unit quaternions corresponds to the cosine of half the angle between the two rotations.
- See also:
- angularDistance()
- Returns:
true
if *this
is approximately equal to other, within the precision determined by prec.
- See also:
- MatrixBase::isApprox()
Scalar norm |
( |
|
) |
const [inline] |
void normalize |
( |
|
) |
[inline] |
Rotation of a vector by a quaternion.
- Returns:
- the concatenation of two rotations as a quaternion-quaternion product
- See also:
- operator*(Quaternion)
Set *this
from the expression xpr:
- if xpr is a 4x1 vector, then xpr is assumed to be a quaternion
- if xpr is a 3x3 matrix, then xpr is assumed to be rotation matrix and xpr is converted to a quaternion
Set *this
from an angle-axis aa and returns a reference to *this
Sets *this to be a quaternion representing a rotation sending the vector a to the vector b.
- Returns:
- a reference to *this.
Note that the two input vectors do not have to be normalized.
- Returns:
- the spherical linear interpolation between the two quaternions
*this
and other at the parameter t
Scalar squaredNorm |
( |
|
) |
const [inline] |
- Returns:
- a vector expression of the imaginary part (x,y,z)
- Returns:
- a read-only vector expression of the imaginary part (x,y,z)
- Returns:
- a reference to the
w
coefficient
- Returns:
- the
w
coefficient
- Returns:
- a reference to the
x
coefficient
- Returns:
- the
x
coefficient
- Returns:
- a reference to the
y
coefficient
- Returns:
- the
y
coefficient
- Returns:
- a reference to the
z
coefficient
- Returns:
- the
z
coefficient
The documentation for this class was generated from the following file: