RotationBase.h
Go to the documentation of this file.
1 // This file is part of Eigen, a lightweight C++ template library
2 // for linear algebra.
3 //
4 // Copyright (C) 2008 Gael Guennebaud <gael.guennebaud@inria.fr>
5 //
6 // This Source Code Form is subject to the terms of the Mozilla
7 // Public License v. 2.0. If a copy of the MPL was not distributed
8 // with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 
10 #ifndef EIGEN_ROTATIONBASE_H
11 #define EIGEN_ROTATIONBASE_H
12 
13 namespace Eigen {
14 
15 // forward declaration
16 namespace internal {
17 template<typename RotationDerived, typename MatrixType, bool IsVector=MatrixType::IsVectorAtCompileTime>
19 }
20 
28 template<typename Derived, int _Dim>
29 class RotationBase
30 {
31  public:
32  enum { Dim = _Dim };
35 
39 
40  public:
41  EIGEN_DEVICE_FUNC inline const Derived& derived() const { return *static_cast<const Derived*>(this); }
42  EIGEN_DEVICE_FUNC inline Derived& derived() { return *static_cast<Derived*>(this); }
43 
45  EIGEN_DEVICE_FUNC inline RotationMatrixType toRotationMatrix() const { return derived().toRotationMatrix(); }
46 
50  EIGEN_DEVICE_FUNC inline RotationMatrixType matrix() const { return derived().toRotationMatrix(); }
51 
53  EIGEN_DEVICE_FUNC inline Derived inverse() const { return derived().inverse(); }
54 
57  { return Transform<Scalar,Dim,Isometry>(*this) * t; }
58 
61  { return toRotationMatrix() * s.factor(); }
62 
69  template<typename OtherDerived>
73 
75  template<typename OtherDerived> friend
77  { return l.derived() * r.toRotationMatrix(); }
78 
81  {
83  res.linear().applyOnTheLeft(l);
84  return res;
85  }
86 
88  template<int Mode, int Options>
90  { return toRotationMatrix() * t; }
91 
92  template<typename OtherVectorType>
93  EIGEN_DEVICE_FUNC inline VectorType _transformVector(const OtherVectorType& v) const
94  { return toRotationMatrix() * v; }
95 };
96 
97 namespace internal {
98 
99 // implementation of the generic product rotation * matrix
100 template<typename RotationDerived, typename MatrixType>
102 {
103  enum { Dim = RotationDerived::Dim };
105  EIGEN_DEVICE_FUNC static inline ReturnType run(const RotationDerived& r, const MatrixType& m)
106  { return r.toRotationMatrix() * m; }
107 };
108 
109 template<typename RotationDerived, typename Scalar, int Dim, int MaxDim>
110 struct rotation_base_generic_product_selector< RotationDerived, DiagonalMatrix<Scalar,Dim,MaxDim>, false >
111 {
113  EIGEN_DEVICE_FUNC static inline ReturnType run(const RotationDerived& r, const DiagonalMatrix<Scalar,Dim,MaxDim>& m)
114  {
115  ReturnType res(r);
116  res.linear() *= m;
117  return res;
118  }
119 };
120 
121 template<typename RotationDerived,typename OtherVectorType>
122 struct rotation_base_generic_product_selector<RotationDerived,OtherVectorType,true>
123 {
124  enum { Dim = RotationDerived::Dim };
126  EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE ReturnType run(const RotationDerived& r, const OtherVectorType& v)
127  {
128  return r._transformVector(v);
129  }
130 };
131 
132 } // end namespace internal
133 
138 template<typename _Scalar, int _Rows, int _Cols, int _Storage, int _MaxRows, int _MaxCols>
139 template<typename OtherDerived>
142 {
143  EIGEN_STATIC_ASSERT_MATRIX_SPECIFIC_SIZE(Matrix,int(OtherDerived::Dim),int(OtherDerived::Dim))
144  *this = r.toRotationMatrix();
145 }
146 
151 template<typename _Scalar, int _Rows, int _Cols, int _Storage, int _MaxRows, int _MaxCols>
152 template<typename OtherDerived>
156 {
157  EIGEN_STATIC_ASSERT_MATRIX_SPECIFIC_SIZE(Matrix,int(OtherDerived::Dim),int(OtherDerived::Dim))
158  return *this = r.toRotationMatrix();
159 }
160 
161 namespace internal {
162 
181 template<typename Scalar, int Dim>
183 {
184  EIGEN_STATIC_ASSERT(Dim==2,YOU_MADE_A_PROGRAMMING_MISTAKE)
186 }
187 
188 template<typename Scalar, int Dim, typename OtherDerived>
190 {
191  return r.toRotationMatrix();
192 }
193 
194 template<typename Scalar, int Dim, typename OtherDerived>
196 {
197  EIGEN_STATIC_ASSERT(OtherDerived::RowsAtCompileTime==Dim && OtherDerived::ColsAtCompileTime==Dim,
198  YOU_MADE_A_PROGRAMMING_MISTAKE)
199  return mat;
200 }
201 
202 } // end namespace internal
203 
204 } // end namespace Eigen
205 
206 #endif // EIGEN_ROTATIONBASE_H
Eigen::internal::rotation_base_generic_product_selector< RotationDerived, OtherVectorType, true >::ReturnType
Matrix< typename RotationDerived::Scalar, Dim, 1 > ReturnType
Definition: RotationBase.h:125
Eigen::internal::toRotationMatrix
static EIGEN_DEVICE_FUNC Matrix< Scalar, 2, 2 > toRotationMatrix(const Scalar &s)
Definition: RotationBase.h:182
EIGEN_DEVICE_FUNC
#define EIGEN_DEVICE_FUNC
Definition: Macros.h:976
Eigen
Namespace containing all symbols from the Eigen library.
Definition: jet.h:637
Eigen::DiagonalMatrix
Represents a diagonal matrix with its storage.
Definition: DiagonalMatrix.h:140
Eigen::Transform
Represents an homogeneous transformation in a N dimensional space.
Definition: ForwardDeclarations.h:294
s
RealScalar s
Definition: level1_cplx_impl.h:126
e
Array< double, 1, 3 > e(1./3., 0.5, 2.)
MatrixType
MatrixXf MatrixType
Definition: benchmark-blocking-sizes.cpp:52
Eigen::EigenBase
Definition: EigenBase.h:29
EIGEN_STATIC_ASSERT_MATRIX_SPECIFIC_SIZE
#define EIGEN_STATIC_ASSERT_MATRIX_SPECIFIC_SIZE(TYPE, ROWS, COLS)
Definition: StaticAssert.h:162
Eigen::RotationBase::derived
const EIGEN_DEVICE_FUNC Derived & derived() const
Definition: RotationBase.h:41
Eigen::RotationBase::Dim
@ Dim
Definition: RotationBase.h:32
mat
MatrixXf mat
Definition: Tutorial_AdvancedInitialization_CommaTemporary.cpp:1
res
cout<< "Here is the matrix m:"<< endl<< m<< endl;Matrix< ptrdiff_t, 3, 1 > res
Definition: PartialRedux_count.cpp:3
Eigen::internal::rotation_base_generic_product_selector
Definition: RotationBase.h:18
Eigen::internal::rotation_base_generic_product_selector< RotationDerived, MatrixType, false >::ReturnType
Matrix< typename RotationDerived::Scalar, Dim, Dim > ReturnType
Definition: RotationBase.h:104
Eigen::RotationBase::Scalar
internal::traits< Derived >::Scalar Scalar
Definition: RotationBase.h:34
Eigen::RotationBase::toRotationMatrix
EIGEN_DEVICE_FUNC RotationMatrixType toRotationMatrix() const
Definition: RotationBase.h:45
Eigen::internal::rotation_base_generic_product_selector< RotationDerived, OtherVectorType, true >::run
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE ReturnType run(const RotationDerived &r, const OtherVectorType &v)
Definition: RotationBase.h:126
Eigen::RotationBase::operator*
EIGEN_DEVICE_FUNC Transform< Scalar, Dim, Isometry > operator*(const Translation< Scalar, Dim > &t) const
Definition: RotationBase.h:56
Eigen::RotationBase
Common base class for compact rotation representations.
Definition: ForwardDeclarations.h:286
Eigen::internal::rotation_base_generic_product_selector< RotationDerived, MatrixType, false >::run
static EIGEN_DEVICE_FUNC ReturnType run(const RotationDerived &r, const MatrixType &m)
Definition: RotationBase.h:105
l
static const Line3 l(Rot3(), 1, 1)
EIGEN_STRONG_INLINE
#define EIGEN_STRONG_INLINE
Definition: Macros.h:917
Eigen::RotationBase::VectorType
Matrix< Scalar, Dim, 1 > VectorType
Definition: RotationBase.h:38
Eigen::internal::rotation_base_generic_product_selector< RotationDerived, DiagonalMatrix< Scalar, Dim, MaxDim >, false >::run
static EIGEN_DEVICE_FUNC ReturnType run(const RotationDerived &r, const DiagonalMatrix< Scalar, Dim, MaxDim > &m)
Definition: RotationBase.h:113
Eigen::RotationBase::matrix
EIGEN_DEVICE_FUNC RotationMatrixType matrix() const
Definition: RotationBase.h:50
gtsam.examples.DogLegOptimizerExample.run
def run(args)
Definition: DogLegOptimizerExample.py:21
m
Matrix3f m
Definition: AngleAxis_mimic_euler.cpp:1
Eigen::QuaternionBase::derived
const EIGEN_DEVICE_FUNC Derived & derived() const
Definition: RotationBase.h:41
Eigen::Rotation2D
Represents a rotation/orientation in a 2 dimensional space.
Definition: ForwardDeclarations.h:289
Eigen::internal::rotation_base_generic_product_selector< RotationDerived, DiagonalMatrix< Scalar, Dim, MaxDim >, false >::ReturnType
Transform< Scalar, Dim, Affine > ReturnType
Definition: RotationBase.h:112
Eigen::internal::traits
Definition: ForwardDeclarations.h:17
EIGEN_STATIC_ASSERT
#define EIGEN_STATIC_ASSERT(CONDITION, MSG)
Definition: StaticAssert.h:127
Eigen::UniformScaling
Represents a generic uniform scaling transformation.
Definition: ForwardDeclarations.h:297
v
Array< int, Dynamic, 1 > v
Definition: Array_initializer_list_vector_cxx11.cpp:1
Eigen::RotationBase::inverse
EIGEN_DEVICE_FUNC Derived inverse() const
Definition: RotationBase.h:53
Eigen::Translation
Represents a translation transformation.
Definition: ForwardDeclarations.h:291
Eigen::Matrix::operator=
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Matrix & operator=(const Matrix &other)
Assigns matrices to each other.
Definition: 3rdparty/Eigen/Eigen/src/Core/Matrix.h:206
Eigen::Matrix
The matrix class, also used for vectors and row-vectors.
Definition: 3rdparty/Eigen/Eigen/src/Core/Matrix.h:178
Eigen::RotationBase::_transformVector
EIGEN_DEVICE_FUNC VectorType _transformVector(const OtherVectorType &v) const
Definition: RotationBase.h:93
Eigen::Rotation2D::toRotationMatrix
EIGEN_DEVICE_FUNC Matrix2 toRotationMatrix() const
Definition: Rotation2D.h:188
internal
Definition: BandTriangularSolver.h:13
Eigen::MatrixBase
Base class for all dense matrices, vectors, and expressions.
Definition: MatrixBase.h:48
Eigen::RotationBase::RotationMatrixType
Matrix< Scalar, Dim, Dim > RotationMatrixType
Definition: RotationBase.h:37
align_3::t
Point2 t(10, 10)
Eigen::Matrix::Matrix
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Matrix()
Default constructor.
Definition: 3rdparty/Eigen/Eigen/src/Core/Matrix.h:259
Scalar
SCALAR Scalar
Definition: bench_gemm.cpp:46


gtsam
Author(s):
autogenerated on Sat Nov 16 2024 04:04:01