Public Types | Public Member Functions | Static Public Member Functions | Protected Attributes | List of all members
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

enum  
enum  
typedef AngleAxis< ScalarAngleAxisType
typedef internal::traits< Map >
::Coefficients 
Coefficients
typedef Matrix< Scalar, 3, 3 > Matrix3
typedef NumTraits< Scalar >::Real RealScalar
typedef Matrix< Scalar, Dim, DimRotationMatrixType
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
< Map< Quaternion< _Scalar >
, _Options >, Quaternion
< NewScalarType > >::type 
cast () const
Coefficientscoeffs ()
const Coefficientscoeffs () const
Quaternion< Scalarconjugate () const
const Map< Quaternion< _Scalar >
, _Options > & 
derived () const
Map< Quaternion< _Scalar >
, _Options > & 
derived ()
Scalar dot (const QuaternionBase< OtherDerived > &other) const
Quaternion< Scalarinverse () const
bool isApprox (const QuaternionBase< OtherDerived > &other, RealScalar prec=NumTraits< Scalar >::dummy_precision()) const
 Map (Scalar *coeffs)
RotationMatrixType matrix () const
Scalar norm () const
void normalize ()
Quaternion< Scalarnormalized () const
Transform< Scalar, Dim, Isometryoperator* (const Translation< Scalar, Dim > &t) const
RotationMatrixType operator* (const UniformScaling< Scalar > &s) const
internal::rotation_base_generic_product_selector
< Map< 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< Scalaroperator* (const QuaternionBase< OtherDerived > &q) const
Map< Quaternion< _Scalar >
, _Options > & 
operator*= (const QuaternionBase< OtherDerived > &q)
Map< Quaternion< _Scalar >
, _Options > & 
setFromTwoVectors (const MatrixBase< Derived1 > &a, const MatrixBase< Derived2 > &b)
QuaternionBasesetIdentity ()
Quaternion< Scalarslerp (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
Scalarw ()
Scalar x () const
Scalarx ()
Scalar y () const
Scalary ()
Scalar z () const
Scalarz ()

Static Public Member Functions

static Quaternion< ScalarIdentity ()

Protected Attributes

Coefficients m_coeffs

Detailed Description

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

Expression of a quaternion from a memory buffer.

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

typedef AngleAxis<Scalar> AngleAxisType
inherited

the equivalent angle-axis type

typedef internal::traits<Map>::Coefficients Coefficients
typedef Matrix<Scalar,3,3> Matrix3
inherited

the equivalent rotation matrix type

typedef NumTraits<Scalar>::Real RealScalar
inherited
typedef Matrix<Scalar,Dim,Dim> RotationMatrixType
inherited

corresponding linear transformation matrix type

typedef _Scalar Scalar
typedef Matrix<Scalar,3,1> Vector3
inherited

the type of a 3D vector

typedef Matrix<Scalar,Dim,1> VectorType
inherited

Member Enumeration Documentation

anonymous enum
inherited
anonymous enum
inherited

Constructor & Destructor Documentation

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.

Member Function Documentation

VectorType _transformVector ( const OtherVectorType &  v) const
inlineinherited
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
Scalar angularDistance ( const QuaternionBase< OtherDerived > &  other) const
inherited
Returns
the angle (in radian) between two rotations
See Also
dot()
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.

Coefficients& coeffs ( )
inline
Returns
a vector expression of the coefficients (x,y,z,w)

Reimplemented from QuaternionBase< Map< Quaternion< _Scalar >, _Options > >.

const Coefficients& coeffs ( ) const
inline
Returns
a read-only vector expression of the coefficients (x,y,z,w)

Reimplemented from QuaternionBase< Map< Quaternion< _Scalar >, _Options > >.

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()
const Map< Quaternion< _Scalar >, _Options > & derived ( ) const
inlineinherited
Map< Quaternion< _Scalar >, _Options > & derived ( )
inlineinherited
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()
static Quaternion<Scalar> Identity ( )
inlinestaticinherited
Returns
a quaternion representing an identity rotation
See Also
MatrixBase::Identity()
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()

Reimplemented from RotationBase< Map< Quaternion< _Scalar >, _Options >, 3 >.

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()
RotationMatrixType matrix ( ) const
inlineinherited
Returns
an equivalent rotation matrix This function is added to be conform with the Transform class' naming scheme.
Scalar norm ( ) const
inlineinherited
Returns
the norm of the quaternion's coefficients
See Also
QuaternionBase::squaredNorm(), MatrixBase::norm()
void normalize ( void  )
inlineinherited

Normalizes the quaternion *this

See Also
normalized(), MatrixBase::normalize()
Quaternion<Scalar> normalized ( ) const
inlineinherited
Returns
a normalized copy of *this
See Also
normalize(), MatrixBase::normalized()
Transform<Scalar,Dim,Isometry> operator* ( const Translation< Scalar, Dim > &  t) const
inlineinherited
Returns
the concatenation of the rotation *this with a translation t
RotationMatrixType operator* ( const UniformScaling< Scalar > &  s) const
inlineinherited
Returns
the concatenation of the rotation *this with a uniform scaling s
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
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
Quaternion<Scalar> operator* ( const QuaternionBase< OtherDerived > &  q) const
inlineinherited
Returns
the concatenation of two rotations as a quaternion-quaternion product
Map< Quaternion< _Scalar >, _Options > & operator*= ( const QuaternionBase< OtherDerived > &  q)
inlineinherited
See Also
operator*(Quaternion)
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.

QuaternionBase& setIdentity ( )
inlineinherited
See Also
QuaternionBase::Identity(), MatrixBase::setIdentity()
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
the spherical linear interpolation between the two quaternions *this and other at the parameter t
Scalar squaredNorm ( ) const
inlineinherited
Returns
the squared norm of the quaternion's coefficients
See Also
QuaternionBase::norm(), MatrixBase::squaredNorm()
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.

Reimplemented from RotationBase< Map< Quaternion< _Scalar >, _Options >, 3 >.

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

Member Data Documentation

Coefficients m_coeffs
protected

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