Eigen  3.2.91
Transform.h
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 // Copyright (C) 2009 Benoit Jacob <jacob.benoit.1@gmail.com>
6 // Copyright (C) 2010 Hauke Heibel <hauke.heibel@gmail.com>
7 //
8 // This Source Code Form is subject to the terms of the Mozilla
9 // Public License v. 2.0. If a copy of the MPL was not distributed
10 // with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
11 
12 #ifndef EIGEN_TRANSFORM_H
13 #define EIGEN_TRANSFORM_H
14 
15 namespace Eigen {
16 
17 namespace internal {
18 
19 template<typename Transform>
20 struct transform_traits
21 {
22  enum
23  {
24  Dim = Transform::Dim,
25  HDim = Transform::HDim,
26  Mode = Transform::Mode,
27  IsProjective = (int(Mode)==int(Projective))
28  };
29 };
30 
31 template< typename TransformType,
32  typename MatrixType,
33  int Case = transform_traits<TransformType>::IsProjective ? 0
34  : int(MatrixType::RowsAtCompileTime) == int(transform_traits<TransformType>::HDim) ? 1
35  : 2>
36 struct transform_right_product_impl;
37 
38 template< typename Other,
39  int Mode,
40  int Options,
41  int Dim,
42  int HDim,
43  int OtherRows=Other::RowsAtCompileTime,
44  int OtherCols=Other::ColsAtCompileTime>
45 struct transform_left_product_impl;
46 
47 template< typename Lhs,
48  typename Rhs,
49  bool AnyProjective =
50  transform_traits<Lhs>::IsProjective ||
51  transform_traits<Rhs>::IsProjective>
52 struct transform_transform_product_impl;
53 
54 template< typename Other,
55  int Mode,
56  int Options,
57  int Dim,
58  int HDim,
59  int OtherRows=Other::RowsAtCompileTime,
60  int OtherCols=Other::ColsAtCompileTime>
61 struct transform_construct_from_matrix;
62 
63 template<typename TransformType> struct transform_take_affine_part;
64 
65 template<typename _Scalar, int _Dim, int _Mode, int _Options>
66 struct traits<Transform<_Scalar,_Dim,_Mode,_Options> >
67 {
68  typedef _Scalar Scalar;
69  typedef Eigen::Index StorageIndex;
70  typedef Dense StorageKind;
71  enum {
72  Dim1 = _Dim==Dynamic ? _Dim : _Dim + 1,
73  RowsAtCompileTime = _Mode==Projective ? Dim1 : _Dim,
74  ColsAtCompileTime = Dim1,
75  MaxRowsAtCompileTime = RowsAtCompileTime,
76  MaxColsAtCompileTime = ColsAtCompileTime,
77  Flags = 0
78  };
79 };
80 
81 template<int Mode> struct transform_make_affine;
82 
83 } // end namespace internal
84 
193 template<typename _Scalar, int _Dim, int _Mode, int _Options>
194 class Transform
195 {
196 public:
197  EIGEN_MAKE_ALIGNED_OPERATOR_NEW_IF_VECTORIZABLE_FIXED_SIZE(_Scalar,_Dim==Dynamic ? Dynamic : (_Dim+1)*(_Dim+1))
198  enum {
199  Mode = _Mode,
200  Options = _Options,
201  Dim = _Dim,
202  HDim = _Dim+1,
203  Rows = int(Mode)==(AffineCompact) ? Dim : HDim
204  };
206  typedef _Scalar Scalar;
207  typedef Eigen::Index StorageIndex;
208  typedef Eigen::Index Index;
209 
212  typedef const MatrixType ConstMatrixType;
220  typedef typename internal::conditional<int(Mode)==int(AffineCompact),
221  MatrixType&,
224  typedef typename internal::conditional<int(Mode)==int(AffineCompact),
225  const MatrixType&,
235 
236  // this intermediate enum is needed to avoid an ICE with gcc 3.4 and 4.0
237  enum { TransformTimeDiagonalMode = ((Mode==int(Isometry))?Affine:int(Mode)) };
240 
241 protected:
242 
243  MatrixType m_matrix;
244 
245 public:
246 
249  inline Transform()
250  {
251  check_template_params();
252  internal::transform_make_affine<(int(Mode)==Affine) ? Affine : AffineCompact>::run(m_matrix);
253  }
254 
255  inline Transform(const Transform& other)
256  {
257  check_template_params();
258  m_matrix = other.m_matrix;
259  }
260 
261  inline explicit Transform(const TranslationType& t)
262  {
263  check_template_params();
264  *this = t;
265  }
266  inline explicit Transform(const UniformScaling<Scalar>& s)
267  {
268  check_template_params();
269  *this = s;
270  }
271  template<typename Derived>
272  inline explicit Transform(const RotationBase<Derived, Dim>& r)
273  {
274  check_template_params();
275  *this = r;
276  }
277 
278  inline Transform& operator=(const Transform& other)
279  { m_matrix = other.m_matrix; return *this; }
280 
281  typedef internal::transform_take_affine_part<Transform> take_affine_part;
282 
284  template<typename OtherDerived>
285  inline explicit Transform(const EigenBase<OtherDerived>& other)
286  {
287  EIGEN_STATIC_ASSERT((internal::is_same<Scalar,typename OtherDerived::Scalar>::value),
288  YOU_MIXED_DIFFERENT_NUMERIC_TYPES__YOU_NEED_TO_USE_THE_CAST_METHOD_OF_MATRIXBASE_TO_CAST_NUMERIC_TYPES_EXPLICITLY);
289 
290  check_template_params();
291  internal::transform_construct_from_matrix<OtherDerived,Mode,Options,Dim,HDim>::run(this, other.derived());
292  }
293 
295  template<typename OtherDerived>
297  {
298  EIGEN_STATIC_ASSERT((internal::is_same<Scalar,typename OtherDerived::Scalar>::value),
299  YOU_MIXED_DIFFERENT_NUMERIC_TYPES__YOU_NEED_TO_USE_THE_CAST_METHOD_OF_MATRIXBASE_TO_CAST_NUMERIC_TYPES_EXPLICITLY);
300 
301  internal::transform_construct_from_matrix<OtherDerived,Mode,Options,Dim,HDim>::run(this, other.derived());
302  return *this;
303  }
304 
305  template<int OtherOptions>
307  {
308  check_template_params();
309  // only the options change, we can directly copy the matrices
310  m_matrix = other.matrix();
311  }
312 
313  template<int OtherMode,int OtherOptions>
314  inline Transform(const Transform<Scalar,Dim,OtherMode,OtherOptions>& other)
315  {
316  check_template_params();
317  // prevent conversions as:
318  // Affine | AffineCompact | Isometry = Projective
319  EIGEN_STATIC_ASSERT(EIGEN_IMPLIES(OtherMode==int(Projective), Mode==int(Projective)),
320  YOU_PERFORMED_AN_INVALID_TRANSFORMATION_CONVERSION)
321 
322  // prevent conversions as:
323  // Isometry = Affine | AffineCompact
324  EIGEN_STATIC_ASSERT(EIGEN_IMPLIES(OtherMode==int(Affine)||OtherMode==int(AffineCompact), Mode!=int(Isometry)),
325  YOU_PERFORMED_AN_INVALID_TRANSFORMATION_CONVERSION)
326 
327  enum { ModeIsAffineCompact = Mode == int(AffineCompact),
328  OtherModeIsAffineCompact = OtherMode == int(AffineCompact)
329  };
330 
331  if(ModeIsAffineCompact == OtherModeIsAffineCompact)
332  {
333  // We need the block expression because the code is compiled for all
334  // combinations of transformations and will trigger a compile time error
335  // if one tries to assign the matrices directly
336  m_matrix.template block<Dim,Dim+1>(0,0) = other.matrix().template block<Dim,Dim+1>(0,0);
337  makeAffine();
338  }
339  else if(OtherModeIsAffineCompact)
340  {
341  typedef typename Transform<Scalar,Dim,OtherMode,OtherOptions>::MatrixType OtherMatrixType;
342  internal::transform_construct_from_matrix<OtherMatrixType,Mode,Options,Dim,HDim>::run(this, other.matrix());
343  }
344  else
345  {
346  // here we know that Mode == AffineCompact and OtherMode != AffineCompact.
347  // if OtherMode were Projective, the static assert above would already have caught it.
348  // So the only possibility is that OtherMode == Affine
349  linear() = other.linear();
350  translation() = other.translation();
351  }
352  }
353 
354  template<typename OtherDerived>
355  Transform(const ReturnByValue<OtherDerived>& other)
356  {
357  check_template_params();
358  other.evalTo(*this);
359  }
360 
361  template<typename OtherDerived>
362  Transform& operator=(const ReturnByValue<OtherDerived>& other)
363  {
364  other.evalTo(*this);
365  return *this;
366  }
367 
368  #ifdef EIGEN_QT_SUPPORT
369  inline Transform(const QMatrix& other);
370  inline Transform& operator=(const QMatrix& other);
371  inline QMatrix toQMatrix(void) const;
372  inline Transform(const QTransform& other);
373  inline Transform& operator=(const QTransform& other);
374  inline QTransform toQTransform(void) const;
375  #endif
376 
377  Index rows() const { return int(Mode)==int(Projective) ? m_matrix.cols() : (m_matrix.cols()-1); }
378  Index cols() const { return m_matrix.cols(); }
379 
382  inline Scalar operator() (Index row, Index col) const { return m_matrix(row,col); }
385  inline Scalar& operator() (Index row, Index col) { return m_matrix(row,col); }
386 
388  inline const MatrixType& matrix() const { return m_matrix; }
390  inline MatrixType& matrix() { return m_matrix; }
391 
393  inline ConstLinearPart linear() const { return ConstLinearPart(m_matrix,0,0); }
395  inline LinearPart linear() { return LinearPart(m_matrix,0,0); }
396 
398  inline ConstAffinePart affine() const { return take_affine_part::run(m_matrix); }
400  inline AffinePart affine() { return take_affine_part::run(m_matrix); }
401 
403  inline ConstTranslationPart translation() const { return ConstTranslationPart(m_matrix,0,Dim); }
405  inline TranslationPart translation() { return TranslationPart(m_matrix,0,Dim); }
406 
418  // note: this function is defined here because some compilers cannot find the respective declaration
419  template<typename OtherDerived>
420  EIGEN_STRONG_INLINE const typename internal::transform_right_product_impl<Transform, OtherDerived>::ResultType
421  operator * (const EigenBase<OtherDerived> &other) const
422  { return internal::transform_right_product_impl<Transform, OtherDerived>::run(*this,other.derived()); }
423 
431  template<typename OtherDerived> friend
432  inline const typename internal::transform_left_product_impl<OtherDerived,Mode,Options,_Dim,_Dim+1>::ResultType
433  operator * (const EigenBase<OtherDerived> &a, const Transform &b)
434  { return internal::transform_left_product_impl<OtherDerived,Mode,Options,Dim,HDim>::run(a.derived(),b); }
435 
442  template<typename DiagonalDerived>
443  inline const TransformTimeDiagonalReturnType
444  operator * (const DiagonalBase<DiagonalDerived> &b) const
445  {
446  TransformTimeDiagonalReturnType res(*this);
447  res.linear() *= b;
448  return res;
449  }
450 
457  template<typename DiagonalDerived>
458  friend inline TransformTimeDiagonalReturnType
459  operator * (const DiagonalBase<DiagonalDerived> &a, const Transform &b)
460  {
461  TransformTimeDiagonalReturnType res;
462  res.linear().noalias() = a*b.linear();
463  res.translation().noalias() = a*b.translation();
464  if (Mode!=int(AffineCompact))
465  res.matrix().row(Dim) = b.matrix().row(Dim);
466  return res;
467  }
468 
469  template<typename OtherDerived>
470  inline Transform& operator*=(const EigenBase<OtherDerived>& other) { return *this = *this * other; }
471 
473  inline const Transform operator * (const Transform& other) const
474  {
475  return internal::transform_transform_product_impl<Transform,Transform>::run(*this,other);
476  }
477 
478  #if EIGEN_COMP_ICC
479 private:
480  // this intermediate structure permits to workaround a bug in ICC 11:
481  // error: template instantiation resulted in unexpected function type of "Eigen::Transform<double, 3, 32, 0>
482  // (const Eigen::Transform<double, 3, 2, 0> &) const"
483  // (the meaning of a name may have changed since the template declaration -- the type of the template is:
484  // "Eigen::internal::transform_transform_product_impl<Eigen::Transform<double, 3, 32, 0>,
485  // Eigen::Transform<double, 3, Mode, Options>, <expression>>::ResultType (const Eigen::Transform<double, 3, Mode, Options> &) const")
486  //
487  template<int OtherMode,int OtherOptions> struct icc_11_workaround
488  {
489  typedef internal::transform_transform_product_impl<Transform,Transform<Scalar,Dim,OtherMode,OtherOptions> > ProductType;
490  typedef typename ProductType::ResultType ResultType;
491  };
492 
493 public:
495  template<int OtherMode,int OtherOptions>
496  inline typename icc_11_workaround<OtherMode,OtherOptions>::ResultType
497  operator * (const Transform<Scalar,Dim,OtherMode,OtherOptions>& other) const
498  {
499  typedef typename icc_11_workaround<OtherMode,OtherOptions>::ProductType ProductType;
500  return ProductType::run(*this,other);
501  }
502  #else
503 
504  template<int OtherMode,int OtherOptions>
505  inline typename internal::transform_transform_product_impl<Transform,Transform<Scalar,Dim,OtherMode,OtherOptions> >::ResultType
506  operator * (const Transform<Scalar,Dim,OtherMode,OtherOptions>& other) const
507  {
508  return internal::transform_transform_product_impl<Transform,Transform<Scalar,Dim,OtherMode,OtherOptions> >::run(*this,other);
509  }
510  #endif
511 
513  void setIdentity() { m_matrix.setIdentity(); }
514 
519  static const Transform Identity()
520  {
521  return Transform(MatrixType::Identity());
522  }
523 
524  template<typename OtherDerived>
525  inline Transform& scale(const MatrixBase<OtherDerived> &other);
526 
527  template<typename OtherDerived>
528  inline Transform& prescale(const MatrixBase<OtherDerived> &other);
529 
530  inline Transform& scale(const Scalar& s);
531  inline Transform& prescale(const Scalar& s);
532 
533  template<typename OtherDerived>
534  inline Transform& translate(const MatrixBase<OtherDerived> &other);
535 
536  template<typename OtherDerived>
537  inline Transform& pretranslate(const MatrixBase<OtherDerived> &other);
538 
539  template<typename RotationType>
540  inline Transform& rotate(const RotationType& rotation);
541 
542  template<typename RotationType>
543  inline Transform& prerotate(const RotationType& rotation);
544 
545  Transform& shear(const Scalar& sx, const Scalar& sy);
546  Transform& preshear(const Scalar& sx, const Scalar& sy);
547 
548  inline Transform& operator=(const TranslationType& t);
549  inline Transform& operator*=(const TranslationType& t) { return translate(t.vector()); }
550  inline Transform operator*(const TranslationType& t) const;
551 
552  inline Transform& operator=(const UniformScaling<Scalar>& t);
553  inline Transform& operator*=(const UniformScaling<Scalar>& s) { return scale(s.factor()); }
554  inline TransformTimeDiagonalReturnType operator*(const UniformScaling<Scalar>& s) const
555  {
556  TransformTimeDiagonalReturnType res = *this;
557  res.scale(s.factor());
558  return res;
559  }
560 
561  inline Transform& operator*=(const DiagonalMatrix<Scalar,Dim>& s) { linear() *= s; return *this; }
562 
563  template<typename Derived>
564  inline Transform& operator=(const RotationBase<Derived,Dim>& r);
565  template<typename Derived>
566  inline Transform& operator*=(const RotationBase<Derived,Dim>& r) { return rotate(r.toRotationMatrix()); }
567  template<typename Derived>
568  inline Transform operator*(const RotationBase<Derived,Dim>& r) const;
569 
570  const LinearMatrixType rotation() const;
571  template<typename RotationMatrixType, typename ScalingMatrixType>
572  void computeRotationScaling(RotationMatrixType *rotation, ScalingMatrixType *scaling) const;
573  template<typename ScalingMatrixType, typename RotationMatrixType>
574  void computeScalingRotation(ScalingMatrixType *scaling, RotationMatrixType *rotation) const;
575 
576  template<typename PositionDerived, typename OrientationType, typename ScaleDerived>
577  Transform& fromPositionOrientationScale(const MatrixBase<PositionDerived> &position,
578  const OrientationType& orientation, const MatrixBase<ScaleDerived> &scale);
579 
580  inline Transform inverse(TransformTraits traits = (TransformTraits)Mode) const;
581 
583  const Scalar* data() const { return m_matrix.data(); }
585  Scalar* data() { return m_matrix.data(); }
586 
592  template<typename NewScalarType>
593  inline typename internal::cast_return_type<Transform,Transform<NewScalarType,Dim,Mode,Options> >::type cast() const
594  { return typename internal::cast_return_type<Transform,Transform<NewScalarType,Dim,Mode,Options> >::type(*this); }
595 
597  template<typename OtherScalarType>
599  {
600  check_template_params();
601  m_matrix = other.matrix().template cast<Scalar>();
602  }
603 
608  bool isApprox(const Transform& other, const typename NumTraits<Scalar>::Real& prec = NumTraits<Scalar>::dummy_precision()) const
609  { return m_matrix.isApprox(other.m_matrix, prec); }
610 
613  void makeAffine()
614  {
615  internal::transform_make_affine<int(Mode)>::run(m_matrix);
616  }
617 
623  { return m_matrix.template block<int(Mode)==int(Projective)?HDim:Dim,Dim>(0,0); }
628  inline const Block<MatrixType,int(Mode)==int(Projective)?HDim:Dim,Dim> linearExt() const
629  { return m_matrix.template block<int(Mode)==int(Projective)?HDim:Dim,Dim>(0,0); }
630 
635  inline Block<MatrixType,int(Mode)==int(Projective)?HDim:Dim,1> translationExt()
636  { return m_matrix.template block<int(Mode)==int(Projective)?HDim:Dim,1>(0,Dim); }
641  inline const Block<MatrixType,int(Mode)==int(Projective)?HDim:Dim,1> translationExt() const
642  { return m_matrix.template block<int(Mode)==int(Projective)?HDim:Dim,1>(0,Dim); }
643 
644 
645  #ifdef EIGEN_TRANSFORM_PLUGIN
646  #include EIGEN_TRANSFORM_PLUGIN
647  #endif
648 
649 protected:
650  #ifndef EIGEN_PARSED_BY_DOXYGEN
651  static EIGEN_STRONG_INLINE void check_template_params()
652  {
653  EIGEN_STATIC_ASSERT((Options & (DontAlign|RowMajor)) == Options, INVALID_MATRIX_TEMPLATE_PARAMETERS)
654  }
655  #endif
656 
657 };
658 
667 
676 
685 
694 
695 /**************************
696 *** Optional QT support ***
697 **************************/
698 
699 #ifdef EIGEN_QT_SUPPORT
700 
704 template<typename Scalar, int Dim, int Mode,int Options>
706 {
707  check_template_params();
708  *this = other;
709 }
710 
715 template<typename Scalar, int Dim, int Mode,int Options>
717 {
718  EIGEN_STATIC_ASSERT(Dim==2, YOU_MADE_A_PROGRAMMING_MISTAKE)
719  if (Mode == int(AffineCompact))
720  m_matrix << other.m11(), other.m21(), other.dx(),
721  other.m12(), other.m22(), other.dy();
722  else
723  m_matrix << other.m11(), other.m21(), other.dx(),
724  other.m12(), other.m22(), other.dy(),
725  0, 0, 1;
726  return *this;
727 }
728 
735 template<typename Scalar, int Dim, int Mode, int Options>
737 {
738  check_template_params();
739  EIGEN_STATIC_ASSERT(Dim==2, YOU_MADE_A_PROGRAMMING_MISTAKE)
740  return QMatrix(m_matrix.coeff(0,0), m_matrix.coeff(1,0),
741  m_matrix.coeff(0,1), m_matrix.coeff(1,1),
742  m_matrix.coeff(0,2), m_matrix.coeff(1,2));
743 }
744 
749 template<typename Scalar, int Dim, int Mode,int Options>
751 {
752  check_template_params();
753  *this = other;
754 }
755 
760 template<typename Scalar, int Dim, int Mode, int Options>
762 {
763  check_template_params();
764  EIGEN_STATIC_ASSERT(Dim==2, YOU_MADE_A_PROGRAMMING_MISTAKE)
765  if (Mode == int(AffineCompact))
766  m_matrix << other.m11(), other.m21(), other.dx(),
767  other.m12(), other.m22(), other.dy();
768  else
769  m_matrix << other.m11(), other.m21(), other.dx(),
770  other.m12(), other.m22(), other.dy(),
771  other.m13(), other.m23(), other.m33();
772  return *this;
773 }
774 
779 template<typename Scalar, int Dim, int Mode, int Options>
781 {
782  EIGEN_STATIC_ASSERT(Dim==2, YOU_MADE_A_PROGRAMMING_MISTAKE)
783  if (Mode == int(AffineCompact))
784  return QTransform(m_matrix.coeff(0,0), m_matrix.coeff(1,0),
785  m_matrix.coeff(0,1), m_matrix.coeff(1,1),
786  m_matrix.coeff(0,2), m_matrix.coeff(1,2));
787  else
788  return QTransform(m_matrix.coeff(0,0), m_matrix.coeff(1,0), m_matrix.coeff(2,0),
789  m_matrix.coeff(0,1), m_matrix.coeff(1,1), m_matrix.coeff(2,1),
790  m_matrix.coeff(0,2), m_matrix.coeff(1,2), m_matrix.coeff(2,2));
791 }
792 #endif
793 
794 /*********************
795 *** Procedural API ***
796 *********************/
797 
802 template<typename Scalar, int Dim, int Mode, int Options>
803 template<typename OtherDerived>
806 {
807  EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(OtherDerived,int(Dim))
808  EIGEN_STATIC_ASSERT(Mode!=int(Isometry), THIS_METHOD_IS_ONLY_FOR_SPECIFIC_TRANSFORMATIONS)
809  linearExt().noalias() = (linearExt() * other.asDiagonal());
810  return *this;
811 }
812 
817 template<typename Scalar, int Dim, int Mode, int Options>
819 {
820  EIGEN_STATIC_ASSERT(Mode!=int(Isometry), THIS_METHOD_IS_ONLY_FOR_SPECIFIC_TRANSFORMATIONS)
821  linearExt() *= s;
822  return *this;
823 }
824 
829 template<typename Scalar, int Dim, int Mode, int Options>
830 template<typename OtherDerived>
833 {
834  EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(OtherDerived,int(Dim))
835  EIGEN_STATIC_ASSERT(Mode!=int(Isometry), THIS_METHOD_IS_ONLY_FOR_SPECIFIC_TRANSFORMATIONS)
836  m_matrix.template block<Dim,HDim>(0,0).noalias() = (other.asDiagonal() * m_matrix.template block<Dim,HDim>(0,0));
837  return *this;
838 }
839 
844 template<typename Scalar, int Dim, int Mode, int Options>
846 {
847  EIGEN_STATIC_ASSERT(Mode!=int(Isometry), THIS_METHOD_IS_ONLY_FOR_SPECIFIC_TRANSFORMATIONS)
848  m_matrix.template topRows<Dim>() *= s;
849  return *this;
850 }
851 
856 template<typename Scalar, int Dim, int Mode, int Options>
857 template<typename OtherDerived>
860 {
861  EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(OtherDerived,int(Dim))
862  translationExt() += linearExt() * other;
863  return *this;
864 }
865 
870 template<typename Scalar, int Dim, int Mode, int Options>
871 template<typename OtherDerived>
874 {
875  EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(OtherDerived,int(Dim))
876  if(int(Mode)==int(Projective))
877  affine() += other * m_matrix.row(Dim);
878  else
879  translation() += other;
880  return *this;
881 }
882 
900 template<typename Scalar, int Dim, int Mode, int Options>
901 template<typename RotationType>
903 Transform<Scalar,Dim,Mode,Options>::rotate(const RotationType& rotation)
904 {
905  linearExt() *= internal::toRotationMatrix<Scalar,Dim>(rotation);
906  return *this;
907 }
908 
916 template<typename Scalar, int Dim, int Mode, int Options>
917 template<typename RotationType>
920 {
921  m_matrix.template block<Dim,HDim>(0,0) = internal::toRotationMatrix<Scalar,Dim>(rotation)
922  * m_matrix.template block<Dim,HDim>(0,0);
923  return *this;
924 }
925 
931 template<typename Scalar, int Dim, int Mode, int Options>
933 Transform<Scalar,Dim,Mode,Options>::shear(const Scalar& sx, const Scalar& sy)
934 {
935  EIGEN_STATIC_ASSERT(int(Dim)==2, YOU_MADE_A_PROGRAMMING_MISTAKE)
936  EIGEN_STATIC_ASSERT(Mode!=int(Isometry), THIS_METHOD_IS_ONLY_FOR_SPECIFIC_TRANSFORMATIONS)
937  VectorType tmp = linear().col(0)*sy + linear().col(1);
938  linear() << linear().col(0) + linear().col(1)*sx, tmp;
939  return *this;
940 }
941 
947 template<typename Scalar, int Dim, int Mode, int Options>
949 Transform<Scalar,Dim,Mode,Options>::preshear(const Scalar& sx, const Scalar& sy)
950 {
951  EIGEN_STATIC_ASSERT(int(Dim)==2, YOU_MADE_A_PROGRAMMING_MISTAKE)
952  EIGEN_STATIC_ASSERT(Mode!=int(Isometry), THIS_METHOD_IS_ONLY_FOR_SPECIFIC_TRANSFORMATIONS)
953  m_matrix.template block<Dim,HDim>(0,0) = LinearMatrixType(1, sx, sy, 1) * m_matrix.template block<Dim,HDim>(0,0);
954  return *this;
955 }
956 
957 /******************************************************
958 *** Scaling, Translation and Rotation compatibility ***
959 ******************************************************/
960 
961 template<typename Scalar, int Dim, int Mode, int Options>
963 {
964  linear().setIdentity();
965  translation() = t.vector();
966  makeAffine();
967  return *this;
968 }
969 
970 template<typename Scalar, int Dim, int Mode, int Options>
971 inline Transform<Scalar,Dim,Mode,Options> Transform<Scalar,Dim,Mode,Options>::operator*(const TranslationType& t) const
972 {
973  Transform res = *this;
974  res.translate(t.vector());
975  return res;
976 }
977 
978 template<typename Scalar, int Dim, int Mode, int Options>
979 inline Transform<Scalar,Dim,Mode,Options>& Transform<Scalar,Dim,Mode,Options>::operator=(const UniformScaling<Scalar>& s)
980 {
981  m_matrix.setZero();
982  linear().diagonal().fill(s.factor());
983  makeAffine();
984  return *this;
985 }
986 
987 template<typename Scalar, int Dim, int Mode, int Options>
988 template<typename Derived>
989 inline Transform<Scalar,Dim,Mode,Options>& Transform<Scalar,Dim,Mode,Options>::operator=(const RotationBase<Derived,Dim>& r)
990 {
991  linear() = internal::toRotationMatrix<Scalar,Dim>(r);
992  translation().setZero();
993  makeAffine();
994  return *this;
995 }
996 
997 template<typename Scalar, int Dim, int Mode, int Options>
998 template<typename Derived>
999 inline Transform<Scalar,Dim,Mode,Options> Transform<Scalar,Dim,Mode,Options>::operator*(const RotationBase<Derived,Dim>& r) const
1000 {
1001  Transform res = *this;
1002  res.rotate(r.derived());
1003  return res;
1004 }
1005 
1006 /************************
1007 *** Special functions ***
1008 ************************/
1009 
1017 template<typename Scalar, int Dim, int Mode, int Options>
1018 const typename Transform<Scalar,Dim,Mode,Options>::LinearMatrixType
1020 {
1021  LinearMatrixType result;
1022  computeRotationScaling(&result, (LinearMatrixType*)0);
1023  return result;
1024 }
1025 
1026 
1038 template<typename Scalar, int Dim, int Mode, int Options>
1039 template<typename RotationMatrixType, typename ScalingMatrixType>
1040 void Transform<Scalar,Dim,Mode,Options>::computeRotationScaling(RotationMatrixType *rotation, ScalingMatrixType *scaling) const
1041 {
1043 
1044  Scalar x = (svd.matrixU() * svd.matrixV().adjoint()).determinant(); // so x has absolute value 1
1045  VectorType sv(svd.singularValues());
1046  sv.coeffRef(0) *= x;
1047  if(scaling) scaling->lazyAssign(svd.matrixV() * sv.asDiagonal() * svd.matrixV().adjoint());
1048  if(rotation)
1049  {
1050  LinearMatrixType m(svd.matrixU());
1051  m.col(0) /= x;
1052  rotation->lazyAssign(m * svd.matrixV().adjoint());
1053  }
1054 }
1055 
1067 template<typename Scalar, int Dim, int Mode, int Options>
1068 template<typename ScalingMatrixType, typename RotationMatrixType>
1069 void Transform<Scalar,Dim,Mode,Options>::computeScalingRotation(ScalingMatrixType *scaling, RotationMatrixType *rotation) const
1070 {
1072 
1073  Scalar x = (svd.matrixU() * svd.matrixV().adjoint()).determinant(); // so x has absolute value 1
1074  VectorType sv(svd.singularValues());
1075  sv.coeffRef(0) *= x;
1076  if(scaling) scaling->lazyAssign(svd.matrixU() * sv.asDiagonal() * svd.matrixU().adjoint());
1077  if(rotation)
1078  {
1079  LinearMatrixType m(svd.matrixU());
1080  m.col(0) /= x;
1081  rotation->lazyAssign(m * svd.matrixV().adjoint());
1082  }
1083 }
1084 
1088 template<typename Scalar, int Dim, int Mode, int Options>
1089 template<typename PositionDerived, typename OrientationType, typename ScaleDerived>
1092  const OrientationType& orientation, const MatrixBase<ScaleDerived> &scale)
1093 {
1094  linear() = internal::toRotationMatrix<Scalar,Dim>(orientation);
1095  linear() *= scale.asDiagonal();
1096  translation() = position;
1097  makeAffine();
1098  return *this;
1099 }
1100 
1101 namespace internal {
1102 
1103 template<int Mode>
1104 struct transform_make_affine
1105 {
1106  template<typename MatrixType>
1107  static void run(MatrixType &mat)
1108  {
1109  static const int Dim = MatrixType::ColsAtCompileTime-1;
1110  mat.template block<1,Dim>(Dim,0).setZero();
1111  mat.coeffRef(Dim,Dim) = typename MatrixType::Scalar(1);
1112  }
1113 };
1114 
1115 template<>
1116 struct transform_make_affine<AffineCompact>
1117 {
1118  template<typename MatrixType> static void run(MatrixType &) { }
1119 };
1120 
1121 // selector needed to avoid taking the inverse of a 3x4 matrix
1122 template<typename TransformType, int Mode=TransformType::Mode>
1123 struct projective_transform_inverse
1124 {
1125  static inline void run(const TransformType&, TransformType&)
1126  {}
1127 };
1128 
1129 template<typename TransformType>
1130 struct projective_transform_inverse<TransformType, Projective>
1131 {
1132  static inline void run(const TransformType& m, TransformType& res)
1133  {
1134  res.matrix() = m.matrix().inverse();
1135  }
1136 };
1137 
1138 } // end namespace internal
1139 
1140 
1161 template<typename Scalar, int Dim, int Mode, int Options>
1162 Transform<Scalar,Dim,Mode,Options>
1164 {
1165  Transform res;
1166  if (hint == Projective)
1167  {
1168  internal::projective_transform_inverse<Transform>::run(*this, res);
1169  }
1170  else
1171  {
1172  if (hint == Isometry)
1173  {
1174  res.matrix().template topLeftCorner<Dim,Dim>() = linear().transpose();
1175  }
1176  else if(hint&Affine)
1177  {
1178  res.matrix().template topLeftCorner<Dim,Dim>() = linear().inverse();
1179  }
1180  else
1181  {
1182  eigen_assert(false && "Invalid transform traits in Transform::Inverse");
1183  }
1184  // translation and remaining parts
1185  res.matrix().template topRightCorner<Dim,1>()
1186  = - res.matrix().template topLeftCorner<Dim,Dim>() * translation();
1187  res.makeAffine(); // we do need this, because in the beginning res is uninitialized
1188  }
1189  return res;
1190 }
1191 
1192 namespace internal {
1193 
1194 /*****************************************************
1195 *** Specializations of take affine part ***
1196 *****************************************************/
1197 
1198 template<typename TransformType> struct transform_take_affine_part {
1199  typedef typename TransformType::MatrixType MatrixType;
1200  typedef typename TransformType::AffinePart AffinePart;
1201  typedef typename TransformType::ConstAffinePart ConstAffinePart;
1202  static inline AffinePart run(MatrixType& m)
1203  { return m.template block<TransformType::Dim,TransformType::HDim>(0,0); }
1204  static inline ConstAffinePart run(const MatrixType& m)
1205  { return m.template block<TransformType::Dim,TransformType::HDim>(0,0); }
1206 };
1207 
1208 template<typename Scalar, int Dim, int Options>
1209 struct transform_take_affine_part<Transform<Scalar,Dim,AffineCompact, Options> > {
1210  typedef typename Transform<Scalar,Dim,AffineCompact,Options>::MatrixType MatrixType;
1211  static inline MatrixType& run(MatrixType& m) { return m; }
1212  static inline const MatrixType& run(const MatrixType& m) { return m; }
1213 };
1214 
1215 /*****************************************************
1216 *** Specializations of construct from matrix ***
1217 *****************************************************/
1218 
1219 template<typename Other, int Mode, int Options, int Dim, int HDim>
1220 struct transform_construct_from_matrix<Other, Mode,Options,Dim,HDim, Dim,Dim>
1221 {
1222  static inline void run(Transform<typename Other::Scalar,Dim,Mode,Options> *transform, const Other& other)
1223  {
1224  transform->linear() = other;
1225  transform->translation().setZero();
1226  transform->makeAffine();
1227  }
1228 };
1229 
1230 template<typename Other, int Mode, int Options, int Dim, int HDim>
1231 struct transform_construct_from_matrix<Other, Mode,Options,Dim,HDim, Dim,HDim>
1232 {
1233  static inline void run(Transform<typename Other::Scalar,Dim,Mode,Options> *transform, const Other& other)
1234  {
1235  transform->affine() = other;
1236  transform->makeAffine();
1237  }
1238 };
1239 
1240 template<typename Other, int Mode, int Options, int Dim, int HDim>
1241 struct transform_construct_from_matrix<Other, Mode,Options,Dim,HDim, HDim,HDim>
1242 {
1243  static inline void run(Transform<typename Other::Scalar,Dim,Mode,Options> *transform, const Other& other)
1244  { transform->matrix() = other; }
1245 };
1246 
1247 template<typename Other, int Options, int Dim, int HDim>
1248 struct transform_construct_from_matrix<Other, AffineCompact,Options,Dim,HDim, HDim,HDim>
1249 {
1250  static inline void run(Transform<typename Other::Scalar,Dim,AffineCompact,Options> *transform, const Other& other)
1251  { transform->matrix() = other.template block<Dim,HDim>(0,0); }
1252 };
1253 
1254 /**********************************************************
1255 *** Specializations of operator* with rhs EigenBase ***
1256 **********************************************************/
1257 
1258 template<int LhsMode,int RhsMode>
1259 struct transform_product_result
1260 {
1261  enum
1262  {
1263  Mode =
1264  (LhsMode == (int)Projective || RhsMode == (int)Projective ) ? Projective :
1265  (LhsMode == (int)Affine || RhsMode == (int)Affine ) ? Affine :
1266  (LhsMode == (int)AffineCompact || RhsMode == (int)AffineCompact ) ? AffineCompact :
1267  (LhsMode == (int)Isometry || RhsMode == (int)Isometry ) ? Isometry : Projective
1268  };
1269 };
1270 
1271 template< typename TransformType, typename MatrixType >
1272 struct transform_right_product_impl< TransformType, MatrixType, 0 >
1273 {
1274  typedef typename MatrixType::PlainObject ResultType;
1275 
1276  static EIGEN_STRONG_INLINE ResultType run(const TransformType& T, const MatrixType& other)
1277  {
1278  return T.matrix() * other;
1279  }
1280 };
1281 
1282 template< typename TransformType, typename MatrixType >
1283 struct transform_right_product_impl< TransformType, MatrixType, 1 >
1284 {
1285  enum {
1286  Dim = TransformType::Dim,
1287  HDim = TransformType::HDim,
1288  OtherRows = MatrixType::RowsAtCompileTime,
1289  OtherCols = MatrixType::ColsAtCompileTime
1290  };
1291 
1292  typedef typename MatrixType::PlainObject ResultType;
1293 
1294  static EIGEN_STRONG_INLINE ResultType run(const TransformType& T, const MatrixType& other)
1295  {
1296  EIGEN_STATIC_ASSERT(OtherRows==HDim, YOU_MIXED_MATRICES_OF_DIFFERENT_SIZES);
1297 
1298  typedef Block<ResultType, Dim, OtherCols, int(MatrixType::RowsAtCompileTime)==Dim> TopLeftLhs;
1299 
1300  ResultType res(other.rows(),other.cols());
1301  TopLeftLhs(res, 0, 0, Dim, other.cols()).noalias() = T.affine() * other;
1302  res.row(OtherRows-1) = other.row(OtherRows-1);
1303 
1304  return res;
1305  }
1306 };
1307 
1308 template< typename TransformType, typename MatrixType >
1309 struct transform_right_product_impl< TransformType, MatrixType, 2 >
1310 {
1311  enum {
1312  Dim = TransformType::Dim,
1313  HDim = TransformType::HDim,
1314  OtherRows = MatrixType::RowsAtCompileTime,
1315  OtherCols = MatrixType::ColsAtCompileTime
1316  };
1317 
1318  typedef typename MatrixType::PlainObject ResultType;
1319 
1320  static EIGEN_STRONG_INLINE ResultType run(const TransformType& T, const MatrixType& other)
1321  {
1322  EIGEN_STATIC_ASSERT(OtherRows==Dim, YOU_MIXED_MATRICES_OF_DIFFERENT_SIZES);
1323 
1324  typedef Block<ResultType, Dim, OtherCols, true> TopLeftLhs;
1325  ResultType res(Replicate<typename TransformType::ConstTranslationPart, 1, OtherCols>(T.translation(),1,other.cols()));
1326  TopLeftLhs(res, 0, 0, Dim, other.cols()).noalias() += T.linear() * other;
1327 
1328  return res;
1329  }
1330 };
1331 
1332 /**********************************************************
1333 *** Specializations of operator* with lhs EigenBase ***
1334 **********************************************************/
1335 
1336 // generic HDim x HDim matrix * T => Projective
1337 template<typename Other,int Mode, int Options, int Dim, int HDim>
1338 struct transform_left_product_impl<Other,Mode,Options,Dim,HDim, HDim,HDim>
1339 {
1340  typedef Transform<typename Other::Scalar,Dim,Mode,Options> TransformType;
1341  typedef typename TransformType::MatrixType MatrixType;
1342  typedef Transform<typename Other::Scalar,Dim,Projective,Options> ResultType;
1343  static ResultType run(const Other& other,const TransformType& tr)
1344  { return ResultType(other * tr.matrix()); }
1345 };
1346 
1347 // generic HDim x HDim matrix * AffineCompact => Projective
1348 template<typename Other, int Options, int Dim, int HDim>
1349 struct transform_left_product_impl<Other,AffineCompact,Options,Dim,HDim, HDim,HDim>
1350 {
1351  typedef Transform<typename Other::Scalar,Dim,AffineCompact,Options> TransformType;
1352  typedef typename TransformType::MatrixType MatrixType;
1353  typedef Transform<typename Other::Scalar,Dim,Projective,Options> ResultType;
1354  static ResultType run(const Other& other,const TransformType& tr)
1355  {
1356  ResultType res;
1357  res.matrix().noalias() = other.template block<HDim,Dim>(0,0) * tr.matrix();
1358  res.matrix().col(Dim) += other.col(Dim);
1359  return res;
1360  }
1361 };
1362 
1363 // affine matrix * T
1364 template<typename Other,int Mode, int Options, int Dim, int HDim>
1365 struct transform_left_product_impl<Other,Mode,Options,Dim,HDim, Dim,HDim>
1366 {
1367  typedef Transform<typename Other::Scalar,Dim,Mode,Options> TransformType;
1368  typedef typename TransformType::MatrixType MatrixType;
1369  typedef TransformType ResultType;
1370  static ResultType run(const Other& other,const TransformType& tr)
1371  {
1372  ResultType res;
1373  res.affine().noalias() = other * tr.matrix();
1374  res.matrix().row(Dim) = tr.matrix().row(Dim);
1375  return res;
1376  }
1377 };
1378 
1379 // affine matrix * AffineCompact
1380 template<typename Other, int Options, int Dim, int HDim>
1381 struct transform_left_product_impl<Other,AffineCompact,Options,Dim,HDim, Dim,HDim>
1382 {
1383  typedef Transform<typename Other::Scalar,Dim,AffineCompact,Options> TransformType;
1384  typedef typename TransformType::MatrixType MatrixType;
1385  typedef TransformType ResultType;
1386  static ResultType run(const Other& other,const TransformType& tr)
1387  {
1388  ResultType res;
1389  res.matrix().noalias() = other.template block<Dim,Dim>(0,0) * tr.matrix();
1390  res.translation() += other.col(Dim);
1391  return res;
1392  }
1393 };
1394 
1395 // linear matrix * T
1396 template<typename Other,int Mode, int Options, int Dim, int HDim>
1397 struct transform_left_product_impl<Other,Mode,Options,Dim,HDim, Dim,Dim>
1398 {
1399  typedef Transform<typename Other::Scalar,Dim,Mode,Options> TransformType;
1400  typedef typename TransformType::MatrixType MatrixType;
1401  typedef TransformType ResultType;
1402  static ResultType run(const Other& other, const TransformType& tr)
1403  {
1404  TransformType res;
1405  if(Mode!=int(AffineCompact))
1406  res.matrix().row(Dim) = tr.matrix().row(Dim);
1407  res.matrix().template topRows<Dim>().noalias()
1408  = other * tr.matrix().template topRows<Dim>();
1409  return res;
1410  }
1411 };
1412 
1413 /**********************************************************
1414 *** Specializations of operator* with another Transform ***
1415 **********************************************************/
1416 
1417 template<typename Scalar, int Dim, int LhsMode, int LhsOptions, int RhsMode, int RhsOptions>
1418 struct transform_transform_product_impl<Transform<Scalar,Dim,LhsMode,LhsOptions>,Transform<Scalar,Dim,RhsMode,RhsOptions>,false >
1419 {
1420  enum { ResultMode = transform_product_result<LhsMode,RhsMode>::Mode };
1421  typedef Transform<Scalar,Dim,LhsMode,LhsOptions> Lhs;
1422  typedef Transform<Scalar,Dim,RhsMode,RhsOptions> Rhs;
1423  typedef Transform<Scalar,Dim,ResultMode,LhsOptions> ResultType;
1424  static ResultType run(const Lhs& lhs, const Rhs& rhs)
1425  {
1426  ResultType res;
1427  res.linear() = lhs.linear() * rhs.linear();
1428  res.translation() = lhs.linear() * rhs.translation() + lhs.translation();
1429  res.makeAffine();
1430  return res;
1431  }
1432 };
1433 
1434 template<typename Scalar, int Dim, int LhsMode, int LhsOptions, int RhsMode, int RhsOptions>
1435 struct transform_transform_product_impl<Transform<Scalar,Dim,LhsMode,LhsOptions>,Transform<Scalar,Dim,RhsMode,RhsOptions>,true >
1436 {
1437  typedef Transform<Scalar,Dim,LhsMode,LhsOptions> Lhs;
1438  typedef Transform<Scalar,Dim,RhsMode,RhsOptions> Rhs;
1439  typedef Transform<Scalar,Dim,Projective> ResultType;
1440  static ResultType run(const Lhs& lhs, const Rhs& rhs)
1441  {
1442  return ResultType( lhs.matrix() * rhs.matrix() );
1443  }
1444 };
1445 
1446 template<typename Scalar, int Dim, int LhsOptions, int RhsOptions>
1447 struct transform_transform_product_impl<Transform<Scalar,Dim,AffineCompact,LhsOptions>,Transform<Scalar,Dim,Projective,RhsOptions>,true >
1448 {
1449  typedef Transform<Scalar,Dim,AffineCompact,LhsOptions> Lhs;
1450  typedef Transform<Scalar,Dim,Projective,RhsOptions> Rhs;
1451  typedef Transform<Scalar,Dim,Projective> ResultType;
1452  static ResultType run(const Lhs& lhs, const Rhs& rhs)
1453  {
1454  ResultType res;
1455  res.matrix().template topRows<Dim>() = lhs.matrix() * rhs.matrix();
1456  res.matrix().row(Dim) = rhs.matrix().row(Dim);
1457  return res;
1458  }
1459 };
1460 
1461 template<typename Scalar, int Dim, int LhsOptions, int RhsOptions>
1462 struct transform_transform_product_impl<Transform<Scalar,Dim,Projective,LhsOptions>,Transform<Scalar,Dim,AffineCompact,RhsOptions>,true >
1463 {
1464  typedef Transform<Scalar,Dim,Projective,LhsOptions> Lhs;
1465  typedef Transform<Scalar,Dim,AffineCompact,RhsOptions> Rhs;
1466  typedef Transform<Scalar,Dim,Projective> ResultType;
1467  static ResultType run(const Lhs& lhs, const Rhs& rhs)
1468  {
1469  ResultType res(lhs.matrix().template leftCols<Dim>() * rhs.matrix());
1470  res.matrix().col(Dim) += lhs.matrix().col(Dim);
1471  return res;
1472  }
1473 };
1474 
1475 } // end namespace internal
1476 
1477 } // end namespace Eigen
1478 
1479 #endif // EIGEN_TRANSFORM_H
Transform inverse(TransformTraits traits=(TransformTraits) Mode) const
Definition: Transform.h:1163
bool isApprox(const DenseBase< OtherDerived > &other, const RealScalar &prec=NumTraits< Scalar >::dummy_precision()) const
Definition: Fuzzy.h:103
const MatrixType ConstMatrixType
Definition: Transform.h:212
Definition: Constants.h:375
Definition: Constants.h:314
Transform< float, 3, Affine > Affine3f
Definition: Transform.h:671
void setIdentity()
Definition: Transform.h:513
void computeRotationScaling(RotationMatrixType *rotation, ScalingMatrixType *scaling) const
Definition: Transform.h:1040
Transform< double, 2, AffineCompact > AffineCompact2d
Definition: Transform.h:682
Block< MatrixType, Dim, Dim, int(Mode)==(AffineCompact)&&(Options &RowMajor)==0 > LinearPart
Definition: Transform.h:216
const SingularValuesType & singularValues() const
Definition: SVDBase.h:111
Transform(const Transform< OtherScalarType, Dim, Mode, Options > &other)
Definition: Transform.h:598
Eigen::Index Index
Definition: Transform.h:208
_Scalar Scalar
Definition: Transform.h:204
const MatrixType & matrix() const
Definition: Transform.h:388
TranslationPart translation()
Definition: Transform.h:405
Transform(const EigenBase< OtherDerived > &other)
Definition: Transform.h:285
Definition: LDLT.h:16
Definition: Constants.h:439
Holds information about the various numeric (i.e. scalar) types allowed by Eigen. ...
Definition: NumTraits.h:107
RowXpr row(Index i)
Definition: DenseBase.h:797
bool isApprox(const Transform &other, const typename NumTraits< Scalar >::Real &prec=NumTraits< Scalar >::dummy_precision()) const
Definition: Transform.h:608
Derived & setIdentity()
Definition: CwiseNullaryOp.h:779
QTransform toQTransform(void) const
Definition: Transform.h:780
Derived & derived()
Definition: EigenBase.h:44
const unsigned int RowMajorBit
Definition: Constants.h:53
Definition: Constants.h:318
Matrix< Scalar, Dim, Dim, Options > LinearMatrixType
Definition: Transform.h:214
QMatrix toQMatrix(void) const
Definition: Transform.h:736
Transform & shear(const Scalar &sx, const Scalar &sy)
Definition: Transform.h:933
Definition: Constants.h:446
Matrix< Scalar, Dim, 1 > VectorType
Definition: Transform.h:228
Definition: EigenBase.h:28
ConstTranslationPart translation() const
Definition: Transform.h:403
AffinePart affine()
Definition: Transform.h:400
Represents a translation transformation.
Definition: ForwardDeclarations.h:267
Transform< double, 2, Projective > Projective2d
Definition: Transform.h:691
Transform< float, 2, AffineCompact > AffineCompact2f
Definition: Transform.h:678
Derived & setZero(Index size)
Definition: CwiseNullaryOp.h:520
ConstLinearPart linear() const
Definition: Transform.h:393
internal::conditional< int(Mode)==int(AffineCompact), MatrixType &, Block< MatrixType, Dim, HDim > >::type AffinePart
Definition: Transform.h:222
Definition: Constants.h:444
Scalar * data()
Definition: Transform.h:585
TransformTraits
Definition: Constants.h:437
const internal::transform_right_product_impl< Transform, OtherDerived >::ResultType operator*(const EigenBase< OtherDerived > &other) const
Definition: Transform.h:421
Transform< double, 3, Affine > Affine3d
Definition: Transform.h:675
ConstAffinePart affine() const
Definition: Transform.h:398
const Scalar * data() const
Definition: Transform.h:583
const MatrixVType & matrixV() const
Definition: SVDBase.h:99
Transform< double, 3, Isometry > Isometry3d
Definition: Transform.h:666
void makeAffine()
Definition: Transform.h:613
const MatrixUType & matrixU() const
Definition: SVDBase.h:83
EIGEN_MAKE_ALIGNED_OPERATOR_NEW_IF_VECTORIZABLE_FIXED_SIZE(_Scalar, _Dim==Dynamic?Dynamic:(_Dim+1)*(_Dim+1)) enum
Definition: Transform.h:197
void computeScalingRotation(ScalingMatrixType *scaling, RotationMatrixType *rotation) const
Definition: Transform.h:1069
Transform< float, 2, Projective > Projective2f
Definition: Transform.h:687
Transform & preshear(const Scalar &sx, const Scalar &sy)
Definition: Transform.h:949
Transform & operator=(const EigenBase< OtherDerived > &other)
Definition: Transform.h:296
const Block< ConstMatrixType, Dim, Dim, int(Mode)==(AffineCompact)&&(Options &RowMajor)==0 > ConstLinearPart
Definition: Transform.h:218
Transform< float, 3, Projective > Projective3f
Definition: Transform.h:689
Transform< Scalar, Dim, TransformTimeDiagonalMode > TransformTimeDiagonalReturnType
Definition: Transform.h:239
Definition: Eigen_Colamd.h:54
Transform< float, 3, AffineCompact > AffineCompact3f
Definition: Transform.h:680
Transform< double, 3, AffineCompact > AffineCompact3d
Definition: Transform.h:684
internal::make_proper_matrix_type< Scalar, Rows, HDim, Options >::type MatrixType
Definition: Transform.h:210
Transform< float, 2, Affine > Affine2f
Definition: Transform.h:669
Transform< float, 3, Isometry > Isometry3f
Definition: Transform.h:662
Expression of a fixed-size or dynamic-size block.
Definition: Block.h:104
Translation< Scalar, Dim > TranslationType
Definition: Transform.h:234
Transform< double, 2, Affine > Affine2d
Definition: Transform.h:673
Transform< double, 2, Isometry > Isometry2d
Definition: Transform.h:664
Two-sided Jacobi SVD decomposition of a rectangular matrix.
Definition: ForwardDeclarations.h:254
const LinearMatrixType rotation() const
Definition: Transform.h:1019
Definition: Constants.h:379
const DiagonalWrapper< const Derived > asDiagonal() const
Definition: DiagonalMatrix.h:278
The matrix class, also used for vectors and row-vectors.
Definition: Matrix.h:178
const Scalar * data() const
Definition: PlainObjectBase.h:228
static const Transform Identity()
Returns an identity transformation.
Definition: Transform.h:519
Definition: Constants.h:442
internal::cast_return_type< Transform, Transform< NewScalarType, Dim, Mode, Options > >::type cast() const
Definition: Transform.h:593
Base class for all dense matrices, vectors, and expressions.
Definition: MatrixBase.h:48
Represents an homogeneous transformation in a N dimensional space.
Definition: ForwardDeclarations.h:271
Transform< float, 2, Isometry > Isometry2f
Definition: Transform.h:660
Transform< double, 3, Projective > Projective3d
Definition: Transform.h:693
LinearPart linear()
Definition: Transform.h:395
internal::conditional< int(Mode)==int(AffineCompact), const MatrixType &, const Block< const MatrixType, Dim, HDim > >::type ConstAffinePart
Definition: Transform.h:226
MatrixType & matrix()
Definition: Transform.h:390
Transform()
Definition: Transform.h:249