Eigen2Support/Geometry/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 <g.gael@free.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 // no include guard, we'll include this twice from All.h from Eigen2Support, and it's internal anyway
11 
12 namespace Eigen {
13 
14 // this file aims to contains the various representations of rotation/orientation
15 // in 2D and 3D space excepted Matrix and Quaternion.
16 
24 template<typename Derived, int _Dim>
25 class RotationBase
26 {
27  public:
28  enum { Dim = _Dim };
31 
34 
35  inline const Derived& derived() const { return *static_cast<const Derived*>(this); }
36  inline Derived& derived() { return *static_cast<Derived*>(this); }
37 
39  inline RotationMatrixType toRotationMatrix() const { return derived().toRotationMatrix(); }
40 
42  inline Derived inverse() const { return derived().inverse(); }
43 
46  { return toRotationMatrix() * t; }
47 
49  inline RotationMatrixType operator*(const Scaling<Scalar,Dim>& s) const
50  { return toRotationMatrix() * s; }
51 
54  { return toRotationMatrix() * t; }
55 };
56 
61 template<typename _Scalar, int _Rows, int _Cols, int _Storage, int _MaxRows, int _MaxCols>
62 template<typename OtherDerived>
65 {
66  EIGEN_STATIC_ASSERT_MATRIX_SPECIFIC_SIZE(Matrix,int(OtherDerived::Dim),int(OtherDerived::Dim))
67  *this = r.toRotationMatrix();
68 }
69 
74 template<typename _Scalar, int _Rows, int _Cols, int _Storage, int _MaxRows, int _MaxCols>
75 template<typename OtherDerived>
79 {
80  EIGEN_STATIC_ASSERT_MATRIX_SPECIFIC_SIZE(Matrix,int(OtherDerived::Dim),int(OtherDerived::Dim))
81  return *this = r.toRotationMatrix();
82 }
83 
102 template<typename Scalar, int Dim>
104 {
105  EIGEN_STATIC_ASSERT(Dim==2,YOU_MADE_A_PROGRAMMING_MISTAKE)
107 }
108 
109 template<typename Scalar, int Dim, typename OtherDerived>
111 {
112  return r.toRotationMatrix();
113 }
114 
115 template<typename Scalar, int Dim, typename OtherDerived>
117 {
118  EIGEN_STATIC_ASSERT(OtherDerived::RowsAtCompileTime==Dim && OtherDerived::ColsAtCompileTime==Dim,
119  YOU_MADE_A_PROGRAMMING_MISTAKE)
120  return mat;
121 }
122 
123 } // end namespace Eigen
Represents a possibly non uniform scaling transformation.
Matrix< Scalar, Dim, Dim > RotationMatrixType
Definition: LDLT.h:16
#define EIGEN_STATIC_ASSERT(CONDITION, MSG)
Definition: StaticAssert.h:111
Represents a translation transformation.
ei_traits< Derived >::Scalar Scalar
EIGEN_STRONG_INLINE Matrix()
Default constructor.
Definition: Matrix.h:203
Transform< Scalar, Dim > operator*(const Transform< Scalar, Dim > &t) const
#define EIGEN_STATIC_ASSERT_MATRIX_SPECIFIC_SIZE(TYPE, ROWS, COLS)
Definition: StaticAssert.h:146
Common base class for compact rotation representations.
static Matrix< Scalar, 2, 2 > ei_toRotationMatrix(const Scalar &s)
Represents a rotation/orientation in a 2 dimensional space.
EIGEN_STRONG_INLINE Matrix & operator=(const Matrix &other)
Assigns matrices to each other.
Definition: Matrix.h:154
RotationMatrixType operator*(const Scaling< Scalar, Dim > &s) const
The matrix class, also used for vectors and row-vectors.
Definition: Matrix.h:127
#define RotationBase
Definition: All.h:24
Base class for all dense matrices, vectors, and expressions.
Definition: MatrixBase.h:48
Transform< Scalar, Dim > operator*(const Translation< Scalar, Dim > &t) const
Represents an homogeneous transformation in a N dimensional space.
RotationMatrixType toRotationMatrix() const


tuw_aruco
Author(s): Lukas Pfeifhofer
autogenerated on Mon Jun 10 2019 15:40:56