10#ifndef EIGEN_ROTATIONBASE_H
11#define EIGEN_ROTATIONBASE_H
14#include "./InternalHeaderCheck.h"
20template <
typename RotationDerived,
typename MatrixType,
bool IsVector = MatrixType::IsVectorAtCompileTime>
21struct rotation_base_generic_product_selector;
31template <
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(); }
73 template <
typename OtherDerived>
74 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
75 typename internal::rotation_base_generic_product_selector<Derived, OtherDerived,
76 OtherDerived::IsVectorAtCompileTime>::ReturnType
78 return internal::rotation_base_generic_product_selector<Derived, OtherDerived>::run(derived(), e.
derived());
82 template <
typename OtherDerived>
84 return l.
derived() * r.toRotationMatrix();
91 res.
linear().applyOnTheLeft(l);
96 template <
int Mode,
int Options>
102 template <
typename OtherVectorType>
103 EIGEN_DEVICE_FUNC
inline VectorType _transformVector(
const OtherVectorType& v)
const {
111template <
typename RotationDerived,
typename MatrixType>
112struct rotation_base_generic_product_selector<RotationDerived, MatrixType, false> {
113 enum { Dim = RotationDerived::Dim };
114 typedef Matrix<typename RotationDerived::Scalar, Dim, Dim> ReturnType;
115 EIGEN_DEVICE_FUNC
static inline ReturnType run(
const RotationDerived& r,
const MatrixType& m) {
116 return r.toRotationMatrix() * m;
120template <
typename RotationDerived,
typename Scalar,
int Dim,
int MaxDim>
121struct rotation_base_generic_product_selector<RotationDerived, DiagonalMatrix<Scalar, Dim, MaxDim>, false> {
122 typedef Transform<Scalar, Dim, Affine> ReturnType;
123 EIGEN_DEVICE_FUNC
static inline ReturnType run(
const RotationDerived& r,
124 const DiagonalMatrix<Scalar, Dim, MaxDim>& m) {
131template <
typename RotationDerived,
typename OtherVectorType>
132struct rotation_base_generic_product_selector<RotationDerived, OtherVectorType, true> {
133 enum { Dim = RotationDerived::Dim };
134 typedef Matrix<typename RotationDerived::Scalar, Dim, 1> ReturnType;
135 EIGEN_DEVICE_FUNC
static EIGEN_STRONG_INLINE ReturnType run(
const RotationDerived& r,
const OtherVectorType& v) {
136 return r._transformVector(v);
146template <
typename Scalar_,
int Rows_,
int Cols_,
int Storage_,
int MaxRows_,
int MaxCols_>
147template <
typename OtherDerived>
150 EIGEN_STATIC_ASSERT_MATRIX_SPECIFIC_SIZE(
Matrix,
int(OtherDerived::Dim),
int(OtherDerived::Dim))
158template <
typename Scalar_,
int Rows_,
int Cols_,
int Storage_,
int MaxRows_,
int MaxCols_>
159template <
typename OtherDerived>
163 EIGEN_STATIC_ASSERT_MATRIX_SPECIFIC_SIZE(
Matrix,
int(OtherDerived::Dim),
int(OtherDerived::Dim))
187template <
typename Scalar,
int Dim>
189 EIGEN_STATIC_ASSERT(Dim == 2, YOU_MADE_A_PROGRAMMING_MISTAKE)
193template <
typename Scalar,
int Dim,
typename OtherDerived>
194EIGEN_DEVICE_FUNC
static inline Matrix<Scalar, Dim, Dim> toRotationMatrix(
const RotationBase<OtherDerived, Dim>& r) {
195 return r.toRotationMatrix();
198template <
typename Scalar,
int Dim,
typename OtherDerived>
199EIGEN_DEVICE_FUNC
static inline const MatrixBase<OtherDerived>& toRotationMatrix(
const MatrixBase<OtherDerived>& mat) {
200 EIGEN_STATIC_ASSERT(OtherDerived::RowsAtCompileTime == Dim && OtherDerived::ColsAtCompileTime == Dim,
201 YOU_MADE_A_PROGRAMMING_MISTAKE)
Represents a diagonal matrix with its storage.
Definition DiagonalMatrix.h:172
The matrix class, also used for vectors and row-vectors.
Definition Matrix.h:186
Represents a rotation/orientation in a 2 dimensional space.
Definition Rotation2D.h:44
Matrix2 toRotationMatrix() const
Definition Rotation2D.h:191
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:77
Derived inverse() const
Definition RotationBase.h:55
friend RotationMatrixType operator*(const EigenBase< OtherDerived > &l, const Derived &r)
Definition RotationBase.h:83
Transform< Scalar, Dim, Isometry > operator*(const Translation< Scalar, Dim > &t) const
Definition RotationBase.h:58
Matrix< Scalar, Dim, Dim > RotationMatrixType
Definition RotationBase.h:39
Transform< Scalar, Dim, Mode > operator*(const Transform< Scalar, Dim, Mode, Options > &t) const
Definition RotationBase.h:97
RotationMatrixType operator*(const UniformScaling< Scalar > &s) const
Definition RotationBase.h:63
friend Transform< Scalar, Dim, Affine > operator*(const DiagonalMatrix< Scalar, Dim > &l, const Derived &r)
Definition RotationBase.h:88
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 Core:137
Definition EigenBase.h:33
Derived & derived()
Definition EigenBase.h:49