Shapeworks Studio  2.1
Shape analysis software suite
List of all members | Public Types | Public Member Functions | Static Public Member Functions | Protected Attributes
Eigen::Rotation2D< _Scalar > Class Template Reference

Represents a rotation/orientation in a 2 dimensional space. More...

#include <Rotation2D.h>

+ Inheritance diagram for Eigen::Rotation2D< _Scalar >:
+ Collaboration diagram for Eigen::Rotation2D< _Scalar >:

Public Types

enum  { Dim = 2 }
 
enum  { Dim = 2 }
 
typedef _Scalar Scalar
 
typedef Matrix< Scalar, 2, 1 > Vector2
 
typedef Matrix< Scalar, 2, 2 > Matrix2
 
typedef _Scalar Scalar
 
typedef Matrix< Scalar, 2, 1 > Vector2
 
typedef Matrix< Scalar, 2, 2 > Matrix2
 
- Public Types inherited from Eigen::RotationBase< Rotation2D< _Scalar >, 2 >
enum  
 
enum  
 
typedef ei_traits< Rotation2D< _Scalar > >::Scalar Scalar
 
typedef internal::traits< Rotation2D< _Scalar > >::Scalar Scalar
 
typedef Matrix< Scalar, Dim, Dim > RotationMatrixType
 
typedef Matrix< Scalar, Dim, Dim > RotationMatrixType
 
typedef Matrix< Scalar, Dim, 1 > VectorType
 

Public Member Functions

 Rotation2D (Scalar a)
 
Scalar angle () const
 
Scalarangle ()
 
Rotation2D inverse () const
 
Rotation2D operator* (const Rotation2D &other) const
 
Rotation2Doperator*= (const Rotation2D &other)
 
Vector2 operator* (const Vector2 &vec) const
 
template<typename Derived >
Rotation2DfromRotationMatrix (const MatrixBase< Derived > &m)
 
Matrix2 toRotationMatrix (void) const
 
Rotation2D slerp (Scalar t, const Rotation2D &other) const
 
template<typename NewScalarType >
internal::cast_return_type< Rotation2D, Rotation2D< NewScalarType > >::type cast () const
 
template<typename OtherScalarType >
 Rotation2D (const Rotation2D< OtherScalarType > &other)
 
bool isApprox (const Rotation2D &other, typename NumTraits< Scalar >::Real prec=precision< Scalar >()) const
 
 Rotation2D (const Scalar &a)
 
Scalar angle () const
 
Scalarangle ()
 
Rotation2D inverse () const
 
Rotation2D operator* (const Rotation2D &other) const
 
Rotation2Doperator*= (const Rotation2D &other)
 
Vector2 operator* (const Vector2 &vec) const
 
template<typename Derived >
Rotation2DfromRotationMatrix (const MatrixBase< Derived > &m)
 
Matrix2 toRotationMatrix (void) const
 
Rotation2D slerp (const Scalar &t, const Rotation2D &other) const
 
template<typename NewScalarType >
internal::cast_return_type< Rotation2D, Rotation2D< NewScalarType > >::type cast () const
 
template<typename OtherScalarType >
 Rotation2D (const Rotation2D< OtherScalarType > &other)
 
bool isApprox (const Rotation2D &other, const typename NumTraits< Scalar >::Real &prec=NumTraits< Scalar >::dummy_precision()) const
 
template<typename Derived >
Rotation2D< Scalar > & fromRotationMatrix (const MatrixBase< Derived > &mat)
 
- Public Member Functions inherited from Eigen::RotationBase< Rotation2D< _Scalar >, 2 >
const Rotation2D< _Scalar > & derived () const
 
Rotation2D< _Scalar > & derived ()
 
const Rotation2D< _Scalar > & derived () const
 
Rotation2D< _Scalar > & derived ()
 
RotationMatrixType toRotationMatrix () const
 
RotationMatrixType toRotationMatrix () const
 
Rotation2D< _Scalar > inverse () const
 
Rotation2D< _Scalar > inverse () const
 
Transform< Scalar, Dim > operator* (const Translation< Scalar, Dim > &t) const
 
RotationMatrixType operator* (const Scaling< Scalar, Dim > &s) const
 
Transform< Scalar, Dim > operator* (const Transform< Scalar, Dim > &t) const
 
Transform< Scalar, Dim, Isometry > operator* (const Translation< Scalar, Dim > &t) const
 
RotationMatrixType operator* (const UniformScaling< Scalar > &s) const
 
EIGEN_STRONG_INLINE internal::rotation_base_generic_product_selector< Rotation2D< _Scalar >, OtherDerived, OtherDerived::IsVectorAtCompileTime >::ReturnType operator* (const EigenBase< OtherDerived > &e) const
 
Transform< Scalar, Dim, Mode > operator* (const Transform< Scalar, Dim, Mode, Options > &t) const
 
RotationMatrixType matrix () const
 
VectorType _transformVector (const OtherVectorType &v) const
 

Static Public Member Functions

static Rotation2D Identity ()
 

Protected Attributes

Scalar m_angle
 

Detailed Description

template<typename _Scalar>
class Eigen::Rotation2D< _Scalar >

Represents a rotation/orientation in a 2 dimensional space.

Parameters
_Scalarthe scalar type, i.e., the type of the coefficients

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.

See also
class Quaternion, class Transform

Definition at line 234 of file ForwardDeclarations.h.

Member Typedef Documentation

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

the scalar type of the coefficients

Definition at line 46 of file Rotation2D.h.

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

the scalar type of the coefficients

Definition at line 51 of file Rotation2D.h.

Constructor & Destructor Documentation

template<typename _Scalar>
Eigen::Rotation2D< _Scalar >::Rotation2D ( Scalar  a)
inline

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

Definition at line 57 of file Rotation2D.h.

57 : m_angle(a) {}
template<typename _Scalar>
template<typename OtherScalarType >
Eigen::Rotation2D< _Scalar >::Rotation2D ( const Rotation2D< OtherScalarType > &  other)
inlineexplicit

Copy constructor with scalar type conversion

Definition at line 101 of file Rotation2D.h.

102  {
103  m_angle = Scalar(other.angle());
104  }
template<typename _Scalar>
Eigen::Rotation2D< _Scalar >::Rotation2D ( const Scalar a)
inline

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

Definition at line 62 of file Rotation2D.h.

62 : m_angle(a) {}
template<typename _Scalar>
template<typename OtherScalarType >
Eigen::Rotation2D< _Scalar >::Rotation2D ( const Rotation2D< OtherScalarType > &  other)
inlineexplicit

Copy constructor with scalar type conversion

Definition at line 106 of file Rotation2D.h.

107  {
108  m_angle = Scalar(other.angle());
109  }

Member Function Documentation

template<typename _Scalar>
Scalar Eigen::Rotation2D< _Scalar >::angle ( ) const
inline
Returns
the rotation angle

Definition at line 60 of file Rotation2D.h.

60 { return m_angle; }
template<typename _Scalar>
Scalar& Eigen::Rotation2D< _Scalar >::angle ( )
inline
Returns
a read-write reference to the rotation angle

Definition at line 63 of file Rotation2D.h.

63 { return m_angle; }
template<typename _Scalar>
Scalar Eigen::Rotation2D< _Scalar >::angle ( ) const
inline
Returns
the rotation angle

Definition at line 65 of file Rotation2D.h.

65 { return m_angle; }
template<typename _Scalar>
Scalar& Eigen::Rotation2D< _Scalar >::angle ( )
inline
Returns
a read-write reference to the rotation angle

Definition at line 68 of file Rotation2D.h.

68 { return m_angle; }
template<typename _Scalar>
template<typename NewScalarType >
internal::cast_return_type<Rotation2D,Rotation2D<NewScalarType> >::type Eigen::Rotation2D< _Scalar >::cast ( ) const
inline
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.

Definition at line 96 of file Rotation2D.h.

97  { return typename internal::cast_return_type<Rotation2D,Rotation2D<NewScalarType> >::type(*this); }
template<typename _Scalar>
template<typename NewScalarType >
internal::cast_return_type<Rotation2D,Rotation2D<NewScalarType> >::type Eigen::Rotation2D< _Scalar >::cast ( ) const
inline
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.

Definition at line 101 of file Rotation2D.h.

102  { return typename internal::cast_return_type<Rotation2D,Rotation2D<NewScalarType> >::type(*this); }
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.

Definition at line 127 of file Rotation2D.h.

128 {
129  EIGEN_STATIC_ASSERT(Derived::RowsAtCompileTime==2 && Derived::ColsAtCompileTime==2,YOU_MADE_A_PROGRAMMING_MISTAKE)
130  m_angle = ei_atan2(mat.coeff(1,0), mat.coeff(0,0));
131  return *this;
132 }
template<typename _Scalar>
Rotation2D Eigen::Rotation2D< _Scalar >::inverse ( void  ) const
inline
Returns
the inverse rotation

Definition at line 66 of file Rotation2D.h.

66 { return -m_angle; }
template<typename _Scalar>
Rotation2D Eigen::Rotation2D< _Scalar >::inverse ( void  ) const
inline
Returns
the inverse rotation

Definition at line 71 of file Rotation2D.h.

71 { return -m_angle; }
template<typename _Scalar>
bool Eigen::Rotation2D< _Scalar >::isApprox ( const Rotation2D< _Scalar > &  other,
typename NumTraits< Scalar >::Real  prec = precision<Scalar>() 
) const
inline
Returns
true if *this is approximately equal to other, within the precision determined by prec.
See also
MatrixBase::isApprox()

Definition at line 110 of file Rotation2D.h.

111  { return ei_isApprox(m_angle,other.m_angle, prec); }
template<typename _Scalar>
bool Eigen::Rotation2D< _Scalar >::isApprox ( const Rotation2D< _Scalar > &  other,
const typename NumTraits< Scalar >::Real &  prec = NumTraits<Scalar>::dummy_precision() 
) const
inline
Returns
true if *this is approximately equal to other, within the precision determined by prec.
See also
MatrixBase::isApprox()

Definition at line 117 of file Rotation2D.h.

118  { return internal::isApprox(m_angle,other.m_angle, prec); }
template<typename _Scalar>
Rotation2D Eigen::Rotation2D< _Scalar >::operator* ( const Rotation2D< _Scalar > &  other) const
inline

Concatenates two rotations

Definition at line 69 of file Rotation2D.h.

70  { return m_angle + other.m_angle; }
template<typename _Scalar>
Rotation2D Eigen::Rotation2D< _Scalar >::operator* ( const Rotation2D< _Scalar > &  other) const
inline

Concatenates two rotations

Definition at line 74 of file Rotation2D.h.

75  { return m_angle + other.m_angle; }
template<typename _Scalar>
Vector2 Eigen::Rotation2D< _Scalar >::operator* ( const Vector2 vec) const
inline

Applies the rotation to a 2D vector

Definition at line 77 of file Rotation2D.h.

78  { return toRotationMatrix() * vec; }
Matrix2 toRotationMatrix(void) const
Definition: Rotation2D.h:138
template<typename _Scalar>
Vector2 Eigen::Rotation2D< _Scalar >::operator* ( const Vector2 vec) const
inline

Applies the rotation to a 2D vector

Definition at line 82 of file Rotation2D.h.

83  { return toRotationMatrix() * vec; }
Matrix2 toRotationMatrix(void) const
Definition: Rotation2D.h:138
template<typename _Scalar>
Rotation2D& Eigen::Rotation2D< _Scalar >::operator*= ( const Rotation2D< _Scalar > &  other)
inline

Concatenates two rotations

Definition at line 73 of file Rotation2D.h.

74  { return m_angle += other.m_angle; return *this; }
template<typename _Scalar>
Rotation2D& Eigen::Rotation2D< _Scalar >::operator*= ( const Rotation2D< _Scalar > &  other)
inline

Concatenates two rotations

Definition at line 78 of file Rotation2D.h.

79  { m_angle += other.m_angle; return *this; }
template<typename _Scalar>
Rotation2D Eigen::Rotation2D< _Scalar >::slerp ( Scalar  t,
const Rotation2D< _Scalar > &  other 
) const
inline
Returns
the spherical interpolation between *this and other using parameter t. It is in fact equivalent to a linear interpolation.

Definition at line 87 of file Rotation2D.h.

88  { return m_angle * (1-t) + other.angle() * t; }
template<typename _Scalar>
Rotation2D Eigen::Rotation2D< _Scalar >::slerp ( const Scalar t,
const Rotation2D< _Scalar > &  other 
) const
inline
Returns
the spherical interpolation between *this and other using parameter t. It is in fact equivalent to a linear interpolation.

Definition at line 92 of file Rotation2D.h.

93  { return m_angle * (1-t) + other.angle() * t; }
template<typename Scalar >
Rotation2D< Scalar >::Matrix2 Eigen::Rotation2D< Scalar >::toRotationMatrix ( void  ) const

Constructs and

Returns
an equivalent 2x2 rotation matrix.

Definition at line 138 of file Rotation2D.h.

139 {
140  Scalar sinA = ei_sin(m_angle);
141  Scalar cosA = ei_cos(m_angle);
142  return (Matrix2() << cosA, -sinA, sinA, cosA).finished();
143 }

The documentation for this class was generated from the following files: