template<typename _Scalar>
Eigen::Rotation2D class

Represents a rotation/orientation in a 2 dimensional space.

Template parameters
_Scalar the scalar type, i.e., the type of the coefficients

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

This class is equivalent to a single scalar representing a counter clock wise rotation as a single angle in radian. It provides some additional features such as the automatic conversion from/to a 2x2 rotation matrix. Moreover this class aims to provide a similar interface to Quaternion in order to facilitate the writing of generic algorithms dealing with rotations.

Base classes

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

Public types

enum (anonymous) { Dim = 2 }
using Matrix2 = Matrix<Scalar, 2, 2>
using Scalar = _Scalar
using Vector2 = Matrix<Scalar, 2, 1>

Public static functions

static auto Identity() -> Rotation2D

Constructors, destructors, conversion operators

Rotation2D(const Scalar& a) explicit
Rotation2D()
template<typename Derived>
Rotation2D(const MatrixBase<Derived>& m) explicit
template<typename OtherScalarType>
Rotation2D(const Rotation2D<OtherScalarType>& other) explicit

Public functions

auto angle() const -> Scalar
auto angle() -> Scalar&
template<typename NewScalarType>
auto cast() const -> internal::cast_return_type<Rotation2D, Rotation2D<NewScalarType>>::type
template<typename Derived>
auto fromRotationMatrix(const MatrixBase<Derived>& m) -> Rotation2D&
template<typename Derived>
auto fromRotationMatrix(const MatrixBase<Derived>& mat) -> Rotation2D<Scalar>&
auto inverse() const -> Rotation2D
auto isApprox(const Rotation2D& other, const typename NumTraits<Scalar>::Real& prec = NumTraits<Scalar>::dummy_precision()) const -> bool
auto operator*(const Rotation2D& other) const -> Rotation2D
auto operator*(const Vector2& vec) const -> Vector2
auto operator*=(const Rotation2D& other) -> Rotation2D&
template<typename Derived>
auto operator=(const MatrixBase<Derived>& m) -> Rotation2D&
auto slerp(const Scalar& t, const Rotation2D& other) const -> Rotation2D
auto smallestAngle() const -> Scalar
auto smallestPositiveAngle() const -> Scalar
auto toRotationMatrix() const -> Matrix2

Protected variables

Scalar m_angle

Enum documentation

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

Enumerators
Dim

Typedef documentation

template<typename _Scalar>
typedef Matrix<Scalar, 2, 2> Eigen::Rotation2D<_Scalar>::Matrix2

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

the scalar type of the coefficients

template<typename _Scalar>
typedef Matrix<Scalar, 2, 1> Eigen::Rotation2D<_Scalar>::Vector2

Function documentation

template<typename _Scalar>
static Rotation2D Eigen::Rotation2D<_Scalar>::Identity()

template<typename _Scalar>
Eigen::Rotation2D<_Scalar>::Rotation2D(const Scalar& a) explicit

Construct a 2D counter clock wise rotation from the angle a in radian.

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

Default constructor wihtout initialization. The represented rotation is undefined.

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

Construct a 2D rotation from a 2x2 rotation matrix mat.

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

Copy constructor with scalar type conversion

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

Returns the rotation angle

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

Returns a read-write reference to the rotation angle

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

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

Set *this from a 2x2 rotation matrix mat. In other words, this function extract the rotation angle from the rotation matrix.

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

Returns the inverse rotation

template<typename _Scalar>
bool Eigen::Rotation2D<_Scalar>::isApprox(const Rotation2D& 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>
Rotation2D Eigen::Rotation2D<_Scalar>::operator*(const Rotation2D& other) const

Concatenates two rotations

template<typename _Scalar>
Vector2 Eigen::Rotation2D<_Scalar>::operator*(const Vector2& vec) const

Applies the rotation to a 2D vector

template<typename _Scalar>
Rotation2D& Eigen::Rotation2D<_Scalar>::operator*=(const Rotation2D& other)

Concatenates two rotations

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

Set *this from a 2x2 rotation matrix mat. In other words, this function extract the rotation angle from the rotation matrix.

This method is an alias for fromRotationMatrix()

template<typename _Scalar>
Rotation2D Eigen::Rotation2D<_Scalar>::slerp(const Scalar& t, const Rotation2D& other) const

Returns the spherical interpolation between *this and other using parameter t. It is in fact equivalent to a linear interpolation.

template<typename _Scalar>
Scalar Eigen::Rotation2D<_Scalar>::smallestAngle() const

Returns the rotation angle in [-pi,pi]

template<typename _Scalar>
Scalar Eigen::Rotation2D<_Scalar>::smallestPositiveAngle() const

Returns the rotation angle in [0,2pi]

template<typename _Scalar>
Matrix2 Eigen::Rotation2D<_Scalar>::toRotationMatrix() const

Returns an equivalent 2x2 rotation matrix.

Constructs and

Variable documentation

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