Map< Quaternion< _Scalar >, _Options > Class Template Reference

Expression of a quaternion from a memory buffer. More...

#include <Quaternion.h>

+ Inheritance diagram for Map< Quaternion< _Scalar >, _Options >:

Public Types

typedef AngleAxis< Scalar > AngleAxisType
 
typedef Matrix< Scalar, 3, 3 > Matrix3
 
typedef Matrix< Scalar, Dim, Dim > RotationMatrixType
 
typedef Matrix< Scalar, 3, 1 > Vector3
 

Public Member Functions

Vector3 _transformVector (Vector3 v) const
 
Vector3 _transformVector (Vector3 v) const
 
internal::traits< Map< Quaternion< _Scalar >, _Options > >::Scalar angularDistance (const QuaternionBase< OtherDerived > &other) const
 
internal::traits< Map< Quaternion< _Scalar >, _Options > >::Scalar angularDistance (const QuaternionBase< OtherDerived > &other) const
 
internal::cast_return_type< Map< Quaternion< _Scalar >, _Options >, Quaternion< NewScalarType > >::type cast () const
 
internal::cast_return_type< Map< Quaternion< _Scalar >, _Options >, Quaternion< NewScalarType > >::type cast () const
 
Quaternion< Scalar > conjugate () const
 
Quaternion< Scalar > conjugate () const
 
Scalar dot (const QuaternionBase< OtherDerived > &other) const
 
Scalar dot (const QuaternionBase< OtherDerived > &other) const
 
Quaternion< Scalar > inverse () const
 
Quaternion< Scalar > inverse () const
 
bool isApprox (const QuaternionBase< OtherDerived > &other, RealScalar prec=NumTraits< Scalar >::dummy_precision()) const
 
bool isApprox (const QuaternionBase< OtherDerived > &other, RealScalar prec=NumTraits< Scalar >::dummy_precision()) const
 
 Map (PointerArgType data, const StrideType &stride=StrideType())
 
 Map (PointerArgType data, Index rows, Index cols, const StrideType &stride=StrideType())
 
 Map (PointerArgType data, Index size, const StrideType &stride=StrideType())
 
 Map (Scalar *coeffs)
 
RotationMatrixType matrix () const
 
Scalar norm () const
 
Scalar norm () const
 
void normalize ()
 
void normalize ()
 
Quaternion< Scalar > normalized () const
 
Quaternion< Scalar > normalized () const
 
internal::rotation_base_generic_product_selector< Map< Quaternion< _Scalar >, _Options >, OtherDerived, OtherDerived::IsVectorAtCompileTime >::ReturnType operator* (const EigenBase< OtherDerived > &e) const
 
Quaternion< typename internal::traits< Map< Quaternion< _Scalar >, _Options > >::Scalar > operator* (const QuaternionBase< OtherDerived > &other) const
 
Quaternion< typename internal::traits< Map< Quaternion< _Scalar >, _Options > >::Scalar > operator* (const QuaternionBase< OtherDerived > &other) const
 
Transform< Scalar, Dim, Mode > operator* (const Transform< Scalar, Dim, Mode, Options > &t) const
 
Transform< Scalar, Dim, Isometryoperator* (const Translation< Scalar, Dim > &t) const
 
RotationMatrixType operator* (const UniformScaling< Scalar > &s) const
 
Map< Quaternion< _Scalar >, _Options > & operator*= (const QuaternionBase< OtherDerived > &q)
 
Map< Quaternion< _Scalar >, _Options > & setFromTwoVectors (const MatrixBase< Derived1 > &a, const MatrixBase< Derived2 > &b)
 
Map< Quaternion< _Scalar >, _Options > & setFromTwoVectors (const MatrixBase< Derived1 > &a, const MatrixBase< Derived2 > &b)
 
QuaternionBasesetIdentity ()
 
QuaternionBasesetIdentity ()
 
Quaternion< Scalar > slerp (Scalar t, const QuaternionBase< OtherDerived > &other) const
 
Quaternion< Scalar > slerp (Scalar t, const QuaternionBase< OtherDerived > &other) const
 
Quaternion< typename internal::traits< Map< Quaternion< _Scalar >, _Options > >::Scalar > slerp (Scalar t, const QuaternionBase< OtherDerived > &other) const
 
Quaternion< typename internal::traits< Map< Quaternion< _Scalar >, _Options > >::Scalar > slerp (Scalar t, const QuaternionBase< OtherDerived > &other) const
 
Scalar squaredNorm () const
 
Scalar squaredNorm () const
 
Matrix3 toRotationMatrix () const
 
Matrix3 toRotationMatrix () const
 
VectorBlock< Coefficients, 3 > vec ()
 
VectorBlock< Coefficients, 3 > vec ()
 
const VectorBlock< const Coefficients, 3 > vec () const
 
const VectorBlock< const Coefficients, 3 > vec () const
 
Scalar & w ()
 
Scalar & w ()
 
Scalar w () const
 
Scalar w () const
 
Scalar & x ()
 
Scalar & x ()
 
Scalar x () const
 
Scalar x () const
 
Scalar & y ()
 
Scalar & y ()
 
Scalar y () const
 
Scalar y () const
 
Scalar & z ()
 
Scalar & z ()
 
Scalar z () const
 
Scalar z () const
 

Static Public Member Functions

static Quaternion< Scalar > Identity ()
 
static Quaternion< Scalar > Identity ()
 

Detailed Description

template<typename _Scalar, int _Options>
class Eigen::Map< Quaternion< _Scalar >, _Options >

Expression of a quaternion from a memory buffer.

Template Parameters
_Scalarthe type of the Quaternion coefficients
_Optionssee class Map

This is a specialization of class Map for Quaternion. This class allows to view a 4 scalar memory buffer as an Eigen's Quaternion object.

See also
class Map, class Quaternion, class QuaternionBase

Member Typedef Documentation

◆ AngleAxisType

typedef AngleAxis<Scalar> AngleAxisType
inherited

the equivalent angle-axis type

◆ Matrix3

typedef Matrix<Scalar,3,3> Matrix3
inherited

the equivalent rotation matrix type

◆ RotationMatrixType

template<typename Derived, int _Dim>
typedef Matrix<Scalar,Dim,Dim> RotationMatrixType
inherited

corresponding linear transformation matrix type

◆ Vector3

typedef Matrix<Scalar,3,1> Vector3
inherited

the type of a 3D vector

Constructor & Destructor Documentation

◆ Map() [1/4]

template<typename _Scalar, int _Options>
Map ( Scalar * coeffs)
inline

Constructs a Mapped Quaternion object from the pointer coeffs

The pointer coeffs must reference the four coeffecients of Quaternion in the following order:

*coeffs == {x, y, z, w}

If the template parameter _Options is set to Aligned, then the pointer coeffs must be aligned.

◆ Map() [2/4]

Map ( PointerArgType data,
const StrideType & stride = StrideType() )
inline

Constructor in the fixed-size case.

Parameters
datapointer to the array to map
strideoptional Stride object, passing the strides.

◆ Map() [3/4]

Map ( PointerArgType data,
Index size,
const StrideType & stride = StrideType() )
inline

Constructor in the dynamic-size vector case.

Parameters
datapointer to the array to map
sizethe size of the vector expression
strideoptional Stride object, passing the strides.

◆ Map() [4/4]

Map ( PointerArgType data,
Index rows,
Index cols,
const StrideType & stride = StrideType() )
inline

Constructor in the dynamic-size matrix case.

Parameters
datapointer to the array to map
rowsthe number of rows of the matrix expression
colsthe number of columns of the matrix expression
strideoptional Stride object, passing the strides.

Member Function Documentation

◆ _transformVector() [1/2]

Vector3 _transformVector ( Vector3 v) const
inlineinherited

return the result vector of v through the rotation

Rotation of a vector by a quaternion.

Remarks
If the quaternion is used to rotate several points (>1) then it is much more efficient to first convert it to a 3x3 Matrix. Comparison of the operation cost for n transformations:
  • Quaternion2: 30n
  • Via a Matrix3: 24 + 15n

◆ _transformVector() [2/2]

QuaternionBase< Map< Quaternion< _Scalar >, _Options > >::Vector3 _transformVector ( Vector3 v) const
inlineinherited

return the result vector of v through the rotation

Rotation of a vector by a quaternion.

Remarks
If the quaternion is used to rotate several points (>1) then it is much more efficient to first convert it to a 3x3 Matrix. Comparison of the operation cost for n transformations:
  • Quaternion2: 30n
  • Via a Matrix3: 24 + 15n

◆ angularDistance() [1/2]

internal::traits< Map< Quaternion< _Scalar >, _Options > >::Scalar angularDistance ( const QuaternionBase< OtherDerived > & other) const
inlineinherited
Returns
the angle (in radian) between two rotations
See also
dot()

◆ angularDistance() [2/2]

internal::traits< Map< Quaternion< _Scalar >, _Options > >::Scalar angularDistance ( const QuaternionBase< OtherDerived > & other) const
inlineinherited
Returns
the angle (in radian) between two rotations
See also
dot()

◆ cast() [1/2]

internal::cast_return_type< Map< Quaternion< _Scalar >, _Options >, Quaternion< NewScalarType > >::type cast ( ) const
inlineinherited
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.

◆ cast() [2/2]

internal::cast_return_type< Map< Quaternion< _Scalar >, _Options >, Quaternion< NewScalarType > >::type cast ( ) const
inlineinherited
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.

◆ conjugate() [1/2]

Quaternion< Scalar > conjugate ( ) const
inherited
Returns
the conjugated quaternion
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
Quaternion2::inverse()

◆ conjugate() [2/2]

Quaternion< typename internal::traits< Map< Quaternion< _Scalar >, _Options > >::Scalar > conjugate ( ) const
inlineinherited
Returns
the conjugated quaternion
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
Quaternion2::inverse()

◆ dot() [1/2]

Scalar dot ( const QuaternionBase< OtherDerived > & other) const
inlineinherited
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()

◆ dot() [2/2]

Scalar dot ( const QuaternionBase< OtherDerived > & other) const
inlineinherited
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()

◆ Identity() [1/2]

static Quaternion< Scalar > Identity ( )
inlinestaticinherited
Returns
a quaternion representing an identity rotation
See also
MatrixBase::Identity()

◆ Identity() [2/2]

static Quaternion< Scalar > Identity ( )
inlinestaticinherited
Returns
a quaternion representing an identity rotation
See also
MatrixBase::Identity()

◆ inverse() [1/2]

Quaternion< Scalar > inverse ( ) const
inherited
Returns
the quaternion describing the inverse rotation
the multiplicative inverse of *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.
See also
QuaternionBase::conjugate()

◆ inverse() [2/2]

Quaternion< typename internal::traits< Map< Quaternion< _Scalar >, _Options > >::Scalar > inverse ( ) const
inlineinherited
Returns
the quaternion describing the inverse rotation
the multiplicative inverse of *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.
See also
QuaternionBase::conjugate()

◆ isApprox() [1/2]

bool isApprox ( const QuaternionBase< OtherDerived > & other,
RealScalar prec = NumTraits<Scalar>::dummy_precision() ) const
inlineinherited
Returns
true if *this is approximately equal to other, within the precision determined by prec.
See also
MatrixBase::isApprox()

◆ isApprox() [2/2]

bool isApprox ( const QuaternionBase< OtherDerived > & other,
RealScalar prec = NumTraits<Scalar>::dummy_precision() ) const
inlineinherited
Returns
true if *this is approximately equal to other, within the precision determined by prec.
See also
MatrixBase::isApprox()

◆ matrix()

template<typename Derived, int _Dim>
RotationMatrixType matrix ( ) const
inlineinherited
Returns
an equivalent rotation matrix This function is added to be conform with the Transform class' naming scheme.

◆ norm() [1/2]

Scalar norm ( ) const
inlineinherited
Returns
the norm of the quaternion's coefficients
See also
QuaternionBase::squaredNorm(), MatrixBase::norm()

◆ norm() [2/2]

Scalar norm ( ) const
inlineinherited
Returns
the norm of the quaternion's coefficients
See also
QuaternionBase::squaredNorm(), MatrixBase::norm()

◆ normalize() [1/2]

void normalize ( )
inlineinherited

Normalizes the quaternion *this

See also
normalized(), MatrixBase::normalize()

◆ normalize() [2/2]

void normalize ( )
inlineinherited

Normalizes the quaternion *this

See also
normalized(), MatrixBase::normalize()

◆ normalized() [1/2]

Quaternion< Scalar > normalized ( ) const
inlineinherited
Returns
a normalized copy of *this
See also
normalize(), MatrixBase::normalized()

◆ normalized() [2/2]

Quaternion< Scalar > normalized ( ) const
inlineinherited
Returns
a normalized copy of *this
See also
normalize(), MatrixBase::normalized()

◆ operator*() [1/10]

( const EigenBase< OtherDerived > & e) const
inherited
Returns
the concatenation of the rotation *this with a generic expression e e can be:
  • a DimxDim linear transformation matrix
  • a DimxDim diagonal matrix (axis aligned scaling)
  • a vector of size Dim

◆ operator*() [2/10]

internal::rotation_base_generic_product_selector< Map< Quaternion< _Scalar >, _Options >, OtherDerived, OtherDerived::IsVectorAtCompileTime >::ReturnType operator* ( const EigenBase< OtherDerived > & e) const
inlineinherited
Returns
the concatenation of the rotation *this with a generic expression e e can be:
  • a DimxDim linear transformation matrix
  • a DimxDim diagonal matrix (axis aligned scaling)
  • a vector of size Dim

◆ operator*() [3/10]

Quaternion< typename internal::traits< Map< Quaternion< _Scalar >, _Options > >::Scalar > operator* ( const QuaternionBase< OtherDerived > & other) const
inlineinherited
Returns
the concatenation of two rotations as a quaternion-quaternion product

◆ operator*() [4/10]

Quaternion< typename internal::traits< Map< Quaternion< _Scalar >, _Options > >::Scalar > operator* ( const QuaternionBase< OtherDerived > & other) const
inlineinherited
Returns
the concatenation of two rotations as a quaternion-quaternion product

◆ operator*() [5/10]

( const Transform< Scalar, Dim, Mode, Options > & t) const
inherited
Returns
the concatenation of the rotation *this with a transformation t

◆ operator*() [6/10]

Transform< Scalar, Dim, Mode > operator* ( const Transform< Scalar, Dim, Mode, Options > & t) const
inlineinherited
Returns
the concatenation of the rotation *this with a transformation t

◆ operator*() [7/10]

( const Translation< Scalar, Dim > & t) const
inherited
Returns
the concatenation of the rotation *this with a translation t

◆ operator*() [8/10]

Transform< Scalar, Dim, Isometry > operator* ( const Translation< Scalar, Dim > & t) const
inlineinherited
Returns
the concatenation of the rotation *this with a translation t

◆ operator*() [9/10]

( const UniformScaling< Scalar > & s) const
inherited
Returns
the concatenation of the rotation *this with a uniform scaling s

◆ operator*() [10/10]

RotationMatrixType operator* ( const UniformScaling< Scalar > & s) const
inlineinherited
Returns
the concatenation of the rotation *this with a uniform scaling s

◆ operator*=()

template<typename _Scalar, int _Options>
Map< Quaternion< _Scalar >, _Options > & operator*= ( const QuaternionBase< OtherDerived > & q)
inline
See also
operator*(Quaternion)

◆ setFromTwoVectors() [1/2]

Map< Quaternion< _Scalar >, _Options > & setFromTwoVectors ( const MatrixBase< Derived1 > & a,
const MatrixBase< Derived2 > & b )
inherited
Returns
the quaternion which transform a into b through a rotation

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.

Returns
a reference to *this.

Note that the two input vectors do not have to be normalized, and do not need to have the same norm.

◆ setFromTwoVectors() [2/2]

Map< Quaternion< _Scalar >, _Options > & setFromTwoVectors ( const MatrixBase< Derived1 > & a,
const MatrixBase< Derived2 > & b )
inlineinherited
Returns
the quaternion which transform a into b through a rotation

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.

Returns
a reference to *this.

Note that the two input vectors do not have to be normalized, and do not need to have the same norm.

◆ setIdentity() [1/2]

QuaternionBase & setIdentity ( )
inlineinherited

◆ setIdentity() [2/2]

QuaternionBase & setIdentity ( )
inlineinherited

◆ slerp() [1/4]

Quaternion< Scalar > slerp ( Scalar t,
const QuaternionBase< OtherDerived > & other ) const
inherited
Returns
an interpolation for a constant motion between other and *this t in [0;1] see http://en.wikipedia.org/wiki/Slerp

◆ slerp() [2/4]

Quaternion< Scalar > slerp ( Scalar t,
const QuaternionBase< OtherDerived > & other ) const
inherited
Returns
an interpolation for a constant motion between other and *this t in [0;1] see http://en.wikipedia.org/wiki/Slerp

◆ slerp() [3/4]

Quaternion< typename internal::traits< Map< Quaternion< _Scalar >, _Options > >::Scalar > slerp ( Scalar t,
const QuaternionBase< OtherDerived > & other ) const
inherited
Returns
the spherical linear interpolation between the two quaternions *this and other at the parameter t

◆ slerp() [4/4]

Quaternion< typename internal::traits< Map< Quaternion< _Scalar >, _Options > >::Scalar > slerp ( Scalar t,
const QuaternionBase< OtherDerived > & other ) const
inherited
Returns
the spherical linear interpolation between the two quaternions *this and other at the parameter t

◆ squaredNorm() [1/2]

Scalar squaredNorm ( ) const
inlineinherited
Returns
the squared norm of the quaternion's coefficients
See also
QuaternionBase::norm(), MatrixBase::squaredNorm()

◆ squaredNorm() [2/2]

Scalar squaredNorm ( ) const
inlineinherited
Returns
the squared norm of the quaternion's coefficients
See also
QuaternionBase::norm(), MatrixBase::squaredNorm()

◆ toRotationMatrix() [1/2]

Matrix3 toRotationMatrix ( void ) const
inherited
Returns
an equivalent 3x3 rotation matrix

Convert the quaternion to a 3x3 rotation matrix. The quaternion is required to be normalized, otherwise the result is undefined.

◆ toRotationMatrix() [2/2]

QuaternionBase< Map< Quaternion< _Scalar >, _Options > >::Matrix3 toRotationMatrix ( void ) const
inlineinherited
Returns
an equivalent 3x3 rotation matrix

Convert the quaternion to a 3x3 rotation matrix. The quaternion is required to be normalized, otherwise the result is undefined.

◆ vec() [1/4]

VectorBlock< Coefficients, 3 > vec ( )
inlineinherited
Returns
a vector expression of the imaginary part (x,y,z)

◆ vec() [2/4]

VectorBlock< Coefficients, 3 > vec ( )
inlineinherited
Returns
a vector expression of the imaginary part (x,y,z)

◆ vec() [3/4]

const VectorBlock< const Coefficients, 3 > vec ( ) const
inlineinherited
Returns
a read-only vector expression of the imaginary part (x,y,z)

◆ vec() [4/4]

const VectorBlock< const Coefficients, 3 > vec ( ) const
inlineinherited
Returns
a read-only vector expression of the imaginary part (x,y,z)

◆ w() [1/4]

Scalar & w ( )
inlineinherited
Returns
a reference to the w coefficient

◆ w() [2/4]

Scalar & w ( )
inlineinherited
Returns
a reference to the w coefficient

◆ w() [3/4]

Scalar w ( ) const
inlineinherited
Returns
the w coefficient

◆ w() [4/4]

Scalar w ( ) const
inlineinherited
Returns
the w coefficient

◆ x() [1/4]

Scalar & x ( )
inlineinherited
Returns
a reference to the x coefficient

◆ x() [2/4]

Scalar & x ( )
inlineinherited
Returns
a reference to the x coefficient

◆ x() [3/4]

Scalar x ( ) const
inlineinherited
Returns
the x coefficient

◆ x() [4/4]

Scalar x ( ) const
inlineinherited
Returns
the x coefficient

◆ y() [1/4]

Scalar & y ( )
inlineinherited
Returns
a reference to the y coefficient

◆ y() [2/4]

Scalar & y ( )
inlineinherited
Returns
a reference to the y coefficient

◆ y() [3/4]

Scalar y ( ) const
inlineinherited
Returns
the y coefficient

◆ y() [4/4]

Scalar y ( ) const
inlineinherited
Returns
the y coefficient

◆ z() [1/4]

Scalar & z ( )
inlineinherited
Returns
a reference to the z coefficient

◆ z() [2/4]

Scalar & z ( )
inlineinherited
Returns
a reference to the z coefficient

◆ z() [3/4]

Scalar z ( ) const
inlineinherited
Returns
the z coefficient

◆ z() [4/4]

Scalar z ( ) const
inlineinherited
Returns
the z coefficient

The documentation for this class was generated from the following file: