template<typename _Scalar>
Eigen::AngleAxis class

Represents a 3D rotation as a rotation angle around an arbitrary 3D axis.

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

The following two typedefs are provided for convenience:

  • AngleAxisf for float
  • AngleAxisd for double

Combined with MatrixBase::Unit{X,Y,Z}, AngleAxis can be used to easily mimic Euler-angles. Here is an example:

Matrix3f m;
m = AngleAxisf(0.25*M_PI, Vector3f::UnitX())
  * AngleAxisf(0.5*M_PI,  Vector3f::UnitY())
  * AngleAxisf(0.33*M_PI, Vector3f::UnitZ());
cout << m << endl << "is unitary: " << m.isUnitary() << endl;

Output:

1.19e-07        0        1
   0.969   -0.249        0
   0.249    0.969 1.19e-07
is unitary: 1

Base classes

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

Public types

enum (anonymous) { Dim = 3 }
using Matrix3 = Matrix<Scalar, 3, 3>
using QuaternionType = Quaternion<Scalar>
using Scalar = _Scalar
using Vector3 = Matrix<Scalar, 3, 1>

Public static functions

static auto Identity() -> const AngleAxis

Constructors, destructors, conversion operators

AngleAxis()
template<typename Derived>
AngleAxis(const Scalar& angle, const MatrixBase<Derived>& axis)
template<typename QuatDerived>
AngleAxis(const QuaternionBase<QuatDerived>& q) explicit
template<typename Derived>
AngleAxis(const MatrixBase<Derived>& m) explicit
template<typename OtherScalarType>
AngleAxis(const AngleAxis<OtherScalarType>& other) explicit

Public functions

auto angle() const -> Scalar
auto angle() -> Scalar&
auto axis() const -> const Vector3&
auto axis() -> Vector3&
template<typename NewScalarType>
auto cast() const -> internal::cast_return_type<AngleAxis, AngleAxis<NewScalarType>>::type
template<typename Derived>
auto fromRotationMatrix(const MatrixBase<Derived>& m) -> AngleAxis&
template<typename Derived>
auto fromRotationMatrix(const MatrixBase<Derived>& mat) -> AngleAxis<Scalar>&
Sets *this from a 3x3 rotation matrix.
auto inverse() const -> AngleAxis
auto isApprox(const AngleAxis& other, const typename NumTraits<Scalar>::Real& prec = NumTraits<Scalar>::dummy_precision()) const -> bool
auto operator*(const AngleAxis& other) const -> QuaternionType
auto operator*(const QuaternionType& other) const -> QuaternionType
template<class QuatDerived>
auto operator=(const QuaternionBase<QuatDerived>& q) -> AngleAxis&
template<typename Derived>
auto operator=(const MatrixBase<Derived>& m) -> AngleAxis&
template<typename QuatDerived>
auto operator=(const QuaternionBase<QuatDerived>& q) -> AngleAxis<Scalar>&
template<typename Derived>
auto operator=(const MatrixBase<Derived>& mat) -> AngleAxis<Scalar>&
auto toRotationMatrix(void) const -> Matrix3

Protected variables

Scalar m_angle
Vector3 m_axis

Friends

auto operator*(const QuaternionType& a, const AngleAxis& b) -> QuaternionType

Enum documentation

template<typename _Scalar>
enum Eigen::AngleAxis<_Scalar>::(anonymous)

Enumerators
Dim

Typedef documentation

template<typename _Scalar>
typedef Matrix<Scalar, 3, 3> Eigen::AngleAxis<_Scalar>::Matrix3

template<typename _Scalar>
typedef Quaternion<Scalar> Eigen::AngleAxis<_Scalar>::QuaternionType

template<typename _Scalar>
typedef _Scalar Eigen::AngleAxis<_Scalar>::Scalar

the scalar type of the coefficients

template<typename _Scalar>
typedef Matrix<Scalar, 3, 1> Eigen::AngleAxis<_Scalar>::Vector3

Function documentation

template<typename _Scalar>
static const AngleAxis Eigen::AngleAxis<_Scalar>::Identity()

template<typename _Scalar>
Eigen::AngleAxis<_Scalar>::AngleAxis()

Default constructor without initialization.

template<typename _Scalar> template<typename Derived>
Eigen::AngleAxis<_Scalar>::AngleAxis(const Scalar& angle, const MatrixBase<Derived>& axis)

Constructs and initialize the angle-axis rotation from an angle in radian and an axis which must be normalized.

template<typename _Scalar> template<typename QuatDerived>
Eigen::AngleAxis<_Scalar>::AngleAxis(const QuaternionBase<QuatDerived>& q) explicit

Constructs and initialize the angle-axis rotation from a quaternion q. This function implicitly normalizes the quaternion q.

template<typename _Scalar> template<typename Derived>
Eigen::AngleAxis<_Scalar>::AngleAxis(const MatrixBase<Derived>& m) explicit

Constructs and initialize the angle-axis rotation from a 3x3 rotation matrix.

template<typename _Scalar> template<typename OtherScalarType>
Eigen::AngleAxis<_Scalar>::AngleAxis(const AngleAxis<OtherScalarType>& other) explicit

Copy constructor with scalar type conversion

template<typename _Scalar>
Scalar Eigen::AngleAxis<_Scalar>::angle() const

Returns the value of the rotation angle in radian

template<typename _Scalar>
Scalar& Eigen::AngleAxis<_Scalar>::angle()

Returns a read-write reference to the stored angle in radian

template<typename _Scalar>
const Vector3& Eigen::AngleAxis<_Scalar>::axis() const

Returns the rotation axis

template<typename _Scalar>
Vector3& Eigen::AngleAxis<_Scalar>::axis()

Returns a read-write reference to the stored rotation axis.

template<typename _Scalar> template<typename NewScalarType>
internal::cast_return_type<AngleAxis, AngleAxis<NewScalarType>>::type Eigen::AngleAxis<_Scalar>::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<typename _Scalar> template<typename Derived>
AngleAxis& Eigen::AngleAxis<_Scalar>::fromRotationMatrix(const MatrixBase<Derived>& m)

template<typename _Scalar> template<typename Derived>
AngleAxis<Scalar>& Eigen::AngleAxis<_Scalar>::fromRotationMatrix(const MatrixBase<Derived>& mat)

Sets *this from a 3x3 rotation matrix.

template<typename _Scalar>
AngleAxis Eigen::AngleAxis<_Scalar>::inverse() const

Returns the inverse rotation, i.e., an angle-axis with opposite rotation angle

template<typename _Scalar>
bool Eigen::AngleAxis<_Scalar>::isApprox(const AngleAxis& other, const typename NumTraits<Scalar>::Real& prec = NumTraits<Scalar>::dummy_precision()) const

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

template<typename _Scalar>
QuaternionType Eigen::AngleAxis<_Scalar>::operator*(const AngleAxis& other) const

Concatenates two rotations

template<typename _Scalar>
QuaternionType Eigen::AngleAxis<_Scalar>::operator*(const QuaternionType& other) const

Concatenates two rotations

template<typename _Scalar> template<class QuatDerived>
AngleAxis& Eigen::AngleAxis<_Scalar>::operator=(const QuaternionBase<QuatDerived>& q)

template<typename _Scalar> template<typename Derived>
AngleAxis& Eigen::AngleAxis<_Scalar>::operator=(const MatrixBase<Derived>& m)

template<typename _Scalar> template<typename QuatDerived>
AngleAxis<Scalar>& Eigen::AngleAxis<_Scalar>::operator=(const QuaternionBase<QuatDerived>& q)

Set *this from a unit quaternion.

The resulting axis is normalized, and the computed angle is in the [0,pi] range.

This function implicitly normalizes the quaternion q.

template<typename _Scalar> template<typename Derived>
AngleAxis<Scalar>& Eigen::AngleAxis<_Scalar>::operator=(const MatrixBase<Derived>& mat)

Set *this from a 3x3 rotation matrix mat.

template<typename _Scalar>
Matrix3 Eigen::AngleAxis<_Scalar>::toRotationMatrix(void) const

Returns an equivalent 3x3 rotation matrix.

Constructs and

template<typename _Scalar>
QuaternionType operator*(const QuaternionType& a, const AngleAxis& b)

Concatenates two rotations

Variable documentation

template<typename _Scalar>
Scalar Eigen::AngleAxis<_Scalar>::m_angle protected

template<typename _Scalar>
Vector3 Eigen::AngleAxis<_Scalar>::m_axis protected