Public Types | Public Member Functions | Static Public Member Functions | Friends
QuaternionBase< Derived > Class Template Reference

Base class for quaternion expressions. More...

#include <Quaternion.h>

+ Inheritance diagram for QuaternionBase< Derived >:

List of all members.

Public Types

enum  { Flags }
enum  
typedef AngleAxis< ScalarAngleAxisType
typedef internal::traits
< Derived >::Coefficients 
Coefficients
typedef Matrix< Scalar, 3, 3 > Matrix3
typedef NumTraits< Scalar >::Real RealScalar
typedef Matrix< Scalar, Dim, DimRotationMatrixType
typedef internal::traits
< Derived >::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
template<class OtherDerived >
Scalar angularDistance (const QuaternionBase< OtherDerived > &other) const
template<typename NewScalarType >
internal::cast_return_type
< Derived, Quaternion
< NewScalarType > >::type 
cast () const
const internal::traits
< Derived >::Coefficients
coeffs () const
internal::traits< Derived >
::Coefficients
coeffs ()
Quaternion< Scalarconjugate () const
const Derived & derived () const
Derived & derived ()
template<class OtherDerived >
Scalar dot (const QuaternionBase< OtherDerived > &other) const
Quaternion< Scalarinverse () const
template<class OtherDerived >
bool isApprox (const QuaternionBase< OtherDerived > &other, RealScalar prec=NumTraits< Scalar >::dummy_precision()) const
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
< Derived, OtherDerived,
OtherDerived::IsVectorAtCompileTime >
::ReturnType 
operator* (const EigenBase< OtherDerived > &e) const
Transform< Scalar, Dim, Mode > operator* (const Transform< Scalar, Dim, Mode, Options > &t) const
template<class OtherDerived >
Quaternion< Scalaroperator* (const QuaternionBase< OtherDerived > &q) const
template<class OtherDerived >
Derived & operator*= (const QuaternionBase< OtherDerived > &q)
QuaternionBase< Derived > & operator= (const QuaternionBase< Derived > &other)
template<class OtherDerived >
Derived & operator= (const QuaternionBase< OtherDerived > &other)
Derived & operator= (const AngleAxisType &aa)
template<class OtherDerived >
Derived & operator= (const MatrixBase< OtherDerived > &m)
template<class MatrixDerived >
Derived & operator= (const MatrixBase< MatrixDerived > &xpr)
template<typename Derived1 , typename Derived2 >
Derived & setFromTwoVectors (const MatrixBase< Derived1 > &a, const MatrixBase< Derived2 > &b)
QuaternionBasesetIdentity ()
template<class OtherDerived >
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 ()

Friends

RotationMatrixType operator* (const EigenBase< OtherDerived > &l, const Derived &r)
Transform< Scalar, Dim, Affineoperator* (const DiagonalMatrix< Scalar, Dim > &l, const Derived &r)

Detailed Description

template<class Derived>
class Eigen::QuaternionBase< Derived >

Base class for quaternion expressions.

This is defined in the Geometry module.

 #include <Eigen/Geometry> 
Template Parameters:
Derivedderived type (CRTP)
See also:
class Quaternion

Member Typedef Documentation

the equivalent angle-axis type

Reimplemented in Quaternion< _Scalar, _Options >.

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

the equivalent rotation matrix type

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

corresponding linear transformation matrix type

typedef internal::traits<Derived>::Scalar Scalar
typedef Matrix<Scalar,3,1> Vector3

the type of a 3D vector

typedef Matrix<Scalar,Dim,1> VectorType [inherited]

Member Enumeration Documentation

anonymous enum
Enumerator:
Flags 
anonymous enum [inherited]

Member Function Documentation

VectorType _transformVector ( const OtherVectorType &  v) const [inline, inherited]
QuaternionBase< Derived >::Vector3 _transformVector ( Vector3  v) const [inline]

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
internal::traits< Derived >::Scalar angularDistance ( const QuaternionBase< OtherDerived > &  other) const [inline]
Returns:
the angle (in radian) between two rotations
See also:
dot()

References abs(), and acos().

internal::cast_return_type<Derived,Quaternion<NewScalarType> >::type cast ( ) const [inline]
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.

const internal::traits<Derived>::Coefficients& coeffs ( ) const [inline]
internal::traits<Derived>::Coefficients& coeffs ( ) [inline]
Returns:
a vector expression of the coefficients (x,y,z,w)

Reimplemented in Map< Quaternion< _Scalar >, _Options >, and Quaternion< _Scalar, _Options >.

Quaternion< typename internal::traits< Derived >::Scalar > conjugate ( ) const [inline]
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()

References Eigen::internal::y.

const Derived& derived ( ) const [inline, inherited]
Derived& derived ( ) [inline, inherited]
Scalar dot ( const QuaternionBase< OtherDerived > &  other) const [inline]
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 ( ) [inline, static]
Returns:
a quaternion representing an identity rotation
See also:
MatrixBase::Identity()
Quaternion< typename internal::traits< Derived >::Scalar > inverse ( ) const [inline]
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< Derived, 3 >.

References conjugate().

bool isApprox ( const QuaternionBase< OtherDerived > &  other,
RealScalar  prec = NumTraits<Scalar>::dummy_precision() 
) const [inline]
Returns:
true if *this is approximately equal to other, within the precision determined by prec.
See also:
MatrixBase::isApprox()
RotationMatrixType matrix ( ) const [inline, inherited]
Returns:
an equivalent rotation matrix This function is added to be conform with the Transform class' naming scheme.

References RotationBase< Derived, _Dim >::derived().

Scalar norm ( ) const [inline]
Returns:
the norm of the quaternion's coefficients
See also:
QuaternionBase::squaredNorm(), MatrixBase::norm()
void normalize ( void  ) [inline]

Normalizes the quaternion *this

See also:
normalized(), MatrixBase::normalize()
Quaternion<Scalar> normalized ( ) const [inline]
Returns:
a normalized copy of *this
See also:
normalize(), MatrixBase::normalized()
Transform<Scalar,Dim,Isometry> operator* ( const Translation< Scalar, Dim > &  t) const [inline, inherited]
Returns:
the concatenation of the rotation *this with a translation t
RotationMatrixType operator* ( const UniformScaling< Scalar > &  s) const [inline, inherited]
Returns:
the concatenation of the rotation *this with a uniform scaling s

References UniformScaling< _Scalar >::factor(), and RotationBase< Derived, _Dim >::toRotationMatrix().

internal::rotation_base_generic_product_selector<Derived,OtherDerived,OtherDerived::IsVectorAtCompileTime>::ReturnType operator* ( const EigenBase< OtherDerived > &  e) const [inline, 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

References EigenBase< Derived >::derived(), and RotationBase< Derived, _Dim >::derived().

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

References RotationBase< Derived, _Dim >::toRotationMatrix().

Quaternion< typename internal::traits< Derived >::Scalar > operator* ( const QuaternionBase< OtherDerived > &  other) const [inline]
Returns:
the concatenation of two rotations as a quaternion-quaternion product

References EIGEN_STATIC_ASSERT, and Eigen::Architecture::Target.

Derived & operator*= ( const QuaternionBase< OtherDerived > &  other) [inline]
See also:
operator*(Quaternion)

References RotationBase< Derived, 3 >::derived().

QuaternionBase< Derived > & operator= ( const QuaternionBase< Derived > &  other) [inline]
Derived & operator= ( const QuaternionBase< OtherDerived > &  other) [inline]
Derived & operator= ( const AngleAxisType aa) [inline]

Set *this from an angle-axis aa and returns a reference to *this

References AngleAxis< _Scalar >::angle(), AngleAxis< _Scalar >::axis(), cos(), and sin().

Derived& operator= ( const MatrixBase< OtherDerived > &  m)
Derived& operator= ( const MatrixBase< MatrixDerived > &  xpr) [inline]

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

References EIGEN_STATIC_ASSERT.

Derived & setFromTwoVectors ( const MatrixBase< Derived1 > &  a,
const MatrixBase< Derived2 > &  b 
) [inline]
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.

References Eigen::ComputeFullV, JacobiSVD< _MatrixType, QRPreconditioner >::matrixV(), MatrixBase< Derived >::normalized(), and sqrt().

Referenced by Quaternion< _Scalar, _Options >::FromTwoVectors().

QuaternionBase& setIdentity ( ) [inline]
Quaternion< typename internal::traits< Derived >::Scalar > slerp ( Scalar  t,
const QuaternionBase< OtherDerived > &  other 
) const
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

References abs(), acos(), QuaternionBase< Derived >::coeffs(), and sin().

Scalar squaredNorm ( ) const [inline]
Returns:
the squared norm of the quaternion's coefficients
See also:
QuaternionBase::norm(), MatrixBase::squaredNorm()
QuaternionBase< Derived >::Matrix3 toRotationMatrix ( void  ) const [inline]
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< Derived, 3 >.

References PlainObjectBase< Derived >::coeffRef(), and Eigen::internal::y.

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

Referenced by AngleAxis< _Scalar >::operator=().

VectorBlock<Coefficients,3> vec ( ) [inline]
Returns:
a vector expression of the imaginary part (x,y,z)
Scalar w ( ) const [inline]
Returns:
the w coefficient

Referenced by AngleAxis< _Scalar >::operator=().

Scalar& w ( ) [inline]
Returns:
a reference to the w coefficient
Scalar x ( ) const [inline]
Returns:
the x coefficient
Scalar& x ( ) [inline]
Returns:
a reference to the x coefficient
Scalar y ( ) const [inline]
Returns:
the y coefficient
Scalar& y ( ) [inline]
Returns:
a reference to the y coefficient
Scalar z ( ) const [inline]
Returns:
the z coefficient
Scalar& z ( ) [inline]
Returns:
a reference to the z coefficient

Friends And Related Function Documentation

RotationMatrixType operator* ( const EigenBase< OtherDerived > &  l,
const Derived &  r 
) [friend, inherited]
Returns:
the concatenation of a linear transformation l with the rotation r
Transform<Scalar,Dim,Affine> operator* ( const DiagonalMatrix< Scalar, Dim > &  l,
const Derived &  r 
) [friend, inherited]
Returns:
the concatenation of a scaling l with the rotation r

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