Eigen/src/Geometry/Scaling.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_SCALING_H
11 #define EIGEN_SCALING_H
12 
13 namespace Eigen {
14 
32 template<typename _Scalar>
34 {
35 public:
37  typedef _Scalar Scalar;
38 
39 protected:
40 
41  Scalar m_factor;
42 
43 public:
44 
48  explicit inline UniformScaling(const Scalar& s) : m_factor(s) {}
49 
50  inline const Scalar& factor() const { return m_factor; }
51  inline Scalar& factor() { return m_factor; }
52 
54  inline UniformScaling operator* (const UniformScaling& other) const
55  { return UniformScaling(m_factor * other.factor()); }
56 
58  template<int Dim>
60 
62  template<int Dim, int Mode, int Options>
64  {
66  res.prescale(factor());
67  return res;
68 }
69 
71  // TODO returns an expression
72  template<typename Derived>
74  { return other * m_factor; }
75 
76  template<typename Derived,int Dim>
78  { return r.toRotationMatrix() * m_factor; }
79 
81  inline UniformScaling inverse() const
82  { return UniformScaling(Scalar(1)/m_factor); }
83 
89  template<typename NewScalarType>
91  { return UniformScaling<NewScalarType>(NewScalarType(m_factor)); }
92 
94  template<typename OtherScalarType>
95  inline explicit UniformScaling(const UniformScaling<OtherScalarType>& other)
96  { m_factor = Scalar(other.factor()); }
97 
102  bool isApprox(const UniformScaling& other, const typename NumTraits<Scalar>::Real& prec = NumTraits<Scalar>::dummy_precision()) const
103  { return internal::isApprox(m_factor, other.factor(), prec); }
104 
105 };
106 
108 // NOTE this operator is defiend in MatrixBase and not as a friend function
109 // of UniformScaling to fix an internal crash of Intel's ICC
110 template<typename Derived> typename MatrixBase<Derived>::ScalarMultipleReturnType
112 { return derived() * s.factor(); }
113 
115 static inline UniformScaling<float> Scaling(float s) { return UniformScaling<float>(s); }
117 static inline UniformScaling<double> Scaling(double s) { return UniformScaling<double>(s); }
119 template<typename RealScalar>
120 static inline UniformScaling<std::complex<RealScalar> > Scaling(const std::complex<RealScalar>& s)
122 
124 template<typename Scalar>
125 static inline DiagonalMatrix<Scalar,2> Scaling(const Scalar& sx, const Scalar& sy)
126 { return DiagonalMatrix<Scalar,2>(sx, sy); }
128 template<typename Scalar>
129 static inline DiagonalMatrix<Scalar,3> Scaling(const Scalar& sx, const Scalar& sy, const Scalar& sz)
130 { return DiagonalMatrix<Scalar,3>(sx, sy, sz); }
131 
135 template<typename Derived>
137 { return coeffs.asDiagonal(); }
138 
150 
151 template<typename Scalar>
152 template<int Dim>
155 {
157  res.matrix().setZero();
158  res.linear().diagonal().fill(factor());
159  res.translation() = factor() * t.vector();
160  res(Dim,Dim) = Scalar(1);
161  return res;
162 }
163 
164 } // end namespace Eigen
165 
166 #endif // EIGEN_SCALING_H
bool isApprox(const UniformScaling &other, const typename NumTraits< Scalar >::Real &prec=NumTraits< Scalar >::dummy_precision()) const
UniformScaling operator*(const UniformScaling &other) const
DiagonalMatrix< float, 3 > AlignedScaling3f
const VectorType & vector() const
DiagonalMatrix< float, 2 > AlignedScaling2f
Matrix< Scalar, Dim, Dim > operator*(const RotationBase< Derived, Dim > &r) const
Represents a diagonal matrix with its storage.
const Scalar & factor() const
iterative scaling algorithm to equilibrate rows and column norms in matrices
Definition: matrix.hpp:471
DiagonalMatrix< double, 3 > AlignedScaling3d
Holds information about the various numeric (i.e. scalar) types allowed by Eigen. ...
Definition: NumTraits.h:88
Represents a translation transformation.
UniformScaling< NewScalarType > cast() const
UniformScaling(const UniformScaling< OtherScalarType > &other)
UniformScaling inverse() const
bool isApprox(const Scalar &x, const Scalar &y, typename NumTraits< Scalar >::Real precision=NumTraits< Scalar >::dummy_precision())
Common base class for compact rotation representations.
DiagonalMatrix< double, 2 > AlignedScaling2d
ConstTranslationPart translation() const
Transform & prescale(const MatrixBase< OtherDerived > &other)
const MatrixType & matrix() const
Expression of a diagonal matrix.
ConstLinearPart linear() const
Generic expression where a coefficient-wise unary operator is applied to an expression.
Definition: CwiseUnaryOp.h:59
const DiagonalWrapper< const Derived > asDiagonal() const
The matrix class, also used for vectors and row-vectors.
Definition: Matrix.h:127
Base class for all dense matrices, vectors, and expressions.
Definition: MatrixBase.h:48
Represents an homogeneous transformation in a N dimensional space.
RotationMatrixType toRotationMatrix() const
static UniformScaling< float > Scaling(float s)


acado
Author(s): Milan Vukov, Rien Quirynen
autogenerated on Mon Jun 10 2019 12:35:03