25 #ifndef EIGEN_ROTATIONBASE_H
26 #define EIGEN_ROTATIONBASE_H
32 template<
typename RotationDerived,
typename MatrixType,
bool IsVector=MatrixType::IsVectorAtCompileTime>
33 struct rotation_base_generic_product_selector;
43 template<
typename Derived,
int _Dim>
49 typedef typename internal::traits<Derived>::Scalar
Scalar;
56 inline const Derived&
derived()
const {
return *
static_cast<const Derived*
>(
this); }
57 inline Derived&
derived() {
return *
static_cast<Derived*
>(
this); }
84 template<
typename OtherDerived>
85 EIGEN_STRONG_INLINE typename internal::rotation_base_generic_product_selector<Derived,OtherDerived,OtherDerived::IsVectorAtCompileTime>::ReturnType
87 {
return internal::rotation_base_generic_product_selector<Derived,OtherDerived>::run(
derived(), e.
derived()); }
90 template<
typename OtherDerived>
friend
92 {
return l.
derived() * r.toRotationMatrix(); }
98 res.
linear().applyOnTheLeft(l);
103 template<
int Mode,
int Options>
107 template<
typename OtherVectorType>
115 template<
typename RotationDerived,
typename MatrixType>
116 struct rotation_base_generic_product_selector<RotationDerived,MatrixType,false>
118 enum { Dim = RotationDerived::Dim };
119 typedef Matrix<typename RotationDerived::Scalar,Dim,Dim> ReturnType;
120 static inline ReturnType run(
const RotationDerived& r,
const MatrixType& m)
121 {
return r.toRotationMatrix() * m; }
124 template<
typename RotationDerived,
typename Scalar,
int Dim,
int MaxDim>
125 struct rotation_base_generic_product_selector< RotationDerived, DiagonalMatrix<Scalar,Dim,MaxDim>, false >
127 typedef Transform<Scalar,Dim,Affine> ReturnType;
128 static inline ReturnType run(
const RotationDerived& r,
const DiagonalMatrix<Scalar,Dim,MaxDim>& m)
136 template<
typename RotationDerived,
typename OtherVectorType>
137 struct rotation_base_generic_product_selector<RotationDerived,OtherVectorType,true>
139 enum { Dim = RotationDerived::Dim };
140 typedef Matrix<typename RotationDerived::Scalar,Dim,1> ReturnType;
141 static EIGEN_STRONG_INLINE ReturnType run(
const RotationDerived& r,
const OtherVectorType& v)
143 return r._transformVector(v);
153 template<
typename _Scalar,
int _Rows,
int _Cols,
int _Storage,
int _MaxRows,
int _MaxCols>
154 template<
typename OtherDerived>
166 template<
typename _Scalar,
int _Rows,
int _Cols,
int _Storage,
int _MaxRows,
int _MaxCols>
167 template<
typename OtherDerived>
196 template<
typename Scalar,
int Dim>
200 return
Rotation2D<Scalar>(s).toRotationMatrix();
203 template<typename Scalar,
int Dim, typename OtherDerived>
204 static inline
Matrix<Scalar,Dim,Dim> toRotationMatrix(const
RotationBase<OtherDerived,Dim>& r)
206 return r.toRotationMatrix();
209 template<
typename Scalar,
int Dim,
typename OtherDerived>
210 static inline const MatrixBase<OtherDerived>& toRotationMatrix(
const MatrixBase<OtherDerived>& mat)
212 EIGEN_STATIC_ASSERT(OtherDerived::RowsAtCompileTime==Dim && OtherDerived::ColsAtCompileTime==Dim,
213 YOU_MADE_A_PROGRAMMING_MISTAKE)
221 #endif // EIGEN_ROTATIONBASE_H