10#ifndef EIGEN_ROTATION2D_H
11#define EIGEN_ROTATION2D_H
34template<
typename _Scalar>
struct traits<Rotation2D<_Scalar> >
36 typedef _Scalar Scalar;
40template<
typename _Scalar>
47 using Base::operator*;
75 {
return m_angle + other.m_angle; }
79 { m_angle += other.m_angle;
return *
this; }
85 template<
typename Derived>
93 {
return m_angle * (1-t) + other.
angle() * t; }
100 template<
typename NewScalarType>
101 inline typename internal::cast_return_type<Rotation2D,Rotation2D<NewScalarType> >::type
cast()
const
102 {
return typename internal::cast_return_type<Rotation2D,Rotation2D<NewScalarType> >::type(*
this); }
105 template<
typename OtherScalarType>
117 bool isApprox(
const Rotation2D& other,
typename NumTraits<Scalar>::Real prec = NumTraits<Scalar>::dummy_precision())
const
118 {
return internal::isApprox(m_angle,other.m_angle, prec); }
132template<
typename Scalar>
133template<
typename Derived>
136 EIGEN_STATIC_ASSERT(Derived::RowsAtCompileTime==2 && Derived::ColsAtCompileTime==2,YOU_MADE_A_PROGRAMMING_MISTAKE)
137 m_angle = internal::atan2(mat.coeff(1,0), mat.coeff(0,0));
143template<
typename Scalar>
144typename Rotation2D<Scalar>::Matrix2
147 Scalar sinA = internal::sin(m_angle);
148 Scalar cosA = internal::cos(m_angle);
149 return (Matrix2() << cosA, -sinA, sinA, cosA).finished();
Base class for all dense matrices, vectors, and expressions.
Definition MatrixBase.h:50
The matrix class, also used for vectors and row-vectors.
Definition Matrix.h:129
Represents a rotation/orientation in a 2 dimensional space.
Definition Rotation2D.h:42
Rotation2D slerp(Scalar t, const Rotation2D &other) const
Definition Rotation2D.h:92
Rotation2D operator*(const Rotation2D &other) const
Definition Rotation2D.h:74
Rotation2D inverse() const
Definition Rotation2D.h:71
Matrix2 toRotationMatrix(void) const
Definition Rotation2D.h:145
Rotation2D(const Rotation2D< OtherScalarType > &other)
Definition Rotation2D.h:106
bool isApprox(const Rotation2D &other, typename NumTraits< Scalar >::Real prec=NumTraits< Scalar >::dummy_precision()) const
Definition Rotation2D.h:117
Scalar angle() const
Definition Rotation2D.h:65
Scalar & angle()
Definition Rotation2D.h:68
internal::cast_return_type< Rotation2D, Rotation2D< NewScalarType > >::type cast() const
Definition Rotation2D.h:101
_Scalar Scalar
Definition Rotation2D.h:51
Rotation2D & operator*=(const Rotation2D &other)
Definition Rotation2D.h:78
Rotation2D(Scalar a)
Definition Rotation2D.h:62
Common base class for compact rotation representations.
Definition RotationBase.h:30
Rotation2D< double > Rotation2Dd
Definition Rotation2D.h:126
Rotation2D< float > Rotation2Df
Definition Rotation2D.h:123