00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00037 template<typename Derived, int _Dim>
00038 class RotationBase
00039 {
00040 public:
00041 enum { Dim = _Dim };
00043 typedef typename ei_traits<Derived>::Scalar Scalar;
00044
00046 typedef Matrix<Scalar,Dim,Dim> RotationMatrixType;
00047
00048 inline const Derived& derived() const { return *static_cast<const Derived*>(this); }
00049 inline Derived& derived() { return *static_cast<Derived*>(this); }
00050
00052 inline RotationMatrixType toRotationMatrix() const { return derived().toRotationMatrix(); }
00053
00055 inline Derived inverse() const { return derived().inverse(); }
00056
00058 inline Transform<Scalar,Dim> operator*(const Translation<Scalar,Dim>& t) const
00059 { return toRotationMatrix() * t; }
00060
00062 inline RotationMatrixType operator*(const Scaling<Scalar,Dim>& s) const
00063 { return toRotationMatrix() * s; }
00064
00066 inline Transform<Scalar,Dim> operator*(const Transform<Scalar,Dim>& t) const
00067 { return toRotationMatrix() * t; }
00068 };
00069
00074 template<typename _Scalar, int _Rows, int _Cols, int _Storage, int _MaxRows, int _MaxCols>
00075 template<typename OtherDerived>
00076 Matrix<_Scalar, _Rows, _Cols, _Storage, _MaxRows, _MaxCols>
00077 ::Matrix(const RotationBase<OtherDerived,ColsAtCompileTime>& r)
00078 {
00079 EIGEN_STATIC_ASSERT_MATRIX_SPECIFIC_SIZE(Matrix,int(OtherDerived::Dim),int(OtherDerived::Dim))
00080 *this = r.toRotationMatrix();
00081 }
00082
00087 template<typename _Scalar, int _Rows, int _Cols, int _Storage, int _MaxRows, int _MaxCols>
00088 template<typename OtherDerived>
00089 Matrix<_Scalar, _Rows, _Cols, _Storage, _MaxRows, _MaxCols>&
00090 Matrix<_Scalar, _Rows, _Cols, _Storage, _MaxRows, _MaxCols>
00091 ::operator=(const RotationBase<OtherDerived,ColsAtCompileTime>& r)
00092 {
00093 EIGEN_STATIC_ASSERT_MATRIX_SPECIFIC_SIZE(Matrix,int(OtherDerived::Dim),int(OtherDerived::Dim))
00094 return *this = r.toRotationMatrix();
00095 }
00096
00115 template<typename Scalar, int Dim>
00116 inline static Matrix<Scalar,2,2> ei_toRotationMatrix(const Scalar& s)
00117 {
00118 EIGEN_STATIC_ASSERT(Dim==2,YOU_MADE_A_PROGRAMMING_MISTAKE)
00119 return Rotation2D<Scalar>(s).toRotationMatrix();
00120 }
00121
00122 template<typename Scalar, int Dim, typename OtherDerived>
00123 inline static Matrix<Scalar,Dim,Dim> ei_toRotationMatrix(const RotationBase<OtherDerived,Dim>& r)
00124 {
00125 return r.toRotationMatrix();
00126 }
00127
00128 template<typename Scalar, int Dim, typename OtherDerived>
00129 inline static const MatrixBase<OtherDerived>& ei_toRotationMatrix(const MatrixBase<OtherDerived>& mat)
00130 {
00131 EIGEN_STATIC_ASSERT(OtherDerived::RowsAtCompileTime==Dim && OtherDerived::ColsAtCompileTime==Dim,
00132 YOU_MADE_A_PROGRAMMING_MISTAKE)
00133 return mat;
00134 }