10#ifndef EIGEN_ROTATIONBASE_H
11#define EIGEN_ROTATIONBASE_H
13#include "./InternalHeaderCheck.h"
19template<
typename RotationDerived,
typename MatrixType,
bool IsVector=MatrixType::IsVectorAtCompileTime>
20struct rotation_base_generic_product_selector;
30template<
typename Derived,
int Dim_>
36 typedef typename internal::traits<Derived>::Scalar
Scalar;
43 EIGEN_DEVICE_FUNC
inline const Derived& derived()
const {
return *
static_cast<const Derived*
>(
this); }
44 EIGEN_DEVICE_FUNC
inline Derived& derived() {
return *
static_cast<Derived*
>(
this); }
55 EIGEN_DEVICE_FUNC
inline Derived
inverse()
const {
return derived().inverse(); }
71 template<
typename OtherDerived>
72 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
typename internal::rotation_base_generic_product_selector<Derived,OtherDerived,OtherDerived::IsVectorAtCompileTime>::ReturnType
74 {
return internal::rotation_base_generic_product_selector<Derived,OtherDerived>::run(derived(), e.
derived()); }
77 template<
typename OtherDerived>
friend
79 {
return l.
derived() * r.toRotationMatrix(); }
85 res.
linear().applyOnTheLeft(l);
90 template<
int Mode,
int Options>
94 template<
typename OtherVectorType>
95 EIGEN_DEVICE_FUNC
inline VectorType _transformVector(
const OtherVectorType& v)
const
102template<
typename RotationDerived,
typename MatrixType>
103struct rotation_base_generic_product_selector<RotationDerived,MatrixType,false>
105 enum { Dim = RotationDerived::Dim };
106 typedef Matrix<typename RotationDerived::Scalar,Dim,Dim> ReturnType;
107 EIGEN_DEVICE_FUNC
static inline ReturnType run(
const RotationDerived& r,
const MatrixType& m)
108 {
return r.toRotationMatrix() * m; }
111template<
typename RotationDerived,
typename Scalar,
int Dim,
int MaxDim>
112struct rotation_base_generic_product_selector< RotationDerived, DiagonalMatrix<Scalar,Dim,MaxDim>, false >
114 typedef Transform<Scalar,Dim,Affine> ReturnType;
115 EIGEN_DEVICE_FUNC
static inline ReturnType run(
const RotationDerived& r,
const DiagonalMatrix<Scalar,Dim,MaxDim>& m)
123template<
typename RotationDerived,
typename OtherVectorType>
124struct rotation_base_generic_product_selector<RotationDerived,OtherVectorType,true>
126 enum { Dim = RotationDerived::Dim };
127 typedef Matrix<typename RotationDerived::Scalar,Dim,1> ReturnType;
128 EIGEN_DEVICE_FUNC
static EIGEN_STRONG_INLINE ReturnType run(
const RotationDerived& r,
const OtherVectorType& v)
130 return r._transformVector(v);
140template<
typename Scalar_,
int Rows_,
int Cols_,
int _Storage,
int MaxRows_,
int MaxCols_>
141template<
typename OtherDerived>
145 EIGEN_STATIC_ASSERT_MATRIX_SPECIFIC_SIZE(
Matrix,
int(OtherDerived::Dim),
int(OtherDerived::Dim))
153template<
typename Scalar_,
int Rows_,
int Cols_,
int _Storage,
int MaxRows_,
int MaxCols_>
154template<
typename OtherDerived>
159 EIGEN_STATIC_ASSERT_MATRIX_SPECIFIC_SIZE(
Matrix,
int(OtherDerived::Dim),
int(OtherDerived::Dim))
183template<
typename Scalar,
int Dim>
186 EIGEN_STATIC_ASSERT(Dim==2,YOU_MADE_A_PROGRAMMING_MISTAKE)
190template<
typename Scalar,
int Dim,
typename OtherDerived>
191EIGEN_DEVICE_FUNC
static inline Matrix<Scalar,Dim,Dim> toRotationMatrix(
const RotationBase<OtherDerived,Dim>& r)
193 return r.toRotationMatrix();
196template<
typename Scalar,
int Dim,
typename OtherDerived>
197EIGEN_DEVICE_FUNC
static inline const MatrixBase<OtherDerived>& toRotationMatrix(
const MatrixBase<OtherDerived>& mat)
199 EIGEN_STATIC_ASSERT(OtherDerived::RowsAtCompileTime==Dim && OtherDerived::ColsAtCompileTime==Dim,
200 YOU_MADE_A_PROGRAMMING_MISTAKE)
Represents a diagonal matrix with its storage.
Definition: DiagonalMatrix.h:144
The matrix class, also used for vectors and row-vectors.
Definition: Matrix.h:182
Matrix()
Default constructor.
Definition: Matrix.h:261
Matrix & operator=(const Matrix &other)
Assigns matrices to each other.
Definition: Matrix.h:208
Represents a rotation/orientation in a 2 dimensional space.
Definition: Rotation2D.h:44
Matrix2 toRotationMatrix() const
Definition: Rotation2D.h:190
Common base class for compact rotation representations.
Definition: RotationBase.h:32
RotationMatrixType matrix() const
Definition: RotationBase.h:52
internal::rotation_base_generic_product_selector< Derived, OtherDerived, OtherDerived::IsVectorAtCompileTime >::ReturnType operator*(const EigenBase< OtherDerived > &e) const
Definition: RotationBase.h:73
Derived inverse() const
Definition: RotationBase.h:55
Matrix< Scalar, Dim, Dim > RotationMatrixType
Definition: RotationBase.h:39
friend RotationMatrixType operator*(const EigenBase< OtherDerived > &l, const Derived &r)
Definition: RotationBase.h:78
Transform< Scalar, Dim, Isometry > operator*(const Translation< Scalar, Dim > &t) const
Definition: RotationBase.h:58
Transform< Scalar, Dim, Mode > operator*(const Transform< Scalar, Dim, Mode, Options > &t) const
Definition: RotationBase.h:91
RotationMatrixType operator*(const UniformScaling< Scalar > &s) const
Definition: RotationBase.h:62
friend Transform< Scalar, Dim, Affine > operator*(const DiagonalMatrix< Scalar, Dim > &l, const Derived &r)
Definition: RotationBase.h:82
internal::traits< Derived >::Scalar Scalar
Definition: RotationBase.h:36
RotationMatrixType toRotationMatrix() const
Definition: RotationBase.h:47
Represents a translation transformation.
Definition: Translation.h:33
Namespace containing all symbols from the Eigen library.
Definition: B01_Experimental.dox:1
Definition: EigenBase.h:32
Derived & derived()
Definition: EigenBase.h:48