template<class Derived>
Eigen::QuaternionBase class

Base class for quaternion expressions.

Template parameters
Derived derived type (CRTP)

This is defined in the Geometry module. #include <Eigen/Geometry>

Base classes

template<typename Derived, int _Dim>
class RotationBase
Common base class for compact rotation representations.

Public types

enum (anonymous) { Flags = Eigen::internal::traits<Derived>::Flags }
using AngleAxisType = AngleAxis<Scalar>
using Base = RotationBase<Derived, 3>
using Coefficients = internal::traits<Derived>::Coefficients
using CoeffReturnType = Coefficients::CoeffReturnType
using Matrix3 = Matrix<Scalar, 3, 3>
using NonConstCoeffReturnType = internal::conditional<bool(internal::traits<Derived>::Flags&LvalueBit), Scalar&, CoeffReturnType>::type
using RealScalar = NumTraits<Scalar>::Real
using Scalar = internal::traits<Derived>::Scalar
using Vector3 = Matrix<Scalar, 3, 1>

Public static functions

static auto Identity() -> Quaternion<Scalar>

Public functions

auto _transformVector(const Vector3& v) const -> Vector3
template<class OtherDerived>
auto angularDistance(const QuaternionBase<OtherDerived>& other) const -> Scalar
template<class OtherDerived>
auto angularDistance(const QuaternionBase<OtherDerived>& other) const -> internal::traits<Derived>::Scalar
template<typename NewScalarType>
auto cast() const -> internal::cast_return_type<Derived, Quaternion<NewScalarType>>::type
auto coeffs() const -> const internal::traits<Derived>::Coefficients&
auto coeffs() -> internal::traits<Derived>::Coefficients&
auto conjugate() const -> Quaternion<Scalar>
template<class OtherDerived>
auto dot(const QuaternionBase<OtherDerived>& other) const -> Scalar
auto inverse() const -> Quaternion<Scalar>
template<class OtherDerived>
auto isApprox(const QuaternionBase<OtherDerived>& other, const RealScalar& prec = NumTraits<Scalar>::dummy_precision()) const -> bool
auto norm() const -> Scalar
void normalize()
auto normalized() const -> Quaternion<Scalar>
template<class OtherDerived>
auto operator*(const QuaternionBase<OtherDerived>& q) const -> Quaternion<Scalar>
template<class OtherDerived>
auto operator*(const QuaternionBase<OtherDerived>& other) const -> Quaternion<typename internal::traits<Derived>::Scalar>
template<class OtherDerived>
auto operator*=(const QuaternionBase<OtherDerived>& q) -> Derived&
auto operator=(const QuaternionBase<Derived>& other) -> QuaternionBase<Derived>&
template<class OtherDerived>
auto operator=(const QuaternionBase<OtherDerived>& other) -> Derived&
auto operator=(const AngleAxisType& aa) -> Derived&
template<class OtherDerived>
auto operator=(const MatrixBase<OtherDerived>& m) -> Derived&
template<class MatrixDerived>
auto operator=(const MatrixBase<MatrixDerived>& xpr) -> Derived&
template<typename Derived1, typename Derived2>
auto setFromTwoVectors(const MatrixBase<Derived1>& a, const MatrixBase<Derived2>& b) -> Derived&
auto setIdentity() -> QuaternionBase&
template<class OtherDerived>
auto slerp(const Scalar& t, const QuaternionBase<OtherDerived>& other) const -> Quaternion<Scalar>
template<class OtherDerived>
auto slerp(const Scalar& t, const QuaternionBase<OtherDerived>& other) const -> Quaternion<typename internal::traits<Derived>::Scalar>
auto squaredNorm() const -> Scalar
auto toRotationMatrix() const -> Matrix3
auto vec() const -> const VectorBlock<const Coefficients, 3>
auto vec() -> VectorBlock<Coefficients, 3>
auto w() const -> CoeffReturnType
auto w() -> NonConstCoeffReturnType
auto x() const -> CoeffReturnType
auto x() -> NonConstCoeffReturnType
auto y() const -> CoeffReturnType
auto y() -> NonConstCoeffReturnType
auto z() const -> CoeffReturnType
auto z() -> NonConstCoeffReturnType

Enum documentation

template<class Derived>
enum Eigen::QuaternionBase<Derived>::(anonymous)

Enumerators
Flags

Typedef documentation

template<class Derived>
typedef AngleAxis<Scalar> Eigen::QuaternionBase<Derived>::AngleAxisType

the equivalent angle-axis type

template<class Derived>
typedef RotationBase<Derived, 3> Eigen::QuaternionBase<Derived>::Base

template<class Derived>
typedef internal::traits<Derived>::Coefficients Eigen::QuaternionBase<Derived>::Coefficients

template<class Derived>
typedef Coefficients::CoeffReturnType Eigen::QuaternionBase<Derived>::CoeffReturnType

template<class Derived>
typedef Matrix<Scalar, 3, 3> Eigen::QuaternionBase<Derived>::Matrix3

the equivalent rotation matrix type

template<class Derived>
typedef internal::conditional<bool(internal::traits<Derived>::Flags&LvalueBit), Scalar&, CoeffReturnType>::type Eigen::QuaternionBase<Derived>::NonConstCoeffReturnType

template<class Derived>
typedef NumTraits<Scalar>::Real Eigen::QuaternionBase<Derived>::RealScalar

template<class Derived>
typedef internal::traits<Derived>::Scalar Eigen::QuaternionBase<Derived>::Scalar

template<class Derived>
typedef Matrix<Scalar, 3, 1> Eigen::QuaternionBase<Derived>::Vector3

the type of a 3D vector

Function documentation

template<class Derived>
static Quaternion<Scalar> Eigen::QuaternionBase<Derived>::Identity()

Returns a quaternion representing an identity rotation

template<class 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.

template<class Derived> template<class OtherDerived>
Scalar Eigen::QuaternionBase<Derived>::angularDistance(const QuaternionBase<OtherDerived>& other) const

template<class Derived> template<class OtherDerived>
internal::traits<Derived>::Scalar Eigen::QuaternionBase<Derived>::angularDistance(const QuaternionBase<OtherDerived>& other) const

Returns the angle (in radian) between two rotations

template<class Derived> template<typename NewScalarType>
internal::cast_return_type<Derived, Quaternion<NewScalarType>>::type Eigen::QuaternionBase<Derived>::cast() const

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.

template<class Derived>
const internal::traits<Derived>::Coefficients& Eigen::QuaternionBase<Derived>::coeffs() const

Returns a read-only vector expression of the coefficients (x,y,z,w)

template<class Derived>
internal::traits<Derived>::Coefficients& Eigen::QuaternionBase<Derived>::coeffs()

Returns a vector expression of the coefficients (x,y,z,w)

template<class Derived>
Quaternion<Scalar> Eigen::QuaternionBase<Derived>::conjugate() const

Returns the conjugated quaternion

template<class Derived> template<class OtherDerived>
Scalar Eigen::QuaternionBase<Derived>::dot(const QuaternionBase<OtherDerived>& other) const

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.

template<class Derived>
Quaternion<Scalar> Eigen::QuaternionBase<Derived>::inverse() const

Returns the quaternion describing the inverse rotation

template<class Derived> template<class OtherDerived>
bool Eigen::QuaternionBase<Derived>::isApprox(const QuaternionBase<OtherDerived>& other, const RealScalar& prec = NumTraits<Scalar>::dummy_precision()) const

Returns true if *this is approximately equal to other, within the precision determined by prec.

template<class Derived>
Scalar Eigen::QuaternionBase<Derived>::norm() const

Returns the norm of the quaternion's coefficients

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

Normalizes the quaternion *this

template<class Derived>
Quaternion<Scalar> Eigen::QuaternionBase<Derived>::normalized() const

Returns a normalized copy of *this

template<class Derived> template<class OtherDerived>
Quaternion<Scalar> Eigen::QuaternionBase<Derived>::operator*(const QuaternionBase<OtherDerived>& q) const

template<class Derived> template<class OtherDerived>
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

template<class Derived> template<class OtherDerived>
Derived& Eigen::QuaternionBase<Derived>::operator*=(const QuaternionBase<OtherDerived>& q)

template<class Derived>
QuaternionBase<Derived>& Eigen::QuaternionBase<Derived>::operator=(const QuaternionBase<Derived>& other)

template<class Derived> template<class OtherDerived>
Derived& Eigen::QuaternionBase<Derived>::operator=(const QuaternionBase<OtherDerived>& other)

template<class Derived>
Derived& Eigen::QuaternionBase<Derived>::operator=(const AngleAxisType& aa)

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

template<class Derived> template<class OtherDerived>
Derived& Eigen::QuaternionBase<Derived>::operator=(const MatrixBase<OtherDerived>& m)

template<class Derived> template<class MatrixDerived>
Derived& Eigen::QuaternionBase<Derived>::operator=(const MatrixBase<MatrixDerived>& xpr)

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

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

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.

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

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

template<class Derived> template<class OtherDerived>
Quaternion<Scalar> Eigen::QuaternionBase<Derived>::slerp(const Scalar& t, const QuaternionBase<OtherDerived>& other) const

template<class Derived> template<class OtherDerived>
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.

template<class Derived>
Scalar Eigen::QuaternionBase<Derived>::squaredNorm() const

Returns the squared norm of the quaternion's coefficients

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

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.

template<class Derived>
const VectorBlock<const Coefficients, 3> Eigen::QuaternionBase<Derived>::vec() const

Returns a read-only vector expression of the imaginary part (x,y,z)

template<class Derived>
VectorBlock<Coefficients, 3> Eigen::QuaternionBase<Derived>::vec()

Returns a vector expression of the imaginary part (x,y,z)

template<class Derived>
CoeffReturnType Eigen::QuaternionBase<Derived>::w() const

Returns the w coefficient

template<class Derived>
NonConstCoeffReturnType Eigen::QuaternionBase<Derived>::w()

Returns a reference to the w coefficient (if Derived is a non-const lvalue)

template<class Derived>
CoeffReturnType Eigen::QuaternionBase<Derived>::x() const

Returns the x coefficient

template<class Derived>
NonConstCoeffReturnType Eigen::QuaternionBase<Derived>::x()

Returns a reference to the x coefficient (if Derived is a non-const lvalue)

template<class Derived>
CoeffReturnType Eigen::QuaternionBase<Derived>::y() const

Returns the y coefficient

template<class Derived>
NonConstCoeffReturnType Eigen::QuaternionBase<Derived>::y()

Returns a reference to the y coefficient (if Derived is a non-const lvalue)

template<class Derived>
CoeffReturnType Eigen::QuaternionBase<Derived>::z() const

Returns the z coefficient

template<class Derived>
NonConstCoeffReturnType Eigen::QuaternionBase<Derived>::z()

Returns a reference to the z coefficient (if Derived is a non-const lvalue)