Eigen  3.2.93
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  int RhsCols = MatrixType::ColsAtCompileTime>
37 struct transform_right_product_impl;
38 
39 template< typename Other,
40  int Mode,
41  int Options,
42  int Dim,
43  int HDim,
44  int OtherRows=Other::RowsAtCompileTime,
45  int OtherCols=Other::ColsAtCompileTime>
46 struct transform_left_product_impl;
47 
48 template< typename Lhs,
49  typename Rhs,
50  bool AnyProjective =
51  transform_traits<Lhs>::IsProjective ||
52  transform_traits<Rhs>::IsProjective>
53 struct transform_transform_product_impl;
54 
55 template< typename Other,
56  int Mode,
57  int Options,
58  int Dim,
59  int HDim,
60  int OtherRows=Other::RowsAtCompileTime,
61  int OtherCols=Other::ColsAtCompileTime>
62 struct transform_construct_from_matrix;
63 
64 template<typename TransformType> struct transform_take_affine_part;
65 
66 template<typename _Scalar, int _Dim, int _Mode, int _Options>
67 struct traits<Transform<_Scalar,_Dim,_Mode,_Options> >
68 {
69  typedef _Scalar Scalar;
70  typedef Eigen::Index StorageIndex;
71  typedef Dense StorageKind;
72  enum {
73  Dim1 = _Dim==Dynamic ? _Dim : _Dim + 1,
74  RowsAtCompileTime = _Mode==Projective ? Dim1 : _Dim,
75  ColsAtCompileTime = Dim1,
76  MaxRowsAtCompileTime = RowsAtCompileTime,
77  MaxColsAtCompileTime = ColsAtCompileTime,
78  Flags = 0
79  };
80 };
81 
82 template<int Mode> struct transform_make_affine;
83 
84 } // end namespace internal
85 
200 template<typename _Scalar, int _Dim, int _Mode, int _Options>
201 class Transform
202 {
203 public:
205  enum {
206  Mode = _Mode,
207  Options = _Options,
208  Dim = _Dim,
209  HDim = _Dim+1,
210  Rows = int(Mode)==(AffineCompact) ? Dim : HDim
211  };
213  typedef _Scalar Scalar;
214  typedef Eigen::Index StorageIndex;
215  typedef Eigen::Index Index;
216 
219  typedef const MatrixType ConstMatrixType;
227  typedef typename internal::conditional<int(Mode)==int(AffineCompact),
228  MatrixType&,
231  typedef typename internal::conditional<int(Mode)==int(AffineCompact),
232  const MatrixType&,
242 
243  // this intermediate enum is needed to avoid an ICE with gcc 3.4 and 4.0
244  enum { TransformTimeDiagonalMode = ((Mode==int(Isometry))?Affine:int(Mode)) };
247 
248 protected:
249 
250  MatrixType m_matrix;
251 
252 public:
253 
256  inline Transform()
257  {
258  check_template_params();
259  internal::transform_make_affine<(int(Mode)==Affine) ? Affine : AffineCompact>::run(m_matrix);
260  }
261 
262  inline Transform(const Transform& other)
263  {
264  check_template_params();
265  m_matrix = other.m_matrix;
266  }
267 
268  inline explicit Transform(const TranslationType& t)
269  {
270  check_template_params();
271  *this = t;
272  }
273  inline explicit Transform(const UniformScaling<Scalar>& s)
274  {
275  check_template_params();
276  *this = s;
277  }
278  template<typename Derived>
279  inline explicit Transform(const RotationBase<Derived, Dim>& r)
280  {
281  check_template_params();
282  *this = r;
283  }
284 
285  inline Transform& operator=(const Transform& other)
286  { m_matrix = other.m_matrix; return *this; }
287 
288  typedef internal::transform_take_affine_part<Transform> take_affine_part;
289 
291  template<typename OtherDerived>
292  inline explicit Transform(const EigenBase<OtherDerived>& other)
293  {
294  EIGEN_STATIC_ASSERT((internal::is_same<Scalar,typename OtherDerived::Scalar>::value),
295  YOU_MIXED_DIFFERENT_NUMERIC_TYPES__YOU_NEED_TO_USE_THE_CAST_METHOD_OF_MATRIXBASE_TO_CAST_NUMERIC_TYPES_EXPLICITLY);
296 
297  check_template_params();
298  internal::transform_construct_from_matrix<OtherDerived,Mode,Options,Dim,HDim>::run(this, other.derived());
299  }
300 
302  template<typename OtherDerived>
304  {
305  EIGEN_STATIC_ASSERT((internal::is_same<Scalar,typename OtherDerived::Scalar>::value),
306  YOU_MIXED_DIFFERENT_NUMERIC_TYPES__YOU_NEED_TO_USE_THE_CAST_METHOD_OF_MATRIXBASE_TO_CAST_NUMERIC_TYPES_EXPLICITLY);
307 
308  internal::transform_construct_from_matrix<OtherDerived,Mode,Options,Dim,HDim>::run(this, other.derived());
309  return *this;
310  }
311 
312  template<int OtherOptions>
314  {
315  check_template_params();
316  // only the options change, we can directly copy the matrices
317  m_matrix = other.matrix();
318  }
319 
320  template<int OtherMode,int OtherOptions>
322  {
323  check_template_params();
324  // prevent conversions as:
325  // Affine | AffineCompact | Isometry = Projective
326  EIGEN_STATIC_ASSERT(EIGEN_IMPLIES(OtherMode==int(Projective), Mode==int(Projective)),
327  YOU_PERFORMED_AN_INVALID_TRANSFORMATION_CONVERSION)
328 
329  // prevent conversions as:
330  // Isometry = Affine | AffineCompact
331  EIGEN_STATIC_ASSERT(EIGEN_IMPLIES(OtherMode==int(Affine)||OtherMode==int(AffineCompact), Mode!=int(Isometry)),
332  YOU_PERFORMED_AN_INVALID_TRANSFORMATION_CONVERSION)
333 
334  enum { ModeIsAffineCompact = Mode == int(AffineCompact),
335  OtherModeIsAffineCompact = OtherMode == int(AffineCompact)
336  };
337 
338  if(ModeIsAffineCompact == OtherModeIsAffineCompact)
339  {
340  // We need the block expression because the code is compiled for all
341  // combinations of transformations and will trigger a compile time error
342  // if one tries to assign the matrices directly
343  m_matrix.template block<Dim,Dim+1>(0,0) = other.matrix().template block<Dim,Dim+1>(0,0);
344  makeAffine();
345  }
346  else if(OtherModeIsAffineCompact)
347  {
348  typedef typename Transform<Scalar,Dim,OtherMode,OtherOptions>::MatrixType OtherMatrixType;
349  internal::transform_construct_from_matrix<OtherMatrixType,Mode,Options,Dim,HDim>::run(this, other.matrix());
350  }
351  else
352  {
353  // here we know that Mode == AffineCompact and OtherMode != AffineCompact.
354  // if OtherMode were Projective, the static assert above would already have caught it.
355  // So the only possibility is that OtherMode == Affine
356  linear() = other.linear();
357  translation() = other.translation();
358  }
359  }
360 
361  template<typename OtherDerived>
362  Transform(const ReturnByValue<OtherDerived>& other)
363  {
364  check_template_params();
365  other.evalTo(*this);
366  }
367 
368  template<typename OtherDerived>
369  Transform& operator=(const ReturnByValue<OtherDerived>& other)
370  {
371  other.evalTo(*this);
372  return *this;
373  }
374 
375  #ifdef EIGEN_QT_SUPPORT
376  inline Transform(const QMatrix& other);
377  inline Transform& operator=(const QMatrix& other);
378  inline QMatrix toQMatrix(void) const;
379  inline Transform(const QTransform& other);
380  inline Transform& operator=(const QTransform& other);
381  inline QTransform toQTransform(void) const;
382  #endif
383 
384  Index rows() const { return int(Mode)==int(Projective) ? m_matrix.cols() : (m_matrix.cols()-1); }
385  Index cols() const { return m_matrix.cols(); }
386 
389  inline Scalar operator() (Index row, Index col) const { return m_matrix(row,col); }
392  inline Scalar& operator() (Index row, Index col) { return m_matrix(row,col); }
393 
395  inline const MatrixType& matrix() const { return m_matrix; }
397  inline MatrixType& matrix() { return m_matrix; }
398 
400  inline ConstLinearPart linear() const { return ConstLinearPart(m_matrix,0,0); }
402  inline LinearPart linear() { return LinearPart(m_matrix,0,0); }
403 
405  inline ConstAffinePart affine() const { return take_affine_part::run(m_matrix); }
407  inline AffinePart affine() { return take_affine_part::run(m_matrix); }
408 
410  inline ConstTranslationPart translation() const { return ConstTranslationPart(m_matrix,0,Dim); }
412  inline TranslationPart translation() { return TranslationPart(m_matrix,0,Dim); }
413 
438  // note: this function is defined here because some compilers cannot find the respective declaration
439  template<typename OtherDerived>
440  EIGEN_STRONG_INLINE const typename internal::transform_right_product_impl<Transform, OtherDerived>::ResultType
442  { return internal::transform_right_product_impl<Transform, OtherDerived>::run(*this,other.derived()); }
443 
451  template<typename OtherDerived> friend
452  inline const typename internal::transform_left_product_impl<OtherDerived,Mode,Options,_Dim,_Dim+1>::ResultType
454  { return internal::transform_left_product_impl<OtherDerived,Mode,Options,Dim,HDim>::run(a.derived(),b); }
455 
462  template<typename DiagonalDerived>
463  inline const TransformTimeDiagonalReturnType
464  operator * (const DiagonalBase<DiagonalDerived> &b) const
465  {
466  TransformTimeDiagonalReturnType res(*this);
467  res.linear() *= b;
468  return res;
469  }
470 
477  template<typename DiagonalDerived>
478  friend inline TransformTimeDiagonalReturnType
479  operator * (const DiagonalBase<DiagonalDerived> &a, const Transform &b)
480  {
481  TransformTimeDiagonalReturnType res;
482  res.linear().noalias() = a*b.linear();
483  res.translation().noalias() = a*b.translation();
484  if (Mode!=int(AffineCompact))
485  res.matrix().row(Dim) = b.matrix().row(Dim);
486  return res;
487  }
488 
489  template<typename OtherDerived>
490  inline Transform& operator*=(const EigenBase<OtherDerived>& other) { return *this = *this * other; }
491 
493  inline const Transform operator * (const Transform& other) const
494  {
495  return internal::transform_transform_product_impl<Transform,Transform>::run(*this,other);
496  }
497 
498  #if EIGEN_COMP_ICC
499 private:
500  // this intermediate structure permits to workaround a bug in ICC 11:
501  // error: template instantiation resulted in unexpected function type of "Eigen::Transform<double, 3, 32, 0>
502  // (const Eigen::Transform<double, 3, 2, 0> &) const"
503  // (the meaning of a name may have changed since the template declaration -- the type of the template is:
504  // "Eigen::internal::transform_transform_product_impl<Eigen::Transform<double, 3, 32, 0>,
505  // Eigen::Transform<double, 3, Mode, Options>, <expression>>::ResultType (const Eigen::Transform<double, 3, Mode, Options> &) const")
506  //
507  template<int OtherMode,int OtherOptions> struct icc_11_workaround
508  {
509  typedef internal::transform_transform_product_impl<Transform,Transform<Scalar,Dim,OtherMode,OtherOptions> > ProductType;
510  typedef typename ProductType::ResultType ResultType;
511  };
512 
513 public:
515  template<int OtherMode,int OtherOptions>
516  inline typename icc_11_workaround<OtherMode,OtherOptions>::ResultType
518  {
519  typedef typename icc_11_workaround<OtherMode,OtherOptions>::ProductType ProductType;
520  return ProductType::run(*this,other);
521  }
522  #else
523 
524  template<int OtherMode,int OtherOptions>
525  inline typename internal::transform_transform_product_impl<Transform,Transform<Scalar,Dim,OtherMode,OtherOptions> >::ResultType
527  {
528  return internal::transform_transform_product_impl<Transform,Transform<Scalar,Dim,OtherMode,OtherOptions> >::run(*this,other);
529  }
530  #endif
531 
533  void setIdentity() { m_matrix.setIdentity(); }
534 
539  static const Transform Identity()
540  {
541  return Transform(MatrixType::Identity());
542  }
543 
544  template<typename OtherDerived>
545  inline Transform& scale(const MatrixBase<OtherDerived> &other);
546 
547  template<typename OtherDerived>
548  inline Transform& prescale(const MatrixBase<OtherDerived> &other);
549 
550  inline Transform& scale(const Scalar& s);
551  inline Transform& prescale(const Scalar& s);
552 
553  template<typename OtherDerived>
554  inline Transform& translate(const MatrixBase<OtherDerived> &other);
555 
556  template<typename OtherDerived>
557  inline Transform& pretranslate(const MatrixBase<OtherDerived> &other);
558 
559  template<typename RotationType>
560  inline Transform& rotate(const RotationType& rotation);
561 
562  template<typename RotationType>
563  inline Transform& prerotate(const RotationType& rotation);
564 
565  Transform& shear(const Scalar& sx, const Scalar& sy);
566  Transform& preshear(const Scalar& sx, const Scalar& sy);
567 
568  inline Transform& operator=(const TranslationType& t);
569  inline Transform& operator*=(const TranslationType& t) { return translate(t.vector()); }
570  inline Transform operator*(const TranslationType& t) const;
571 
572  inline Transform& operator=(const UniformScaling<Scalar>& t);
573  inline Transform& operator*=(const UniformScaling<Scalar>& s) { return scale(s.factor()); }
574  inline TransformTimeDiagonalReturnType operator*(const UniformScaling<Scalar>& s) const
575  {
576  TransformTimeDiagonalReturnType res = *this;
577  res.scale(s.factor());
578  return res;
579  }
580 
581  inline Transform& operator*=(const DiagonalMatrix<Scalar,Dim>& s) { linear() *= s; return *this; }
582 
583  template<typename Derived>
584  inline Transform& operator=(const RotationBase<Derived,Dim>& r);
585  template<typename Derived>
586  inline Transform& operator*=(const RotationBase<Derived,Dim>& r) { return rotate(r.toRotationMatrix()); }
587  template<typename Derived>
588  inline Transform operator*(const RotationBase<Derived,Dim>& r) const;
589 
590  const LinearMatrixType rotation() const;
591  template<typename RotationMatrixType, typename ScalingMatrixType>
592  void computeRotationScaling(RotationMatrixType *rotation, ScalingMatrixType *scaling) const;
593  template<typename ScalingMatrixType, typename RotationMatrixType>
594  void computeScalingRotation(ScalingMatrixType *scaling, RotationMatrixType *rotation) const;
595 
596  template<typename PositionDerived, typename OrientationType, typename ScaleDerived>
597  Transform& fromPositionOrientationScale(const MatrixBase<PositionDerived> &position,
598  const OrientationType& orientation, const MatrixBase<ScaleDerived> &scale);
599 
600  inline Transform inverse(TransformTraits traits = (TransformTraits)Mode) const;
601 
603  const Scalar* data() const { return m_matrix.data(); }
605  Scalar* data() { return m_matrix.data(); }
606 
612  template<typename NewScalarType>
613  inline typename internal::cast_return_type<Transform,Transform<NewScalarType,Dim,Mode,Options> >::type cast() const
614  { return typename internal::cast_return_type<Transform,Transform<NewScalarType,Dim,Mode,Options> >::type(*this); }
615 
617  template<typename OtherScalarType>
619  {
620  check_template_params();
621  m_matrix = other.matrix().template cast<Scalar>();
622  }
623 
628  bool isApprox(const Transform& other, const typename NumTraits<Scalar>::Real& prec = NumTraits<Scalar>::dummy_precision()) const
629  { return m_matrix.isApprox(other.m_matrix, prec); }
630 
633  void makeAffine()
634  {
635  internal::transform_make_affine<int(Mode)>::run(m_matrix);
636  }
637 
643  { return m_matrix.template block<int(Mode)==int(Projective)?HDim:Dim,Dim>(0,0); }
648  inline const Block<MatrixType,int(Mode)==int(Projective)?HDim:Dim,Dim> linearExt() const
649  { return m_matrix.template block<int(Mode)==int(Projective)?HDim:Dim,Dim>(0,0); }
650 
656  { return m_matrix.template block<int(Mode)==int(Projective)?HDim:Dim,1>(0,Dim); }
661  inline const Block<MatrixType,int(Mode)==int(Projective)?HDim:Dim,1> translationExt() const
662  { return m_matrix.template block<int(Mode)==int(Projective)?HDim:Dim,1>(0,Dim); }
663 
664 
665  #ifdef EIGEN_TRANSFORM_PLUGIN
666  #include EIGEN_TRANSFORM_PLUGIN
667  #endif
668 
669 protected:
670  #ifndef EIGEN_PARSED_BY_DOXYGEN
671  static EIGEN_STRONG_INLINE void check_template_params()
672  {
673  EIGEN_STATIC_ASSERT((Options & (DontAlign|RowMajor)) == Options, INVALID_MATRIX_TEMPLATE_PARAMETERS)
674  }
675  #endif
676 
677 };
678 
687 
696 
705 
714 
715 /**************************
716 *** Optional QT support ***
717 **************************/
718 
719 #ifdef EIGEN_QT_SUPPORT
720 
724 template<typename Scalar, int Dim, int Mode,int Options>
726 {
727  check_template_params();
728  *this = other;
729 }
730 
735 template<typename Scalar, int Dim, int Mode,int Options>
737 {
738  EIGEN_STATIC_ASSERT(Dim==2, YOU_MADE_A_PROGRAMMING_MISTAKE)
739  if (Mode == int(AffineCompact))
740  m_matrix << other.m11(), other.m21(), other.dx(),
741  other.m12(), other.m22(), other.dy();
742  else
743  m_matrix << other.m11(), other.m21(), other.dx(),
744  other.m12(), other.m22(), other.dy(),
745  0, 0, 1;
746  return *this;
747 }
748 
755 template<typename Scalar, int Dim, int Mode, int Options>
757 {
758  check_template_params();
759  EIGEN_STATIC_ASSERT(Dim==2, YOU_MADE_A_PROGRAMMING_MISTAKE)
760  return QMatrix(m_matrix.coeff(0,0), m_matrix.coeff(1,0),
761  m_matrix.coeff(0,1), m_matrix.coeff(1,1),
762  m_matrix.coeff(0,2), m_matrix.coeff(1,2));
763 }
764 
769 template<typename Scalar, int Dim, int Mode,int Options>
771 {
772  check_template_params();
773  *this = other;
774 }
775 
780 template<typename Scalar, int Dim, int Mode, int Options>
782 {
783  check_template_params();
784  EIGEN_STATIC_ASSERT(Dim==2, YOU_MADE_A_PROGRAMMING_MISTAKE)
785  if (Mode == int(AffineCompact))
786  m_matrix << other.m11(), other.m21(), other.dx(),
787  other.m12(), other.m22(), other.dy();
788  else
789  m_matrix << other.m11(), other.m21(), other.dx(),
790  other.m12(), other.m22(), other.dy(),
791  other.m13(), other.m23(), other.m33();
792  return *this;
793 }
794 
799 template<typename Scalar, int Dim, int Mode, int Options>
801 {
802  EIGEN_STATIC_ASSERT(Dim==2, YOU_MADE_A_PROGRAMMING_MISTAKE)
803  if (Mode == int(AffineCompact))
804  return QTransform(m_matrix.coeff(0,0), m_matrix.coeff(1,0),
805  m_matrix.coeff(0,1), m_matrix.coeff(1,1),
806  m_matrix.coeff(0,2), m_matrix.coeff(1,2));
807  else
808  return QTransform(m_matrix.coeff(0,0), m_matrix.coeff(1,0), m_matrix.coeff(2,0),
809  m_matrix.coeff(0,1), m_matrix.coeff(1,1), m_matrix.coeff(2,1),
810  m_matrix.coeff(0,2), m_matrix.coeff(1,2), m_matrix.coeff(2,2));
811 }
812 #endif
813 
814 /*********************
815 *** Procedural API ***
816 *********************/
817 
822 template<typename Scalar, int Dim, int Mode, int Options>
823 template<typename OtherDerived>
826 {
827  EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(OtherDerived,int(Dim))
828  EIGEN_STATIC_ASSERT(Mode!=int(Isometry), THIS_METHOD_IS_ONLY_FOR_SPECIFIC_TRANSFORMATIONS)
829  linearExt().noalias() = (linearExt() * other.asDiagonal());
830  return *this;
831 }
832 
837 template<typename Scalar, int Dim, int Mode, int Options>
839 {
840  EIGEN_STATIC_ASSERT(Mode!=int(Isometry), THIS_METHOD_IS_ONLY_FOR_SPECIFIC_TRANSFORMATIONS)
841  linearExt() *= s;
842  return *this;
843 }
844 
849 template<typename Scalar, int Dim, int Mode, int Options>
850 template<typename OtherDerived>
853 {
854  EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(OtherDerived,int(Dim))
855  EIGEN_STATIC_ASSERT(Mode!=int(Isometry), THIS_METHOD_IS_ONLY_FOR_SPECIFIC_TRANSFORMATIONS)
856  m_matrix.template block<Dim,HDim>(0,0).noalias() = (other.asDiagonal() * m_matrix.template block<Dim,HDim>(0,0));
857  return *this;
858 }
859 
864 template<typename Scalar, int Dim, int Mode, int Options>
866 {
867  EIGEN_STATIC_ASSERT(Mode!=int(Isometry), THIS_METHOD_IS_ONLY_FOR_SPECIFIC_TRANSFORMATIONS)
868  m_matrix.template topRows<Dim>() *= s;
869  return *this;
870 }
871 
876 template<typename Scalar, int Dim, int Mode, int Options>
877 template<typename OtherDerived>
880 {
881  EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(OtherDerived,int(Dim))
882  translationExt() += linearExt() * other;
883  return *this;
884 }
885 
890 template<typename Scalar, int Dim, int Mode, int Options>
891 template<typename OtherDerived>
894 {
895  EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(OtherDerived,int(Dim))
896  if(int(Mode)==int(Projective))
897  affine() += other * m_matrix.row(Dim);
898  else
899  translation() += other;
900  return *this;
901 }
902 
920 template<typename Scalar, int Dim, int Mode, int Options>
921 template<typename RotationType>
923 Transform<Scalar,Dim,Mode,Options>::rotate(const RotationType& rotation)
924 {
925  linearExt() *= internal::toRotationMatrix<Scalar,Dim>(rotation);
926  return *this;
927 }
928 
936 template<typename Scalar, int Dim, int Mode, int Options>
937 template<typename RotationType>
940 {
941  m_matrix.template block<Dim,HDim>(0,0) = internal::toRotationMatrix<Scalar,Dim>(rotation)
942  * m_matrix.template block<Dim,HDim>(0,0);
943  return *this;
944 }
945 
951 template<typename Scalar, int Dim, int Mode, int Options>
953 Transform<Scalar,Dim,Mode,Options>::shear(const Scalar& sx, const Scalar& sy)
954 {
955  EIGEN_STATIC_ASSERT(int(Dim)==2, YOU_MADE_A_PROGRAMMING_MISTAKE)
956  EIGEN_STATIC_ASSERT(Mode!=int(Isometry), THIS_METHOD_IS_ONLY_FOR_SPECIFIC_TRANSFORMATIONS)
957  VectorType tmp = linear().col(0)*sy + linear().col(1);
958  linear() << linear().col(0) + linear().col(1)*sx, tmp;
959  return *this;
960 }
961 
967 template<typename Scalar, int Dim, int Mode, int Options>
969 Transform<Scalar,Dim,Mode,Options>::preshear(const Scalar& sx, const Scalar& sy)
970 {
971  EIGEN_STATIC_ASSERT(int(Dim)==2, YOU_MADE_A_PROGRAMMING_MISTAKE)
972  EIGEN_STATIC_ASSERT(Mode!=int(Isometry), THIS_METHOD_IS_ONLY_FOR_SPECIFIC_TRANSFORMATIONS)
973  m_matrix.template block<Dim,HDim>(0,0) = LinearMatrixType(1, sx, sy, 1) * m_matrix.template block<Dim,HDim>(0,0);
974  return *this;
975 }
976 
977 /******************************************************
978 *** Scaling, Translation and Rotation compatibility ***
979 ******************************************************/
980 
981 template<typename Scalar, int Dim, int Mode, int Options>
983 {
984  linear().setIdentity();
985  translation() = t.vector();
986  makeAffine();
987  return *this;
988 }
989 
990 template<typename Scalar, int Dim, int Mode, int Options>
992 {
993  Transform res = *this;
994  res.translate(t.vector());
995  return res;
996 }
997 
998 template<typename Scalar, int Dim, int Mode, int Options>
1000 {
1001  m_matrix.setZero();
1002  linear().diagonal().fill(s.factor());
1003  makeAffine();
1004  return *this;
1005 }
1006 
1007 template<typename Scalar, int Dim, int Mode, int Options>
1008 template<typename Derived>
1010 {
1011  linear() = internal::toRotationMatrix<Scalar,Dim>(r);
1012  translation().setZero();
1013  makeAffine();
1014  return *this;
1015 }
1016 
1017 template<typename Scalar, int Dim, int Mode, int Options>
1018 template<typename Derived>
1020 {
1021  Transform res = *this;
1022  res.rotate(r.derived());
1023  return res;
1024 }
1025 
1026 /************************
1027 *** Special functions ***
1028 ************************/
1029 
1037 template<typename Scalar, int Dim, int Mode, int Options>
1040 {
1041  LinearMatrixType result;
1042  computeRotationScaling(&result, (LinearMatrixType*)0);
1043  return result;
1044 }
1045 
1046 
1058 template<typename Scalar, int Dim, int Mode, int Options>
1059 template<typename RotationMatrixType, typename ScalingMatrixType>
1060 void Transform<Scalar,Dim,Mode,Options>::computeRotationScaling(RotationMatrixType *rotation, ScalingMatrixType *scaling) const
1061 {
1063 
1064  Scalar x = (svd.matrixU() * svd.matrixV().adjoint()).determinant(); // so x has absolute value 1
1065  VectorType sv(svd.singularValues());
1066  sv.coeffRef(0) *= x;
1067  if(scaling) scaling->lazyAssign(svd.matrixV() * sv.asDiagonal() * svd.matrixV().adjoint());
1068  if(rotation)
1069  {
1070  LinearMatrixType m(svd.matrixU());
1071  m.col(0) /= x;
1072  rotation->lazyAssign(m * svd.matrixV().adjoint());
1073  }
1074 }
1075 
1087 template<typename Scalar, int Dim, int Mode, int Options>
1088 template<typename ScalingMatrixType, typename RotationMatrixType>
1089 void Transform<Scalar,Dim,Mode,Options>::computeScalingRotation(ScalingMatrixType *scaling, RotationMatrixType *rotation) const
1090 {
1092 
1093  Scalar x = (svd.matrixU() * svd.matrixV().adjoint()).determinant(); // so x has absolute value 1
1094  VectorType sv(svd.singularValues());
1095  sv.coeffRef(0) *= x;
1096  if(scaling) scaling->lazyAssign(svd.matrixU() * sv.asDiagonal() * svd.matrixU().adjoint());
1097  if(rotation)
1098  {
1099  LinearMatrixType m(svd.matrixU());
1100  m.col(0) /= x;
1101  rotation->lazyAssign(m * svd.matrixV().adjoint());
1102  }
1103 }
1104 
1108 template<typename Scalar, int Dim, int Mode, int Options>
1109 template<typename PositionDerived, typename OrientationType, typename ScaleDerived>
1112  const OrientationType& orientation, const MatrixBase<ScaleDerived> &scale)
1113 {
1114  linear() = internal::toRotationMatrix<Scalar,Dim>(orientation);
1115  linear() *= scale.asDiagonal();
1116  translation() = position;
1117  makeAffine();
1118  return *this;
1119 }
1120 
1121 namespace internal {
1122 
1123 template<int Mode>
1124 struct transform_make_affine
1125 {
1126  template<typename MatrixType>
1127  static void run(MatrixType &mat)
1128  {
1129  static const int Dim = MatrixType::ColsAtCompileTime-1;
1130  mat.template block<1,Dim>(Dim,0).setZero();
1131  mat.coeffRef(Dim,Dim) = typename MatrixType::Scalar(1);
1132  }
1133 };
1134 
1135 template<>
1136 struct transform_make_affine<AffineCompact>
1137 {
1138  template<typename MatrixType> static void run(MatrixType &) { }
1139 };
1140 
1141 // selector needed to avoid taking the inverse of a 3x4 matrix
1142 template<typename TransformType, int Mode=TransformType::Mode>
1143 struct projective_transform_inverse
1144 {
1145  static inline void run(const TransformType&, TransformType&)
1146  {}
1147 };
1148 
1149 template<typename TransformType>
1150 struct projective_transform_inverse<TransformType, Projective>
1151 {
1152  static inline void run(const TransformType& m, TransformType& res)
1153  {
1154  res.matrix() = m.matrix().inverse();
1155  }
1156 };
1157 
1158 } // end namespace internal
1159 
1160 
1181 template<typename Scalar, int Dim, int Mode, int Options>
1184 {
1185  Transform res;
1186  if (hint == Projective)
1187  {
1188  internal::projective_transform_inverse<Transform>::run(*this, res);
1189  }
1190  else
1191  {
1192  if (hint == Isometry)
1193  {
1194  res.matrix().template topLeftCorner<Dim,Dim>() = linear().transpose();
1195  }
1196  else if(hint&Affine)
1197  {
1198  res.matrix().template topLeftCorner<Dim,Dim>() = linear().inverse();
1199  }
1200  else
1201  {
1202  eigen_assert(false && "Invalid transform traits in Transform::Inverse");
1203  }
1204  // translation and remaining parts
1205  res.matrix().template topRightCorner<Dim,1>()
1206  = - res.matrix().template topLeftCorner<Dim,Dim>() * translation();
1207  res.makeAffine(); // we do need this, because in the beginning res is uninitialized
1208  }
1209  return res;
1210 }
1211 
1212 namespace internal {
1213 
1214 /*****************************************************
1215 *** Specializations of take affine part ***
1216 *****************************************************/
1217 
1218 template<typename TransformType> struct transform_take_affine_part {
1219  typedef typename TransformType::MatrixType MatrixType;
1220  typedef typename TransformType::AffinePart AffinePart;
1221  typedef typename TransformType::ConstAffinePart ConstAffinePart;
1222  static inline AffinePart run(MatrixType& m)
1223  { return m.template block<TransformType::Dim,TransformType::HDim>(0,0); }
1224  static inline ConstAffinePart run(const MatrixType& m)
1225  { return m.template block<TransformType::Dim,TransformType::HDim>(0,0); }
1226 };
1227 
1228 template<typename Scalar, int Dim, int Options>
1229 struct transform_take_affine_part<Transform<Scalar,Dim,AffineCompact, Options> > {
1230  typedef typename Transform<Scalar,Dim,AffineCompact,Options>::MatrixType MatrixType;
1231  static inline MatrixType& run(MatrixType& m) { return m; }
1232  static inline const MatrixType& run(const MatrixType& m) { return m; }
1233 };
1234 
1235 /*****************************************************
1236 *** Specializations of construct from matrix ***
1237 *****************************************************/
1238 
1239 template<typename Other, int Mode, int Options, int Dim, int HDim>
1240 struct transform_construct_from_matrix<Other, Mode,Options,Dim,HDim, Dim,Dim>
1241 {
1242  static inline void run(Transform<typename Other::Scalar,Dim,Mode,Options> *transform, const Other& other)
1243  {
1244  transform->linear() = other;
1245  transform->translation().setZero();
1246  transform->makeAffine();
1247  }
1248 };
1249 
1250 template<typename Other, int Mode, int Options, int Dim, int HDim>
1251 struct transform_construct_from_matrix<Other, Mode,Options,Dim,HDim, Dim,HDim>
1252 {
1253  static inline void run(Transform<typename Other::Scalar,Dim,Mode,Options> *transform, const Other& other)
1254  {
1255  transform->affine() = other;
1256  transform->makeAffine();
1257  }
1258 };
1259 
1260 template<typename Other, int Mode, int Options, int Dim, int HDim>
1261 struct transform_construct_from_matrix<Other, Mode,Options,Dim,HDim, HDim,HDim>
1262 {
1263  static inline void run(Transform<typename Other::Scalar,Dim,Mode,Options> *transform, const Other& other)
1264  { transform->matrix() = other; }
1265 };
1266 
1267 template<typename Other, int Options, int Dim, int HDim>
1268 struct transform_construct_from_matrix<Other, AffineCompact,Options,Dim,HDim, HDim,HDim>
1269 {
1270  static inline void run(Transform<typename Other::Scalar,Dim,AffineCompact,Options> *transform, const Other& other)
1271  { transform->matrix() = other.template block<Dim,HDim>(0,0); }
1272 };
1273 
1274 /**********************************************************
1275 *** Specializations of operator* with rhs EigenBase ***
1276 **********************************************************/
1277 
1278 template<int LhsMode,int RhsMode>
1279 struct transform_product_result
1280 {
1281  enum
1282  {
1283  Mode =
1284  (LhsMode == (int)Projective || RhsMode == (int)Projective ) ? Projective :
1285  (LhsMode == (int)Affine || RhsMode == (int)Affine ) ? Affine :
1286  (LhsMode == (int)AffineCompact || RhsMode == (int)AffineCompact ) ? AffineCompact :
1287  (LhsMode == (int)Isometry || RhsMode == (int)Isometry ) ? Isometry : Projective
1288  };
1289 };
1290 
1291 template< typename TransformType, typename MatrixType, int RhsCols>
1292 struct transform_right_product_impl< TransformType, MatrixType, 0, RhsCols>
1293 {
1294  typedef typename MatrixType::PlainObject ResultType;
1295 
1296  static EIGEN_STRONG_INLINE ResultType run(const TransformType& T, const MatrixType& other)
1297  {
1298  return T.matrix() * other;
1299  }
1300 };
1301 
1302 template< typename TransformType, typename MatrixType, int RhsCols>
1303 struct transform_right_product_impl< TransformType, MatrixType, 1, RhsCols>
1304 {
1305  enum {
1306  Dim = TransformType::Dim,
1307  HDim = TransformType::HDim,
1308  OtherRows = MatrixType::RowsAtCompileTime,
1309  OtherCols = MatrixType::ColsAtCompileTime
1310  };
1311 
1312  typedef typename MatrixType::PlainObject ResultType;
1313 
1314  static EIGEN_STRONG_INLINE ResultType run(const TransformType& T, const MatrixType& other)
1315  {
1316  EIGEN_STATIC_ASSERT(OtherRows==HDim, YOU_MIXED_MATRICES_OF_DIFFERENT_SIZES);
1317 
1319 
1320  ResultType res(other.rows(),other.cols());
1321  TopLeftLhs(res, 0, 0, Dim, other.cols()).noalias() = T.affine() * other;
1322  res.row(OtherRows-1) = other.row(OtherRows-1);
1323 
1324  return res;
1325  }
1326 };
1327 
1328 template< typename TransformType, typename MatrixType, int RhsCols>
1329 struct transform_right_product_impl< TransformType, MatrixType, 2, RhsCols>
1330 {
1331  enum {
1332  Dim = TransformType::Dim,
1333  HDim = TransformType::HDim,
1334  OtherRows = MatrixType::RowsAtCompileTime,
1335  OtherCols = MatrixType::ColsAtCompileTime
1336  };
1337 
1338  typedef typename MatrixType::PlainObject ResultType;
1339 
1340  static EIGEN_STRONG_INLINE ResultType run(const TransformType& T, const MatrixType& other)
1341  {
1342  EIGEN_STATIC_ASSERT(OtherRows==Dim, YOU_MIXED_MATRICES_OF_DIFFERENT_SIZES);
1343 
1344  typedef Block<ResultType, Dim, OtherCols, true> TopLeftLhs;
1345  ResultType res(Replicate<typename TransformType::ConstTranslationPart, 1, OtherCols>(T.translation(),1,other.cols()));
1346  TopLeftLhs(res, 0, 0, Dim, other.cols()).noalias() += T.linear() * other;
1347 
1348  return res;
1349  }
1350 };
1351 
1352 template< typename TransformType, typename MatrixType >
1353 struct transform_right_product_impl< TransformType, MatrixType, 2, 1> // rhs is a vector of size Dim
1354 {
1355  typedef typename TransformType::MatrixType TransformMatrix;
1356  enum {
1357  Dim = TransformType::Dim,
1358  HDim = TransformType::HDim,
1359  OtherRows = MatrixType::RowsAtCompileTime,
1360  WorkingRows = EIGEN_PLAIN_ENUM_MIN(TransformMatrix::RowsAtCompileTime,HDim)
1361  };
1362 
1363  typedef typename MatrixType::PlainObject ResultType;
1364 
1365  static EIGEN_STRONG_INLINE ResultType run(const TransformType& T, const MatrixType& other)
1366  {
1367  EIGEN_STATIC_ASSERT(OtherRows==Dim, YOU_MIXED_MATRICES_OF_DIFFERENT_SIZES);
1368 
1370  rhs.template head<Dim>() = other; rhs[Dim] = typename ResultType::Scalar(1);
1372  return res.template head<Dim>();
1373  }
1374 };
1375 
1376 /**********************************************************
1377 *** Specializations of operator* with lhs EigenBase ***
1378 **********************************************************/
1379 
1380 // generic HDim x HDim matrix * T => Projective
1381 template<typename Other,int Mode, int Options, int Dim, int HDim>
1382 struct transform_left_product_impl<Other,Mode,Options,Dim,HDim, HDim,HDim>
1383 {
1385  typedef typename TransformType::MatrixType MatrixType;
1387  static ResultType run(const Other& other,const TransformType& tr)
1388  { return ResultType(other * tr.matrix()); }
1389 };
1390 
1391 // generic HDim x HDim matrix * AffineCompact => Projective
1392 template<typename Other, int Options, int Dim, int HDim>
1393 struct transform_left_product_impl<Other,AffineCompact,Options,Dim,HDim, HDim,HDim>
1394 {
1396  typedef typename TransformType::MatrixType MatrixType;
1398  static ResultType run(const Other& other,const TransformType& tr)
1399  {
1400  ResultType res;
1401  res.matrix().noalias() = other.template block<HDim,Dim>(0,0) * tr.matrix();
1402  res.matrix().col(Dim) += other.col(Dim);
1403  return res;
1404  }
1405 };
1406 
1407 // affine matrix * T
1408 template<typename Other,int Mode, int Options, int Dim, int HDim>
1409 struct transform_left_product_impl<Other,Mode,Options,Dim,HDim, Dim,HDim>
1410 {
1412  typedef typename TransformType::MatrixType MatrixType;
1413  typedef TransformType ResultType;
1414  static ResultType run(const Other& other,const TransformType& tr)
1415  {
1416  ResultType res;
1417  res.affine().noalias() = other * tr.matrix();
1418  res.matrix().row(Dim) = tr.matrix().row(Dim);
1419  return res;
1420  }
1421 };
1422 
1423 // affine matrix * AffineCompact
1424 template<typename Other, int Options, int Dim, int HDim>
1425 struct transform_left_product_impl<Other,AffineCompact,Options,Dim,HDim, Dim,HDim>
1426 {
1428  typedef typename TransformType::MatrixType MatrixType;
1429  typedef TransformType ResultType;
1430  static ResultType run(const Other& other,const TransformType& tr)
1431  {
1432  ResultType res;
1433  res.matrix().noalias() = other.template block<Dim,Dim>(0,0) * tr.matrix();
1434  res.translation() += other.col(Dim);
1435  return res;
1436  }
1437 };
1438 
1439 // linear matrix * T
1440 template<typename Other,int Mode, int Options, int Dim, int HDim>
1441 struct transform_left_product_impl<Other,Mode,Options,Dim,HDim, Dim,Dim>
1442 {
1444  typedef typename TransformType::MatrixType MatrixType;
1445  typedef TransformType ResultType;
1446  static ResultType run(const Other& other, const TransformType& tr)
1447  {
1448  TransformType res;
1449  if(Mode!=int(AffineCompact))
1450  res.matrix().row(Dim) = tr.matrix().row(Dim);
1451  res.matrix().template topRows<Dim>().noalias()
1452  = other * tr.matrix().template topRows<Dim>();
1453  return res;
1454  }
1455 };
1456 
1457 /**********************************************************
1458 *** Specializations of operator* with another Transform ***
1459 **********************************************************/
1460 
1461 template<typename Scalar, int Dim, int LhsMode, int LhsOptions, int RhsMode, int RhsOptions>
1462 struct transform_transform_product_impl<Transform<Scalar,Dim,LhsMode,LhsOptions>,Transform<Scalar,Dim,RhsMode,RhsOptions>,false >
1463 {
1464  enum { ResultMode = transform_product_result<LhsMode,RhsMode>::Mode };
1468  static ResultType run(const Lhs& lhs, const Rhs& rhs)
1469  {
1470  ResultType res;
1471  res.linear() = lhs.linear() * rhs.linear();
1472  res.translation() = lhs.linear() * rhs.translation() + lhs.translation();
1473  res.makeAffine();
1474  return res;
1475  }
1476 };
1477 
1478 template<typename Scalar, int Dim, int LhsMode, int LhsOptions, int RhsMode, int RhsOptions>
1479 struct transform_transform_product_impl<Transform<Scalar,Dim,LhsMode,LhsOptions>,Transform<Scalar,Dim,RhsMode,RhsOptions>,true >
1480 {
1483  typedef Transform<Scalar,Dim,Projective> ResultType;
1484  static ResultType run(const Lhs& lhs, const Rhs& rhs)
1485  {
1486  return ResultType( lhs.matrix() * rhs.matrix() );
1487  }
1488 };
1489 
1490 template<typename Scalar, int Dim, int LhsOptions, int RhsOptions>
1491 struct transform_transform_product_impl<Transform<Scalar,Dim,AffineCompact,LhsOptions>,Transform<Scalar,Dim,Projective,RhsOptions>,true >
1492 {
1495  typedef Transform<Scalar,Dim,Projective> ResultType;
1496  static ResultType run(const Lhs& lhs, const Rhs& rhs)
1497  {
1498  ResultType res;
1499  res.matrix().template topRows<Dim>() = lhs.matrix() * rhs.matrix();
1500  res.matrix().row(Dim) = rhs.matrix().row(Dim);
1501  return res;
1502  }
1503 };
1504 
1505 template<typename Scalar, int Dim, int LhsOptions, int RhsOptions>
1506 struct transform_transform_product_impl<Transform<Scalar,Dim,Projective,LhsOptions>,Transform<Scalar,Dim,AffineCompact,RhsOptions>,true >
1507 {
1510  typedef Transform<Scalar,Dim,Projective> ResultType;
1511  static ResultType run(const Lhs& lhs, const Rhs& rhs)
1512  {
1513  ResultType res(lhs.matrix().template leftCols<Dim>() * rhs.matrix());
1514  res.matrix().col(Dim) += lhs.matrix().col(Dim);
1515  return res;
1516  }
1517 };
1518 
1519 } // end namespace internal
1520 
1521 } // end namespace Eigen
1522 
1523 #endif // EIGEN_TRANSFORM_H
Transform inverse(TransformTraits traits=(TransformTraits) Mode) const
Definition: Transform.h:1183
bool isApprox(const DenseBase< OtherDerived > &other, const RealScalar &prec=NumTraits< Scalar >::dummy_precision()) const
Definition: Fuzzy.h:103
const MatrixType ConstMatrixType
Definition: Transform.h:219
Definition: Constants.h:383
ColXpr col(Index i)
Definition: DenseBase.h:783
internal::traits< Derived >::Scalar Scalar
Definition: DenseBase.h:66
Transform< float, 3, Affine > Affine3f
Definition: Transform.h:691
void setIdentity()
Definition: Transform.h:533
void computeRotationScaling(RotationMatrixType *rotation, ScalingMatrixType *scaling) const
Definition: Transform.h:1060
Transform< double, 2, AffineCompact > AffineCompact2d
Definition: Transform.h:702
Definition: Constants.h:326
Block< MatrixType, Dim, Dim, int(Mode)==(AffineCompact)&&(Options &RowMajor)==0 > LinearPart
Definition: Transform.h:223
const SingularValuesType & singularValues() const
Definition: SVDBase.h:111
Transform(const Transform< OtherScalarType, Dim, Mode, Options > &other)
Definition: Transform.h:618
Eigen::Index Index
Definition: Transform.h:215
_Scalar Scalar
Definition: Transform.h:211
const MatrixType & matrix() const
Definition: Transform.h:395
TranslationPart translation()
Definition: Transform.h:412
Transform(const EigenBase< OtherDerived > &other)
Definition: Transform.h:292
Represents a diagonal matrix with its storage.
Definition: DiagonalMatrix.h:116
Namespace containing all symbols from the Eigen library.
Definition: Core:271
Definition: Constants.h:447
Holds information about the various numeric (i.e. scalar) types allowed by Eigen. ...
Definition: NumTraits.h:167
RowXpr row(Index i)
Definition: DenseBase.h:802
bool isApprox(const Transform &other, const typename NumTraits< Scalar >::Real &prec=NumTraits< Scalar >::dummy_precision()) const
Definition: Transform.h:628
Derived & setIdentity()
Definition: CwiseNullaryOp.h:778
QTransform toQTransform(void) const
Definition: Transform.h:800
Derived & derived()
Definition: EigenBase.h:44
const unsigned int RowMajorBit
Definition: Constants.h:61
Matrix< Scalar, Dim, Dim, Options > LinearMatrixType
Definition: Transform.h:221
QMatrix toQMatrix(void) const
Definition: Transform.h:756
Transform & shear(const Scalar &sx, const Scalar &sy)
Definition: Transform.h:953
Definition: Constants.h:454
Matrix< Scalar, Dim, 1 > VectorType
Definition: Transform.h:235
Definition: EigenBase.h:28
ConstTranslationPart translation() const
Definition: Transform.h:410
AffinePart affine()
Definition: Transform.h:407
Represents a translation transformation.
Definition: ForwardDeclarations.h:271
Transform< double, 2, Projective > Projective2d
Definition: Transform.h:711
Scalar & coeffRef(Index rowId, Index colId)
Definition: PlainObjectBase.h:177
Transform< float, 2, AffineCompact > AffineCompact2f
Definition: Transform.h:698
Derived & setZero(Index size)
Definition: CwiseNullaryOp.h:519
ConstLinearPart linear() const
Definition: Transform.h:400
const Eigen::CwiseUnaryOp< Eigen::internal::scalar_inverse_op< typename Derived::Scalar >, const Derived > inverse(const Eigen::ArrayBase< Derived > &x)
internal::conditional< int(Mode)==int(AffineCompact), MatrixType &, Block< MatrixType, Dim, HDim > >::type AffinePart
Definition: Transform.h:229
Definition: Constants.h:452
Scalar * data()
Definition: Transform.h:605
TransformTraits
Definition: Constants.h:445
const internal::transform_right_product_impl< Transform, OtherDerived >::ResultType operator*(const EigenBase< OtherDerived > &other) const
Definition: Transform.h:441
Transform< double, 3, Affine > Affine3d
Definition: Transform.h:695
const Product< MatrixDerived, PermutationDerived, AliasFreeProduct > operator*(const MatrixBase< MatrixDerived > &matrix, const PermutationBase< PermutationDerived > &permutation)
Definition: PermutationMatrix.h:543
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
The Index type as used for the API.
Definition: XprHelper.h:35
ConstAffinePart affine() const
Definition: Transform.h:405
Expression of the multiple replication of a matrix or vector.
Definition: Replicate.h:61
const Scalar * data() const
Definition: Transform.h:603
Common base class for compact rotation representations.
Definition: ForwardDeclarations.h:266
const MatrixVType & matrixV() const
Definition: SVDBase.h:99
Transform< double, 3, Isometry > Isometry3d
Definition: Transform.h:686
void makeAffine()
Definition: Transform.h:633
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:204
void computeScalingRotation(ScalingMatrixType *scaling, RotationMatrixType *rotation) const
Definition: Transform.h:1089
Transform< float, 2, Projective > Projective2f
Definition: Transform.h:707
Transform & preshear(const Scalar &sx, const Scalar &sy)
Definition: Transform.h:969
Transform & operator=(const EigenBase< OtherDerived > &other)
Definition: Transform.h:303
const Block< ConstMatrixType, Dim, Dim, int(Mode)==(AffineCompact)&&(Options &RowMajor)==0 > ConstLinearPart
Definition: Transform.h:225
Transform< float, 3, Projective > Projective3f
Definition: Transform.h:709
Transform< Scalar, Dim, TransformTimeDiagonalMode > TransformTimeDiagonalReturnType
Definition: Transform.h:246
Definition: Eigen_Colamd.h:50
Transform< float, 3, AffineCompact > AffineCompact3f
Definition: Transform.h:700
Transform< double, 3, AffineCompact > AffineCompact3d
Definition: Transform.h:704
internal::make_proper_matrix_type< Scalar, Rows, HDim, Options >::type MatrixType
Definition: Transform.h:217
Transform< float, 2, Affine > Affine2f
Definition: Transform.h:689
Transform< float, 3, Isometry > Isometry3f
Definition: Transform.h:682
Expression of a fixed-size or dynamic-size block.
Definition: Block.h:103
Translation< Scalar, Dim > TranslationType
Definition: Transform.h:241
Transform< double, 2, Affine > Affine2d
Definition: Transform.h:693
Transform< double, 2, Isometry > Isometry2d
Definition: Transform.h:684
Definition: Constants.h:322
Two-sided Jacobi SVD decomposition of a rectangular matrix.
Definition: ForwardDeclarations.h:258
NoAlias< Derived, Eigen::MatrixBase > noalias()
Definition: NoAlias.h:101
const LinearMatrixType rotation() const
Definition: Transform.h:1039
const int Dynamic
Definition: Constants.h:21
Definition: Constants.h:387
const DiagonalWrapper< const Derived > asDiagonal() const
Definition: DiagonalMatrix.h:277
The matrix class, also used for vectors and row-vectors.
Definition: Matrix.h:178
const Scalar * data() const
Definition: PlainObjectBase.h:249
static const Transform Identity()
Returns an identity transformation.
Definition: Transform.h:539
const Scalar & coeff(Index rowId, Index colId) const
Definition: PlainObjectBase.h:154
Definition: Constants.h:450
internal::cast_return_type< Transform, Transform< NewScalarType, Dim, Mode, Options > >::type cast() const
Definition: Transform.h:613
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:274
RotationMatrixType toRotationMatrix() const
Definition: RotationBase.h:45
Transform< float, 2, Isometry > Isometry2f
Definition: Transform.h:680
Transform< double, 3, Projective > Projective3d
Definition: Transform.h:713
LinearPart linear()
Definition: Transform.h:402
internal::conditional< int(Mode)==int(AffineCompact), const MatrixType &, const Block< const MatrixType, Dim, HDim > >::type ConstAffinePart
Definition: Transform.h:233
MatrixType & matrix()
Definition: Transform.h:397
Transform()
Definition: Transform.h:256