![]() |
Eigen
3.2.7
|
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 |
_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
Public Types | |
typedef Matrix< Scalar, 3, 3 > | Matrix3 |
typedef Matrix< Scalar, Dim, Dim > | RotationMatrixType |
typedef Matrix< Scalar, 3, 1 > | Vector3 |
Public Member Functions | |
Vector3 | _transformVector (const Vector3 &v) const |
internal::cast_return_type < Quaternion< _Scalar, _Options >, Quaternion < NewScalarType > >::type | cast () const |
Quaternion< Scalar > | conjugate () const |
Scalar | dot (const QuaternionBase< OtherDerived > &other) const |
template<typename Derived1 , typename Derived2 > | |
Quaternion< Scalar, Options > | FromTwoVectors (const MatrixBase< Derived1 > &a, const MatrixBase< Derived2 > &b) |
Quaternion< Scalar > | inverse () const |
bool | isApprox (const QuaternionBase< OtherDerived > &other, const 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 () | |
Quaternion (const Scalar &w, const Scalar &x, const Scalar &y, const 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 () |
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 () |
|
inherited |
corresponding linear transformation matrix type
|
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 |
Constructs and initialize a quaternion from the array data
|
inline |
Copy constructor
|
inlineexplicit |
Constructs and initializes a quaternion from the angle-axis aa
|
inlineexplicit |
Constructs and initializes a quaternion from either:
|
inlineexplicit |
Explicit copy constructor with scalar conversion
return the result vector of v through the rotation
Rotation of a vector by a quaternion.
|
inlineinherited |
*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
.
|
inherited |
*this
which is equal to the multiplicative inverse if the quaternion is normalized. The conjugate of a quaternion represents the opposite rotation.
|
inlineinherited |
*this
and other Geometrically speaking, the dot product of two unit quaternions corresponds to the cosine of half the angle between the two rotations. References QuaternionBase< Derived >::coeffs().
Quaternion<Scalar,Options> FromTwoVectors | ( | const MatrixBase< Derived1 > & | a, |
const MatrixBase< Derived2 > & | b | ||
) |
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.
|
inlinestaticinherited |
|
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.
|
inlineinherited |
true
if *this
is approximately equal to other, within the precision determined by prec.References QuaternionBase< Derived >::coeffs().
|
inlineinherited |
|
inlineinherited |
References QuaternionBase< Derived >::coeffs().
|
inlineinherited |
Normalizes the quaternion *this
References QuaternionBase< Derived >::coeffs().
|
inlineinherited |
*this
References QuaternionBase< Derived >::coeffs().
|
inlineinherited |
*this
with a translation t
|
inlineinherited |
*this
with a uniform scaling s
|
inlineinherited |
*this
with a generic expression e e can be:
|
inlineinherited |
*this
with a transformation t
|
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.
|
inlineinherited |
References QuaternionBase< Derived >::coeffs().
|
inlineinherited |
References QuaternionBase< Derived >::coeffs().
|
inherited |
Convert the quaternion to a 3x3 rotation matrix. The quaternion is required to be normalized, otherwise the result is undefined.
|
inlineinherited |
References QuaternionBase< Derived >::coeffs().
|
inlineinherited |
References QuaternionBase< Derived >::coeffs().
|
inlineinherited |
w
coefficient
|
inlineinherited |
w
coefficient
|
inlineinherited |
x
coefficient
|
inlineinherited |
x
coefficient
|
inlineinherited |
y
coefficient
|
inlineinherited |
y
coefficient
|
inlineinherited |
z
coefficient
|
inlineinherited |
z
coefficient