10 #ifndef EIGEN_ROTATION2D_H
11 #define EIGEN_ROTATION2D_H
34 template<
typename _Scalar>
struct traits<Rotation2D<_Scalar> >
36 typedef _Scalar Scalar;
40 template<
typename _Scalar>
41 class Rotation2D :
public RotationBase<Rotation2D<_Scalar>,2>
43 typedef RotationBase<Rotation2D<_Scalar>,2> Base;
47 using Base::operator*;
78 {
return m_angle + other.m_angle; }
82 { m_angle += other.m_angle;
return *
this; }
88 template<
typename Derived>
96 {
return m_angle * (1-t) + other.angle() * t; }
103 template<
typename NewScalarType>
104 inline typename internal::cast_return_type<Rotation2D,Rotation2D<NewScalarType> >::type
cast()
const
105 {
return typename internal::cast_return_type<Rotation2D,Rotation2D<NewScalarType> >::type(*
this); }
108 template<
typename OtherScalarType>
111 m_angle =
Scalar(other.angle());
121 {
return internal::isApprox(m_angle,other.m_angle, prec); }
135 template<
typename Scalar>
136 template<
typename Derived>
140 EIGEN_STATIC_ASSERT(Derived::RowsAtCompileTime==2 && Derived::ColsAtCompileTime==2,YOU_MADE_A_PROGRAMMING_MISTAKE)
141 m_angle = atan2(mat.coeff(1,0), mat.coeff(0,0));
147 template<
typename Scalar>
153 Scalar sinA = sin(m_angle);
154 Scalar cosA = cos(m_angle);
155 return (
Matrix2() << cosA, -sinA, sinA, cosA).finished();
160 #endif // EIGEN_ROTATION2D_H
Matrix2 toRotationMatrix() const
Definition: Rotation2D.h:149
Rotation2D< double > Rotation2Dd
Definition: Rotation2D.h:129
Holds information about the various numeric (i.e. scalar) types allowed by Eigen. ...
Definition: NumTraits.h:88
Rotation2D(const Scalar &a)
Definition: Rotation2D.h:62
_Scalar Scalar
Definition: Rotation2D.h:51
Rotation2D inverse() const
Definition: Rotation2D.h:74
Rotation2D slerp(const Scalar &t, const Rotation2D &other) const
Definition: Rotation2D.h:95
Rotation2D operator*(const Rotation2D &other) const
Definition: Rotation2D.h:77
Rotation2D()
Definition: Rotation2D.h:65
Rotation2D< float > Rotation2Df
Definition: Rotation2D.h:126
internal::cast_return_type< Rotation2D, Rotation2D< NewScalarType > >::type cast() const
Definition: Rotation2D.h:104
Rotation2D & operator*=(const Rotation2D &other)
Definition: Rotation2D.h:81
Represents a rotation/orientation in a 2 dimensional space.
Definition: ForwardDeclarations.h:234
bool isApprox(const Rotation2D &other, const typename NumTraits< Scalar >::Real &prec=NumTraits< Scalar >::dummy_precision()) const
Definition: Rotation2D.h:120
Rotation2D(const Rotation2D< OtherScalarType > &other)
Definition: Rotation2D.h:109
Scalar angle() const
Definition: Rotation2D.h:68
The matrix class, also used for vectors and row-vectors.
Definition: Matrix.h:127
Base class for all dense matrices, vectors, and expressions.
Definition: MatrixBase.h:48
Scalar & angle()
Definition: Rotation2D.h:71