compbio
Public Types | Public Member Functions | Static Public Member Functions | List of all members
Eigen::QuaternionBase< Derived > Class Template Reference

More...

#include <Quaternion.h>

Inheritance diagram for Eigen::QuaternionBase< Derived >:
Eigen::RotationBase< Derived, 3 >

Public Types

enum  { Flags = Eigen::internal::traits<Derived>::Flags }
 
typedef RotationBase< Derived, 3 > Base
 
typedef internal::traits< Derived >::Scalar Scalar
 
typedef NumTraits< Scalar >::Real RealScalar
 
typedef internal::traits< Derived >::Coefficients Coefficients
 
typedef Matrix< Scalar, 3, 1 > Vector3
 the type of a 3D vector
 
typedef Matrix< Scalar, 3, 3 > Matrix3
 the equivalent rotation matrix type
 
typedef AngleAxis< Scalar > AngleAxisType
 the equivalent angle-axis type
 
- Public Types inherited from Eigen::RotationBase< Derived, 3 >
enum  
 
typedef internal::traits< Derived >::Scalar Scalar
 the scalar type of the coefficients
 
typedef Matrix< Scalar, Dim, Dim > RotationMatrixType
 corresponding linear transformation matrix type
 
typedef Matrix< Scalar, Dim, 1 > VectorType
 

Public Member Functions

EIGEN_DEVICE_FUNC Scalar x () const
 
EIGEN_DEVICE_FUNC Scalar y () const
 
EIGEN_DEVICE_FUNC Scalar z () const
 
EIGEN_DEVICE_FUNC Scalar w () const
 
EIGEN_DEVICE_FUNC Scalar & x ()
 
EIGEN_DEVICE_FUNC Scalar & y ()
 
EIGEN_DEVICE_FUNC Scalar & z ()
 
EIGEN_DEVICE_FUNC Scalar & w ()
 
EIGEN_DEVICE_FUNC const VectorBlock< const Coefficients, 3 > vec () const
 
EIGEN_DEVICE_FUNC VectorBlock< Coefficients, 3 > vec ()
 
EIGEN_DEVICE_FUNC const internal::traits< Derived >::Coefficients & coeffs () const
 
EIGEN_DEVICE_FUNC internal::traits< Derived >::Coefficients & coeffs ()
 
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE QuaternionBase< Derived > & operator= (const QuaternionBase< Derived > &other)
 
template<class OtherDerived >
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived & operator= (const QuaternionBase< OtherDerived > &other)
 
EIGEN_DEVICE_FUNC Derived & operator= (const AngleAxisType &aa)
 Set *this from an angle-axis aa and returns a reference to *this.
 
template<class OtherDerived >
EIGEN_DEVICE_FUNC Derived & operator= (const MatrixBase< OtherDerived > &m)
 
EIGEN_DEVICE_FUNC QuaternionBasesetIdentity ()
 
EIGEN_DEVICE_FUNC Scalar squaredNorm () const
 
EIGEN_DEVICE_FUNC Scalar norm () const
 
EIGEN_DEVICE_FUNC void normalize ()
 Normalizes the quaternion *this. More...
 
EIGEN_DEVICE_FUNC Quaternion< Scalar > normalized () const
 
template<class OtherDerived >
EIGEN_DEVICE_FUNC Scalar dot (const QuaternionBase< OtherDerived > &other) const
 
template<class OtherDerived >
EIGEN_DEVICE_FUNC Scalar angularDistance (const QuaternionBase< OtherDerived > &other) const
 
EIGEN_DEVICE_FUNC Matrix3 toRotationMatrix () const
 Convert the quaternion to a 3x3 rotation matrix. More...
 
template<typename Derived1 , typename Derived2 >
EIGEN_DEVICE_FUNC Derived & setFromTwoVectors (const MatrixBase< Derived1 > &a, const MatrixBase< Derived2 > &b)
 Sets *this to be a quaternion representing a rotation between the two arbitrary vectors a and b. More...
 
template<class OtherDerived >
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Quaternion< Scalar > operator* (const QuaternionBase< OtherDerived > &q) const
 
template<class OtherDerived >
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived & operator*= (const QuaternionBase< OtherDerived > &q)
 
EIGEN_DEVICE_FUNC Quaternion< Scalar > inverse () const
 
EIGEN_DEVICE_FUNC Quaternion< Scalar > conjugate () const
 
template<class OtherDerived >
EIGEN_DEVICE_FUNC Quaternion< Scalar > slerp (const Scalar &t, const QuaternionBase< OtherDerived > &other) const
 
template<class OtherDerived >
EIGEN_DEVICE_FUNC bool isApprox (const QuaternionBase< OtherDerived > &other, const RealScalar &prec=NumTraits< Scalar >::dummy_precision()) const
 
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Vector3 _transformVector (const Vector3 &v) const
 return the result vector of v through the rotation More...
 
template<typename NewScalarType >
EIGEN_DEVICE_FUNC internal::cast_return_type< Derived, Quaternion< NewScalarType > >::type cast () const
 
template<class OtherDerived >
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Quaternion< typename internal::traits< Derived >::Scalar > operator* (const QuaternionBase< OtherDerived > &other) const
 
template<class MatrixDerived >
EIGEN_DEVICE_FUNC Derived & operator= (const MatrixBase< MatrixDerived > &xpr)
 Set *this from the expression xpr: More...
 
template<class OtherDerived >
EIGEN_DEVICE_FUNC internal::traits< Derived >::Scalar angularDistance (const QuaternionBase< OtherDerived > &other) const
 
template<class OtherDerived >
EIGEN_DEVICE_FUNC Quaternion< typename internal::traits< Derived >::Scalar > slerp (const Scalar &t, const QuaternionBase< OtherDerived > &other) const
 
- Public Member Functions inherited from Eigen::RotationBase< Derived, 3 >
EIGEN_DEVICE_FUNC const Derived & derived () const
 
EIGEN_DEVICE_FUNC Derived & derived ()
 
EIGEN_DEVICE_FUNC RotationMatrixType toRotationMatrix () const
 
EIGEN_DEVICE_FUNC RotationMatrixType matrix () const
 
EIGEN_DEVICE_FUNC Derived inverse () const
 
EIGEN_DEVICE_FUNC Transform< Scalar, Dim, Isometry > operator* (const Translation< Scalar, Dim > &t) const
 
EIGEN_DEVICE_FUNC RotationMatrixType operator* (const UniformScaling< Scalar > &s) const
 
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE internal::rotation_base_generic_product_selector< Derived, OtherDerived, OtherDerived::IsVectorAtCompileTime >::ReturnType operator* (const EigenBase< OtherDerived > &e) const
 
EIGEN_DEVICE_FUNC Transform< Scalar, Dim, Mode > operator* (const Transform< Scalar, Dim, Mode, Options > &t) const
 
EIGEN_DEVICE_FUNC VectorType _transformVector (const OtherVectorType &v) const
 

Static Public Member Functions

static EIGEN_DEVICE_FUNC Quaternion< Scalar > Identity ()
 

Detailed Description

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

Base class for quaternion expressions

Template Parameters
Derivedderived type (CRTP)
See also
class Quaternion

Member Function Documentation

§ _transformVector()

template<class Derived >
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE QuaternionBase< Derived >::Vector3 Eigen::QuaternionBase< Derived >::_transformVector ( const Vector3 v) const

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()

template<class Derived>
template<class OtherDerived >
EIGEN_DEVICE_FUNC internal::traits<Derived>::Scalar Eigen::QuaternionBase< Derived >::angularDistance ( const QuaternionBase< OtherDerived > &  other) const
inline
Returns
the angle (in radian) between two rotations
See also
dot()

§ cast()

template<class Derived>
template<typename NewScalarType >
EIGEN_DEVICE_FUNC internal::cast_return_type<Derived,Quaternion<NewScalarType> >::type Eigen::QuaternionBase< Derived >::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.

§ coeffs() [1/2]

template<class Derived>
EIGEN_DEVICE_FUNC const internal::traits<Derived>::Coefficients& Eigen::QuaternionBase< Derived >::coeffs ( ) const
inline
Returns
a read-only vector expression of the coefficients (x,y,z,w)

§ coeffs() [2/2]

template<class Derived>
EIGEN_DEVICE_FUNC internal::traits<Derived>::Coefficients& Eigen::QuaternionBase< Derived >::coeffs ( )
inline
Returns
a vector expression of the coefficients (x,y,z,w)

§ conjugate()

template<class Derived >
EIGEN_DEVICE_FUNC Quaternion< typename internal::traits< Derived >::Scalar > Eigen::QuaternionBase< Derived >::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()

§ dot()

template<class Derived>
template<class OtherDerived >
EIGEN_DEVICE_FUNC Scalar Eigen::QuaternionBase< Derived >::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()

§ Identity()

template<class Derived>
static EIGEN_DEVICE_FUNC Quaternion<Scalar> Eigen::QuaternionBase< Derived >::Identity ( )
inlinestatic
Returns
a quaternion representing an identity rotation
See also
MatrixBase::Identity()

§ inverse()

template<class Derived >
EIGEN_DEVICE_FUNC Quaternion< typename internal::traits< Derived >::Scalar > Eigen::QuaternionBase< Derived >::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()

§ isApprox()

template<class Derived>
template<class OtherDerived >
EIGEN_DEVICE_FUNC bool Eigen::QuaternionBase< Derived >::isApprox ( const QuaternionBase< OtherDerived > &  other,
const 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()

§ norm()

template<class Derived>
EIGEN_DEVICE_FUNC Scalar Eigen::QuaternionBase< Derived >::norm ( ) const
inline
Returns
the norm of the quaternion's coefficients
See also
QuaternionBase::squaredNorm(), MatrixBase::norm()

§ normalize()

template<class Derived>
EIGEN_DEVICE_FUNC void Eigen::QuaternionBase< Derived >::normalize ( void  )
inline

Normalizes the quaternion *this.

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

§ normalized()

template<class Derived>
EIGEN_DEVICE_FUNC Quaternion<Scalar> Eigen::QuaternionBase< Derived >::normalized ( ) const
inline
Returns
a normalized copy of *this
See also
normalize(), MatrixBase::normalized()

§ operator*()

template<class Derived>
template<class OtherDerived >
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Quaternion<typename internal::traits<Derived>::Scalar> Eigen::QuaternionBase< Derived >::operator* ( const QuaternionBase< OtherDerived > &  other) const
Returns
the concatenation of two rotations as a quaternion-quaternion product

§ operator*=()

template<class Derived >
template<class OtherDerived >
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived & Eigen::QuaternionBase< Derived >::operator*= ( const QuaternionBase< OtherDerived > &  other)
See also
operator*(Quaternion)

§ operator=()

template<class Derived>
template<class MatrixDerived >
EIGEN_DEVICE_FUNC Derived& Eigen::QuaternionBase< 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

§ setFromTwoVectors()

template<class Derived >
template<typename Derived1 , typename Derived2 >
EIGEN_DEVICE_FUNC Derived & Eigen::QuaternionBase< Derived >::setFromTwoVectors ( const MatrixBase< Derived1 > &  a,
const MatrixBase< Derived2 > &  b 
)
inline

Sets *this to be a quaternion representing a rotation between the two arbitrary vectors a and b.

Returns
the quaternion which transform a into b through a rotation

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()

template<class Derived>
EIGEN_DEVICE_FUNC QuaternionBase& Eigen::QuaternionBase< Derived >::setIdentity ( )
inline

§ slerp()

template<class Derived>
template<class OtherDerived >
EIGEN_DEVICE_FUNC Quaternion<typename internal::traits<Derived>::Scalar> Eigen::QuaternionBase< Derived >::slerp ( const Scalar &  t,
const QuaternionBase< OtherDerived > &  other 
) const
Returns
the spherical linear interpolation between the two quaternions *this and other at the parameter t in [0;1].

This represents an interpolation for a constant motion between *this and other, see also http://en.wikipedia.org/wiki/Slerp.

§ squaredNorm()

template<class Derived>
EIGEN_DEVICE_FUNC Scalar Eigen::QuaternionBase< Derived >::squaredNorm ( ) const
inline
Returns
the squared norm of the quaternion's coefficients
See also
QuaternionBase::norm(), MatrixBase::squaredNorm()

§ toRotationMatrix()

template<class Derived >
EIGEN_DEVICE_FUNC QuaternionBase< Derived >::Matrix3 Eigen::QuaternionBase< Derived >::toRotationMatrix ( void  ) const
inline

Convert the quaternion to a 3x3 rotation matrix.

Returns
an equivalent 3x3 rotation matrix

The quaternion is required to be normalized, otherwise the result is undefined.

§ vec() [1/2]

template<class Derived>
EIGEN_DEVICE_FUNC const VectorBlock<const Coefficients,3> Eigen::QuaternionBase< Derived >::vec ( ) const
inline
Returns
a read-only vector expression of the imaginary part (x,y,z)

§ vec() [2/2]

template<class Derived>
EIGEN_DEVICE_FUNC VectorBlock<Coefficients,3> Eigen::QuaternionBase< Derived >::vec ( )
inline
Returns
a vector expression of the imaginary part (x,y,z)

§ w() [1/2]

template<class Derived>
EIGEN_DEVICE_FUNC Scalar Eigen::QuaternionBase< Derived >::w ( ) const
inline
Returns
the w coefficient

§ w() [2/2]

template<class Derived>
EIGEN_DEVICE_FUNC Scalar& Eigen::QuaternionBase< Derived >::w ( )
inline
Returns
a reference to the w coefficient

§ x() [1/2]

template<class Derived>
EIGEN_DEVICE_FUNC Scalar Eigen::QuaternionBase< Derived >::x ( ) const
inline
Returns
the x coefficient

§ x() [2/2]

template<class Derived>
EIGEN_DEVICE_FUNC Scalar& Eigen::QuaternionBase< Derived >::x ( )
inline
Returns
a reference to the x coefficient

§ y() [1/2]

template<class Derived>
EIGEN_DEVICE_FUNC Scalar Eigen::QuaternionBase< Derived >::y ( ) const
inline
Returns
the y coefficient

§ y() [2/2]

template<class Derived>
EIGEN_DEVICE_FUNC Scalar& Eigen::QuaternionBase< Derived >::y ( )
inline
Returns
a reference to the y coefficient

§ z() [1/2]

template<class Derived>
EIGEN_DEVICE_FUNC Scalar Eigen::QuaternionBase< Derived >::z ( ) const
inline
Returns
the z coefficient

§ z() [2/2]

template<class Derived>
EIGEN_DEVICE_FUNC Scalar& Eigen::QuaternionBase< Derived >::z ( )
inline
Returns
a reference to the z coefficient

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