Eigen  3.2.92
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 
199 template<typename _Scalar, int _Dim, int _Mode, int _Options>
200 class Transform
201 {
202 public:
203  EIGEN_MAKE_ALIGNED_OPERATOR_NEW_IF_VECTORIZABLE_FIXED_SIZE(_Scalar,_Dim==Dynamic ? Dynamic : (_Dim+1)*(_Dim+1))
204  enum {
205  Mode = _Mode,
206  Options = _Options,
207  Dim = _Dim,
208  HDim = _Dim+1,
209  Rows = int(Mode)==(AffineCompact) ? Dim : HDim
210  };
212  typedef _Scalar Scalar;
213  typedef Eigen::Index StorageIndex;
214  typedef Eigen::Index Index;
215 
218  typedef const MatrixType ConstMatrixType;
226  typedef typename internal::conditional<int(Mode)==int(AffineCompact),
227  MatrixType&,
230  typedef typename internal::conditional<int(Mode)==int(AffineCompact),
231  const MatrixType&,
241 
242  // this intermediate enum is needed to avoid an ICE with gcc 3.4 and 4.0
243  enum { TransformTimeDiagonalMode = ((Mode==int(Isometry))?Affine:int(Mode)) };
246 
247 protected:
248 
249  MatrixType m_matrix;
250 
251 public:
252 
255  inline Transform()
256  {
257  check_template_params();
258  internal::transform_make_affine<(int(Mode)==Affine) ? Affine : AffineCompact>::run(m_matrix);
259  }
260 
261  inline Transform(const Transform& other)
262  {
263  check_template_params();
264  m_matrix = other.m_matrix;
265  }
266 
267  inline explicit Transform(const TranslationType& t)
268  {
269  check_template_params();
270  *this = t;
271  }
272  inline explicit Transform(const UniformScaling<Scalar>& s)
273  {
274  check_template_params();
275  *this = s;
276  }
277  template<typename Derived>
278  inline explicit Transform(const RotationBase<Derived, Dim>& r)
279  {
280  check_template_params();
281  *this = r;
282  }
283 
284  inline Transform& operator=(const Transform& other)
285  { m_matrix = other.m_matrix; return *this; }
286 
287  typedef internal::transform_take_affine_part<Transform> take_affine_part;
288 
290  template<typename OtherDerived>
291  inline explicit Transform(const EigenBase<OtherDerived>& other)
292  {
293  EIGEN_STATIC_ASSERT((internal::is_same<Scalar,typename OtherDerived::Scalar>::value),
294  YOU_MIXED_DIFFERENT_NUMERIC_TYPES__YOU_NEED_TO_USE_THE_CAST_METHOD_OF_MATRIXBASE_TO_CAST_NUMERIC_TYPES_EXPLICITLY);
295 
296  check_template_params();
297  internal::transform_construct_from_matrix<OtherDerived,Mode,Options,Dim,HDim>::run(this, other.derived());
298  }
299 
301  template<typename OtherDerived>
303  {
304  EIGEN_STATIC_ASSERT((internal::is_same<Scalar,typename OtherDerived::Scalar>::value),
305  YOU_MIXED_DIFFERENT_NUMERIC_TYPES__YOU_NEED_TO_USE_THE_CAST_METHOD_OF_MATRIXBASE_TO_CAST_NUMERIC_TYPES_EXPLICITLY);
306 
307  internal::transform_construct_from_matrix<OtherDerived,Mode,Options,Dim,HDim>::run(this, other.derived());
308  return *this;
309  }
310 
311  template<int OtherOptions>
313  {
314  check_template_params();
315  // only the options change, we can directly copy the matrices
316  m_matrix = other.matrix();
317  }
318 
319  template<int OtherMode,int OtherOptions>
320  inline Transform(const Transform<Scalar,Dim,OtherMode,OtherOptions>& other)
321  {
322  check_template_params();
323  // prevent conversions as:
324  // Affine | AffineCompact | Isometry = Projective
325  EIGEN_STATIC_ASSERT(EIGEN_IMPLIES(OtherMode==int(Projective), Mode==int(Projective)),
326  YOU_PERFORMED_AN_INVALID_TRANSFORMATION_CONVERSION)
327 
328  // prevent conversions as:
329  // Isometry = Affine | AffineCompact
330  EIGEN_STATIC_ASSERT(EIGEN_IMPLIES(OtherMode==int(Affine)||OtherMode==int(AffineCompact), Mode!=int(Isometry)),
331  YOU_PERFORMED_AN_INVALID_TRANSFORMATION_CONVERSION)
332 
333  enum { ModeIsAffineCompact = Mode == int(AffineCompact),
334  OtherModeIsAffineCompact = OtherMode == int(AffineCompact)
335  };
336 
337  if(ModeIsAffineCompact == OtherModeIsAffineCompact)
338  {
339  // We need the block expression because the code is compiled for all
340  // combinations of transformations and will trigger a compile time error
341  // if one tries to assign the matrices directly
342  m_matrix.template block<Dim,Dim+1>(0,0) = other.matrix().template block<Dim,Dim+1>(0,0);
343  makeAffine();
344  }
345  else if(OtherModeIsAffineCompact)
346  {
347  typedef typename Transform<Scalar,Dim,OtherMode,OtherOptions>::MatrixType OtherMatrixType;
348  internal::transform_construct_from_matrix<OtherMatrixType,Mode,Options,Dim,HDim>::run(this, other.matrix());
349  }
350  else
351  {
352  // here we know that Mode == AffineCompact and OtherMode != AffineCompact.
353  // if OtherMode were Projective, the static assert above would already have caught it.
354  // So the only possibility is that OtherMode == Affine
355  linear() = other.linear();
356  translation() = other.translation();
357  }
358  }
359 
360  template<typename OtherDerived>
361  Transform(const ReturnByValue<OtherDerived>& other)
362  {
363  check_template_params();
364  other.evalTo(*this);
365  }
366 
367  template<typename OtherDerived>
368  Transform& operator=(const ReturnByValue<OtherDerived>& other)
369  {
370  other.evalTo(*this);
371  return *this;
372  }
373 
374  #ifdef EIGEN_QT_SUPPORT
375  inline Transform(const QMatrix& other);
376  inline Transform& operator=(const QMatrix& other);
377  inline QMatrix toQMatrix(void) const;
378  inline Transform(const QTransform& other);
379  inline Transform& operator=(const QTransform& other);
380  inline QTransform toQTransform(void) const;
381  #endif
382 
383  Index rows() const { return int(Mode)==int(Projective) ? m_matrix.cols() : (m_matrix.cols()-1); }
384  Index cols() const { return m_matrix.cols(); }
385 
388  inline Scalar operator() (Index row, Index col) const { return m_matrix(row,col); }
391  inline Scalar& operator() (Index row, Index col) { return m_matrix(row,col); }
392 
394  inline const MatrixType& matrix() const { return m_matrix; }
396  inline MatrixType& matrix() { return m_matrix; }
397 
399  inline ConstLinearPart linear() const { return ConstLinearPart(m_matrix,0,0); }
401  inline LinearPart linear() { return LinearPart(m_matrix,0,0); }
402 
404  inline ConstAffinePart affine() const { return take_affine_part::run(m_matrix); }
406  inline AffinePart affine() { return take_affine_part::run(m_matrix); }
407 
409  inline ConstTranslationPart translation() const { return ConstTranslationPart(m_matrix,0,Dim); }
411  inline TranslationPart translation() { return TranslationPart(m_matrix,0,Dim); }
412 
437  // note: this function is defined here because some compilers cannot find the respective declaration
438  template<typename OtherDerived>
439  EIGEN_STRONG_INLINE const typename OtherDerived::PlainObject
440  operator * (const EigenBase<OtherDerived> &other) const
441  { return internal::transform_right_product_impl<Transform, OtherDerived>::run(*this,other.derived()); }
442 
450  template<typename OtherDerived> friend
451  inline const typename internal::transform_left_product_impl<OtherDerived,Mode,Options,_Dim,_Dim+1>::ResultType
452  operator * (const EigenBase<OtherDerived> &a, const Transform &b)
453  { return internal::transform_left_product_impl<OtherDerived,Mode,Options,Dim,HDim>::run(a.derived(),b); }
454 
461  template<typename DiagonalDerived>
462  inline const TransformTimeDiagonalReturnType
463  operator * (const DiagonalBase<DiagonalDerived> &b) const
464  {
465  TransformTimeDiagonalReturnType res(*this);
466  res.linear() *= b;
467  return res;
468  }
469 
476  template<typename DiagonalDerived>
477  friend inline TransformTimeDiagonalReturnType
478  operator * (const DiagonalBase<DiagonalDerived> &a, const Transform &b)
479  {
480  TransformTimeDiagonalReturnType res;
481  res.linear().noalias() = a*b.linear();
482  res.translation().noalias() = a*b.translation();
483  if (Mode!=int(AffineCompact))
484  res.matrix().row(Dim) = b.matrix().row(Dim);
485  return res;
486  }
487 
488  template<typename OtherDerived>
489  inline Transform& operator*=(const EigenBase<OtherDerived>& other) { return *this = *this * other; }
490 
492  inline const Transform operator * (const Transform& other) const
493  {
494  return internal::transform_transform_product_impl<Transform,Transform>::run(*this,other);
495  }
496 
497  #if EIGEN_COMP_ICC
498 private:
499  // this intermediate structure permits to workaround a bug in ICC 11:
500  // error: template instantiation resulted in unexpected function type of "Eigen::Transform<double, 3, 32, 0>
501  // (const Eigen::Transform<double, 3, 2, 0> &) const"
502  // (the meaning of a name may have changed since the template declaration -- the type of the template is:
503  // "Eigen::internal::transform_transform_product_impl<Eigen::Transform<double, 3, 32, 0>,
504  // Eigen::Transform<double, 3, Mode, Options>, <expression>>::ResultType (const Eigen::Transform<double, 3, Mode, Options> &) const")
505  //
506  template<int OtherMode,int OtherOptions> struct icc_11_workaround
507  {
508  typedef internal::transform_transform_product_impl<Transform,Transform<Scalar,Dim,OtherMode,OtherOptions> > ProductType;
509  typedef typename ProductType::ResultType ResultType;
510  };
511 
512 public:
514  template<int OtherMode,int OtherOptions>
515  inline typename icc_11_workaround<OtherMode,OtherOptions>::ResultType
516  operator * (const Transform<Scalar,Dim,OtherMode,OtherOptions>& other) const
517  {
518  typedef typename icc_11_workaround<OtherMode,OtherOptions>::ProductType ProductType;
519  return ProductType::run(*this,other);
520  }
521  #else
522 
523  template<int OtherMode,int OtherOptions>
524  inline typename internal::transform_transform_product_impl<Transform,Transform<Scalar,Dim,OtherMode,OtherOptions> >::ResultType
525  operator * (const Transform<Scalar,Dim,OtherMode,OtherOptions>& other) const
526  {
527  return internal::transform_transform_product_impl<Transform,Transform<Scalar,Dim,OtherMode,OtherOptions> >::run(*this,other);
528  }
529  #endif
530 
532  void setIdentity() { m_matrix.setIdentity(); }
533 
538  static const Transform Identity()
539  {
540  return Transform(MatrixType::Identity());
541  }
542 
543  template<typename OtherDerived>
544  inline Transform& scale(const MatrixBase<OtherDerived> &other);
545 
546  template<typename OtherDerived>
547  inline Transform& prescale(const MatrixBase<OtherDerived> &other);
548 
549  inline Transform& scale(const Scalar& s);
550  inline Transform& prescale(const Scalar& s);
551 
552  template<typename OtherDerived>
553  inline Transform& translate(const MatrixBase<OtherDerived> &other);
554 
555  template<typename OtherDerived>
556  inline Transform& pretranslate(const MatrixBase<OtherDerived> &other);
557 
558  template<typename RotationType>
559  inline Transform& rotate(const RotationType& rotation);
560 
561  template<typename RotationType>
562  inline Transform& prerotate(const RotationType& rotation);
563 
564  Transform& shear(const Scalar& sx, const Scalar& sy);
565  Transform& preshear(const Scalar& sx, const Scalar& sy);
566 
567  inline Transform& operator=(const TranslationType& t);
568  inline Transform& operator*=(const TranslationType& t) { return translate(t.vector()); }
569  inline Transform operator*(const TranslationType& t) const;
570 
571  inline Transform& operator=(const UniformScaling<Scalar>& t);
572  inline Transform& operator*=(const UniformScaling<Scalar>& s) { return scale(s.factor()); }
573  inline TransformTimeDiagonalReturnType operator*(const UniformScaling<Scalar>& s) const
574  {
575  TransformTimeDiagonalReturnType res = *this;
576  res.scale(s.factor());
577  return res;
578  }
579 
580  inline Transform& operator*=(const DiagonalMatrix<Scalar,Dim>& s) { linear() *= s; return *this; }
581 
582  template<typename Derived>
583  inline Transform& operator=(const RotationBase<Derived,Dim>& r);
584  template<typename Derived>
585  inline Transform& operator*=(const RotationBase<Derived,Dim>& r) { return rotate(r.toRotationMatrix()); }
586  template<typename Derived>
587  inline Transform operator*(const RotationBase<Derived,Dim>& r) const;
588 
589  const LinearMatrixType rotation() const;
590  template<typename RotationMatrixType, typename ScalingMatrixType>
591  void computeRotationScaling(RotationMatrixType *rotation, ScalingMatrixType *scaling) const;
592  template<typename ScalingMatrixType, typename RotationMatrixType>
593  void computeScalingRotation(ScalingMatrixType *scaling, RotationMatrixType *rotation) const;
594 
595  template<typename PositionDerived, typename OrientationType, typename ScaleDerived>
596  Transform& fromPositionOrientationScale(const MatrixBase<PositionDerived> &position,
597  const OrientationType& orientation, const MatrixBase<ScaleDerived> &scale);
598 
599  inline Transform inverse(TransformTraits traits = (TransformTraits)Mode) const;
600 
602  const Scalar* data() const { return m_matrix.data(); }
604  Scalar* data() { return m_matrix.data(); }
605 
611  template<typename NewScalarType>
612  inline typename internal::cast_return_type<Transform,Transform<NewScalarType,Dim,Mode,Options> >::type cast() const
613  { return typename internal::cast_return_type<Transform,Transform<NewScalarType,Dim,Mode,Options> >::type(*this); }
614 
616  template<typename OtherScalarType>
618  {
619  check_template_params();
620  m_matrix = other.matrix().template cast<Scalar>();
621  }
622 
627  bool isApprox(const Transform& other, const typename NumTraits<Scalar>::Real& prec = NumTraits<Scalar>::dummy_precision()) const
628  { return m_matrix.isApprox(other.m_matrix, prec); }
629 
632  void makeAffine()
633  {
634  internal::transform_make_affine<int(Mode)>::run(m_matrix);
635  }
636 
642  { return m_matrix.template block<int(Mode)==int(Projective)?HDim:Dim,Dim>(0,0); }
647  inline const Block<MatrixType,int(Mode)==int(Projective)?HDim:Dim,Dim> linearExt() const
648  { return m_matrix.template block<int(Mode)==int(Projective)?HDim:Dim,Dim>(0,0); }
649 
654  inline Block<MatrixType,int(Mode)==int(Projective)?HDim:Dim,1> translationExt()
655  { return m_matrix.template block<int(Mode)==int(Projective)?HDim:Dim,1>(0,Dim); }
660  inline const Block<MatrixType,int(Mode)==int(Projective)?HDim:Dim,1> translationExt() const
661  { return m_matrix.template block<int(Mode)==int(Projective)?HDim:Dim,1>(0,Dim); }
662 
663 
664  #ifdef EIGEN_TRANSFORM_PLUGIN
665  #include EIGEN_TRANSFORM_PLUGIN
666  #endif
667 
668 protected:
669  #ifndef EIGEN_PARSED_BY_DOXYGEN
670  static EIGEN_STRONG_INLINE void check_template_params()
671  {
672  EIGEN_STATIC_ASSERT((Options & (DontAlign|RowMajor)) == Options, INVALID_MATRIX_TEMPLATE_PARAMETERS)
673  }
674  #endif
675 
676 };
677 
686 
695 
704 
713 
714 /**************************
715 *** Optional QT support ***
716 **************************/
717 
718 #ifdef EIGEN_QT_SUPPORT
719 
723 template<typename Scalar, int Dim, int Mode,int Options>
725 {
726  check_template_params();
727  *this = other;
728 }
729 
734 template<typename Scalar, int Dim, int Mode,int Options>
736 {
737  EIGEN_STATIC_ASSERT(Dim==2, YOU_MADE_A_PROGRAMMING_MISTAKE)
738  if (Mode == int(AffineCompact))
739  m_matrix << other.m11(), other.m21(), other.dx(),
740  other.m12(), other.m22(), other.dy();
741  else
742  m_matrix << other.m11(), other.m21(), other.dx(),
743  other.m12(), other.m22(), other.dy(),
744  0, 0, 1;
745  return *this;
746 }
747 
754 template<typename Scalar, int Dim, int Mode, int Options>
756 {
757  check_template_params();
758  EIGEN_STATIC_ASSERT(Dim==2, YOU_MADE_A_PROGRAMMING_MISTAKE)
759  return QMatrix(m_matrix.coeff(0,0), m_matrix.coeff(1,0),
760  m_matrix.coeff(0,1), m_matrix.coeff(1,1),
761  m_matrix.coeff(0,2), m_matrix.coeff(1,2));
762 }
763 
768 template<typename Scalar, int Dim, int Mode,int Options>
770 {
771  check_template_params();
772  *this = other;
773 }
774 
779 template<typename Scalar, int Dim, int Mode, int Options>
781 {
782  check_template_params();
783  EIGEN_STATIC_ASSERT(Dim==2, YOU_MADE_A_PROGRAMMING_MISTAKE)
784  if (Mode == int(AffineCompact))
785  m_matrix << other.m11(), other.m21(), other.dx(),
786  other.m12(), other.m22(), other.dy();
787  else
788  m_matrix << other.m11(), other.m21(), other.dx(),
789  other.m12(), other.m22(), other.dy(),
790  other.m13(), other.m23(), other.m33();
791  return *this;
792 }
793 
798 template<typename Scalar, int Dim, int Mode, int Options>
800 {
801  EIGEN_STATIC_ASSERT(Dim==2, YOU_MADE_A_PROGRAMMING_MISTAKE)
802  if (Mode == int(AffineCompact))
803  return QTransform(m_matrix.coeff(0,0), m_matrix.coeff(1,0),
804  m_matrix.coeff(0,1), m_matrix.coeff(1,1),
805  m_matrix.coeff(0,2), m_matrix.coeff(1,2));
806  else
807  return QTransform(m_matrix.coeff(0,0), m_matrix.coeff(1,0), m_matrix.coeff(2,0),
808  m_matrix.coeff(0,1), m_matrix.coeff(1,1), m_matrix.coeff(2,1),
809  m_matrix.coeff(0,2), m_matrix.coeff(1,2), m_matrix.coeff(2,2));
810 }
811 #endif
812 
813 /*********************
814 *** Procedural API ***
815 *********************/
816 
821 template<typename Scalar, int Dim, int Mode, int Options>
822 template<typename OtherDerived>
825 {
826  EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(OtherDerived,int(Dim))
827  EIGEN_STATIC_ASSERT(Mode!=int(Isometry), THIS_METHOD_IS_ONLY_FOR_SPECIFIC_TRANSFORMATIONS)
828  linearExt().noalias() = (linearExt() * other.asDiagonal());
829  return *this;
830 }
831 
836 template<typename Scalar, int Dim, int Mode, int Options>
838 {
839  EIGEN_STATIC_ASSERT(Mode!=int(Isometry), THIS_METHOD_IS_ONLY_FOR_SPECIFIC_TRANSFORMATIONS)
840  linearExt() *= s;
841  return *this;
842 }
843 
848 template<typename Scalar, int Dim, int Mode, int Options>
849 template<typename OtherDerived>
852 {
853  EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(OtherDerived,int(Dim))
854  EIGEN_STATIC_ASSERT(Mode!=int(Isometry), THIS_METHOD_IS_ONLY_FOR_SPECIFIC_TRANSFORMATIONS)
855  m_matrix.template block<Dim,HDim>(0,0).noalias() = (other.asDiagonal() * m_matrix.template block<Dim,HDim>(0,0));
856  return *this;
857 }
858 
863 template<typename Scalar, int Dim, int Mode, int Options>
865 {
866  EIGEN_STATIC_ASSERT(Mode!=int(Isometry), THIS_METHOD_IS_ONLY_FOR_SPECIFIC_TRANSFORMATIONS)
867  m_matrix.template topRows<Dim>() *= s;
868  return *this;
869 }
870 
875 template<typename Scalar, int Dim, int Mode, int Options>
876 template<typename OtherDerived>
879 {
880  EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(OtherDerived,int(Dim))
881  translationExt() += linearExt() * other;
882  return *this;
883 }
884 
889 template<typename Scalar, int Dim, int Mode, int Options>
890 template<typename OtherDerived>
893 {
894  EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(OtherDerived,int(Dim))
895  if(int(Mode)==int(Projective))
896  affine() += other * m_matrix.row(Dim);
897  else
898  translation() += other;
899  return *this;
900 }
901 
919 template<typename Scalar, int Dim, int Mode, int Options>
920 template<typename RotationType>
922 Transform<Scalar,Dim,Mode,Options>::rotate(const RotationType& rotation)
923 {
924  linearExt() *= internal::toRotationMatrix<Scalar,Dim>(rotation);
925  return *this;
926 }
927 
935 template<typename Scalar, int Dim, int Mode, int Options>
936 template<typename RotationType>
939 {
940  m_matrix.template block<Dim,HDim>(0,0) = internal::toRotationMatrix<Scalar,Dim>(rotation)
941  * m_matrix.template block<Dim,HDim>(0,0);
942  return *this;
943 }
944 
950 template<typename Scalar, int Dim, int Mode, int Options>
952 Transform<Scalar,Dim,Mode,Options>::shear(const Scalar& sx, const Scalar& sy)
953 {
954  EIGEN_STATIC_ASSERT(int(Dim)==2, YOU_MADE_A_PROGRAMMING_MISTAKE)
955  EIGEN_STATIC_ASSERT(Mode!=int(Isometry), THIS_METHOD_IS_ONLY_FOR_SPECIFIC_TRANSFORMATIONS)
956  VectorType tmp = linear().col(0)*sy + linear().col(1);
957  linear() << linear().col(0) + linear().col(1)*sx, tmp;
958  return *this;
959 }
960 
966 template<typename Scalar, int Dim, int Mode, int Options>
968 Transform<Scalar,Dim,Mode,Options>::preshear(const Scalar& sx, const Scalar& sy)
969 {
970  EIGEN_STATIC_ASSERT(int(Dim)==2, YOU_MADE_A_PROGRAMMING_MISTAKE)
971  EIGEN_STATIC_ASSERT(Mode!=int(Isometry), THIS_METHOD_IS_ONLY_FOR_SPECIFIC_TRANSFORMATIONS)
972  m_matrix.template block<Dim,HDim>(0,0) = LinearMatrixType(1, sx, sy, 1) * m_matrix.template block<Dim,HDim>(0,0);
973  return *this;
974 }
975 
976 /******************************************************
977 *** Scaling, Translation and Rotation compatibility ***
978 ******************************************************/
979 
980 template<typename Scalar, int Dim, int Mode, int Options>
982 {
983  linear().setIdentity();
984  translation() = t.vector();
985  makeAffine();
986  return *this;
987 }
988 
989 template<typename Scalar, int Dim, int Mode, int Options>
990 inline Transform<Scalar,Dim,Mode,Options> Transform<Scalar,Dim,Mode,Options>::operator*(const TranslationType& t) const
991 {
992  Transform res = *this;
993  res.translate(t.vector());
994  return res;
995 }
996 
997 template<typename Scalar, int Dim, int Mode, int Options>
998 inline Transform<Scalar,Dim,Mode,Options>& Transform<Scalar,Dim,Mode,Options>::operator=(const UniformScaling<Scalar>& s)
999 {
1000  m_matrix.setZero();
1001  linear().diagonal().fill(s.factor());
1002  makeAffine();
1003  return *this;
1004 }
1005 
1006 template<typename Scalar, int Dim, int Mode, int Options>
1007 template<typename Derived>
1008 inline Transform<Scalar,Dim,Mode,Options>& Transform<Scalar,Dim,Mode,Options>::operator=(const RotationBase<Derived,Dim>& r)
1009 {
1010  linear() = internal::toRotationMatrix<Scalar,Dim>(r);
1011  translation().setZero();
1012  makeAffine();
1013  return *this;
1014 }
1015 
1016 template<typename Scalar, int Dim, int Mode, int Options>
1017 template<typename Derived>
1018 inline Transform<Scalar,Dim,Mode,Options> Transform<Scalar,Dim,Mode,Options>::operator*(const RotationBase<Derived,Dim>& r) const
1019 {
1020  Transform res = *this;
1021  res.rotate(r.derived());
1022  return res;
1023 }
1024 
1025 /************************
1026 *** Special functions ***
1027 ************************/
1028 
1036 template<typename Scalar, int Dim, int Mode, int Options>
1037 const typename Transform<Scalar,Dim,Mode,Options>::LinearMatrixType
1039 {
1040  LinearMatrixType result;
1041  computeRotationScaling(&result, (LinearMatrixType*)0);
1042  return result;
1043 }
1044 
1045 
1057 template<typename Scalar, int Dim, int Mode, int Options>
1058 template<typename RotationMatrixType, typename ScalingMatrixType>
1059 void Transform<Scalar,Dim,Mode,Options>::computeRotationScaling(RotationMatrixType *rotation, ScalingMatrixType *scaling) const
1060 {
1062 
1063  Scalar x = (svd.matrixU() * svd.matrixV().adjoint()).determinant(); // so x has absolute value 1
1064  VectorType sv(svd.singularValues());
1065  sv.coeffRef(0) *= x;
1066  if(scaling) scaling->lazyAssign(svd.matrixV() * sv.asDiagonal() * svd.matrixV().adjoint());
1067  if(rotation)
1068  {
1069  LinearMatrixType m(svd.matrixU());
1070  m.col(0) /= x;
1071  rotation->lazyAssign(m * svd.matrixV().adjoint());
1072  }
1073 }
1074 
1086 template<typename Scalar, int Dim, int Mode, int Options>
1087 template<typename ScalingMatrixType, typename RotationMatrixType>
1088 void Transform<Scalar,Dim,Mode,Options>::computeScalingRotation(ScalingMatrixType *scaling, RotationMatrixType *rotation) const
1089 {
1091 
1092  Scalar x = (svd.matrixU() * svd.matrixV().adjoint()).determinant(); // so x has absolute value 1
1093  VectorType sv(svd.singularValues());
1094  sv.coeffRef(0) *= x;
1095  if(scaling) scaling->lazyAssign(svd.matrixU() * sv.asDiagonal() * svd.matrixU().adjoint());
1096  if(rotation)
1097  {
1098  LinearMatrixType m(svd.matrixU());
1099  m.col(0) /= x;
1100  rotation->lazyAssign(m * svd.matrixV().adjoint());
1101  }
1102 }
1103 
1107 template<typename Scalar, int Dim, int Mode, int Options>
1108 template<typename PositionDerived, typename OrientationType, typename ScaleDerived>
1111  const OrientationType& orientation, const MatrixBase<ScaleDerived> &scale)
1112 {
1113  linear() = internal::toRotationMatrix<Scalar,Dim>(orientation);
1114  linear() *= scale.asDiagonal();
1115  translation() = position;
1116  makeAffine();
1117  return *this;
1118 }
1119 
1120 namespace internal {
1121 
1122 template<int Mode>
1123 struct transform_make_affine
1124 {
1125  template<typename MatrixType>
1126  static void run(MatrixType &mat)
1127  {
1128  static const int Dim = MatrixType::ColsAtCompileTime-1;
1129  mat.template block<1,Dim>(Dim,0).setZero();
1130  mat.coeffRef(Dim,Dim) = typename MatrixType::Scalar(1);
1131  }
1132 };
1133 
1134 template<>
1135 struct transform_make_affine<AffineCompact>
1136 {
1137  template<typename MatrixType> static void run(MatrixType &) { }
1138 };
1139 
1140 // selector needed to avoid taking the inverse of a 3x4 matrix
1141 template<typename TransformType, int Mode=TransformType::Mode>
1142 struct projective_transform_inverse
1143 {
1144  static inline void run(const TransformType&, TransformType&)
1145  {}
1146 };
1147 
1148 template<typename TransformType>
1149 struct projective_transform_inverse<TransformType, Projective>
1150 {
1151  static inline void run(const TransformType& m, TransformType& res)
1152  {
1153  res.matrix() = m.matrix().inverse();
1154  }
1155 };
1156 
1157 } // end namespace internal
1158 
1159 
1180 template<typename Scalar, int Dim, int Mode, int Options>
1181 Transform<Scalar,Dim,Mode,Options>
1183 {
1184  Transform res;
1185  if (hint == Projective)
1186  {
1187  internal::projective_transform_inverse<Transform>::run(*this, res);
1188  }
1189  else
1190  {
1191  if (hint == Isometry)
1192  {
1193  res.matrix().template topLeftCorner<Dim,Dim>() = linear().transpose();
1194  }
1195  else if(hint&Affine)
1196  {
1197  res.matrix().template topLeftCorner<Dim,Dim>() = linear().inverse();
1198  }
1199  else
1200  {
1201  eigen_assert(false && "Invalid transform traits in Transform::Inverse");
1202  }
1203  // translation and remaining parts
1204  res.matrix().template topRightCorner<Dim,1>()
1205  = - res.matrix().template topLeftCorner<Dim,Dim>() * translation();
1206  res.makeAffine(); // we do need this, because in the beginning res is uninitialized
1207  }
1208  return res;
1209 }
1210 
1211 namespace internal {
1212 
1213 /*****************************************************
1214 *** Specializations of take affine part ***
1215 *****************************************************/
1216 
1217 template<typename TransformType> struct transform_take_affine_part {
1218  typedef typename TransformType::MatrixType MatrixType;
1219  typedef typename TransformType::AffinePart AffinePart;
1220  typedef typename TransformType::ConstAffinePart ConstAffinePart;
1221  static inline AffinePart run(MatrixType& m)
1222  { return m.template block<TransformType::Dim,TransformType::HDim>(0,0); }
1223  static inline ConstAffinePart run(const MatrixType& m)
1224  { return m.template block<TransformType::Dim,TransformType::HDim>(0,0); }
1225 };
1226 
1227 template<typename Scalar, int Dim, int Options>
1228 struct transform_take_affine_part<Transform<Scalar,Dim,AffineCompact, Options> > {
1229  typedef typename Transform<Scalar,Dim,AffineCompact,Options>::MatrixType MatrixType;
1230  static inline MatrixType& run(MatrixType& m) { return m; }
1231  static inline const MatrixType& run(const MatrixType& m) { return m; }
1232 };
1233 
1234 /*****************************************************
1235 *** Specializations of construct from matrix ***
1236 *****************************************************/
1237 
1238 template<typename Other, int Mode, int Options, int Dim, int HDim>
1239 struct transform_construct_from_matrix<Other, Mode,Options,Dim,HDim, Dim,Dim>
1240 {
1241  static inline void run(Transform<typename Other::Scalar,Dim,Mode,Options> *transform, const Other& other)
1242  {
1243  transform->linear() = other;
1244  transform->translation().setZero();
1245  transform->makeAffine();
1246  }
1247 };
1248 
1249 template<typename Other, int Mode, int Options, int Dim, int HDim>
1250 struct transform_construct_from_matrix<Other, Mode,Options,Dim,HDim, Dim,HDim>
1251 {
1252  static inline void run(Transform<typename Other::Scalar,Dim,Mode,Options> *transform, const Other& other)
1253  {
1254  transform->affine() = other;
1255  transform->makeAffine();
1256  }
1257 };
1258 
1259 template<typename Other, int Mode, int Options, int Dim, int HDim>
1260 struct transform_construct_from_matrix<Other, Mode,Options,Dim,HDim, HDim,HDim>
1261 {
1262  static inline void run(Transform<typename Other::Scalar,Dim,Mode,Options> *transform, const Other& other)
1263  { transform->matrix() = other; }
1264 };
1265 
1266 template<typename Other, int Options, int Dim, int HDim>
1267 struct transform_construct_from_matrix<Other, AffineCompact,Options,Dim,HDim, HDim,HDim>
1268 {
1269  static inline void run(Transform<typename Other::Scalar,Dim,AffineCompact,Options> *transform, const Other& other)
1270  { transform->matrix() = other.template block<Dim,HDim>(0,0); }
1271 };
1272 
1273 /**********************************************************
1274 *** Specializations of operator* with rhs EigenBase ***
1275 **********************************************************/
1276 
1277 template<int LhsMode,int RhsMode>
1278 struct transform_product_result
1279 {
1280  enum
1281  {
1282  Mode =
1283  (LhsMode == (int)Projective || RhsMode == (int)Projective ) ? Projective :
1284  (LhsMode == (int)Affine || RhsMode == (int)Affine ) ? Affine :
1285  (LhsMode == (int)AffineCompact || RhsMode == (int)AffineCompact ) ? AffineCompact :
1286  (LhsMode == (int)Isometry || RhsMode == (int)Isometry ) ? Isometry : Projective
1287  };
1288 };
1289 
1290 template< typename TransformType, typename MatrixType >
1291 struct transform_right_product_impl< TransformType, MatrixType, 0 >
1292 {
1293  typedef typename MatrixType::PlainObject ResultType;
1294 
1295  static EIGEN_STRONG_INLINE ResultType run(const TransformType& T, const MatrixType& other)
1296  {
1297  return T.matrix() * other;
1298  }
1299 };
1300 
1301 template< typename TransformType, typename MatrixType >
1302 struct transform_right_product_impl< TransformType, MatrixType, 1 >
1303 {
1304  enum {
1305  Dim = TransformType::Dim,
1306  HDim = TransformType::HDim,
1307  OtherRows = MatrixType::RowsAtCompileTime,
1308  OtherCols = MatrixType::ColsAtCompileTime
1309  };
1310 
1311  typedef typename MatrixType::PlainObject ResultType;
1312 
1313  static EIGEN_STRONG_INLINE ResultType run(const TransformType& T, const MatrixType& other)
1314  {
1315  EIGEN_STATIC_ASSERT(OtherRows==HDim, YOU_MIXED_MATRICES_OF_DIFFERENT_SIZES);
1316 
1317  typedef Block<ResultType, Dim, OtherCols, int(MatrixType::RowsAtCompileTime)==Dim> TopLeftLhs;
1318 
1319  ResultType res(other.rows(),other.cols());
1320  TopLeftLhs(res, 0, 0, Dim, other.cols()).noalias() = T.affine() * other;
1321  res.row(OtherRows-1) = other.row(OtherRows-1);
1322 
1323  return res;
1324  }
1325 };
1326 
1327 template< typename TransformType, typename MatrixType >
1328 struct transform_right_product_impl< TransformType, MatrixType, 2 >
1329 {
1330  enum {
1331  Dim = TransformType::Dim,
1332  HDim = TransformType::HDim,
1333  OtherRows = MatrixType::RowsAtCompileTime,
1334  OtherCols = MatrixType::ColsAtCompileTime
1335  };
1336 
1337  typedef typename MatrixType::PlainObject ResultType;
1338 
1339  static EIGEN_STRONG_INLINE ResultType run(const TransformType& T, const MatrixType& other)
1340  {
1341  EIGEN_STATIC_ASSERT(OtherRows==Dim, YOU_MIXED_MATRICES_OF_DIFFERENT_SIZES);
1342 
1343  typedef Block<ResultType, Dim, OtherCols, true> TopLeftLhs;
1344  ResultType res(Replicate<typename TransformType::ConstTranslationPart, 1, OtherCols>(T.translation(),1,other.cols()));
1345  TopLeftLhs(res, 0, 0, Dim, other.cols()).noalias() += T.linear() * other;
1346 
1347  return res;
1348  }
1349 };
1350 
1351 /**********************************************************
1352 *** Specializations of operator* with lhs EigenBase ***
1353 **********************************************************/
1354 
1355 // generic HDim x HDim matrix * T => Projective
1356 template<typename Other,int Mode, int Options, int Dim, int HDim>
1357 struct transform_left_product_impl<Other,Mode,Options,Dim,HDim, HDim,HDim>
1358 {
1359  typedef Transform<typename Other::Scalar,Dim,Mode,Options> TransformType;
1360  typedef typename TransformType::MatrixType MatrixType;
1361  typedef Transform<typename Other::Scalar,Dim,Projective,Options> ResultType;
1362  static ResultType run(const Other& other,const TransformType& tr)
1363  { return ResultType(other * tr.matrix()); }
1364 };
1365 
1366 // generic HDim x HDim matrix * AffineCompact => Projective
1367 template<typename Other, int Options, int Dim, int HDim>
1368 struct transform_left_product_impl<Other,AffineCompact,Options,Dim,HDim, HDim,HDim>
1369 {
1370  typedef Transform<typename Other::Scalar,Dim,AffineCompact,Options> TransformType;
1371  typedef typename TransformType::MatrixType MatrixType;
1372  typedef Transform<typename Other::Scalar,Dim,Projective,Options> ResultType;
1373  static ResultType run(const Other& other,const TransformType& tr)
1374  {
1375  ResultType res;
1376  res.matrix().noalias() = other.template block<HDim,Dim>(0,0) * tr.matrix();
1377  res.matrix().col(Dim) += other.col(Dim);
1378  return res;
1379  }
1380 };
1381 
1382 // affine matrix * T
1383 template<typename Other,int Mode, int Options, int Dim, int HDim>
1384 struct transform_left_product_impl<Other,Mode,Options,Dim,HDim, Dim,HDim>
1385 {
1386  typedef Transform<typename Other::Scalar,Dim,Mode,Options> TransformType;
1387  typedef typename TransformType::MatrixType MatrixType;
1388  typedef TransformType ResultType;
1389  static ResultType run(const Other& other,const TransformType& tr)
1390  {
1391  ResultType res;
1392  res.affine().noalias() = other * tr.matrix();
1393  res.matrix().row(Dim) = tr.matrix().row(Dim);
1394  return res;
1395  }
1396 };
1397 
1398 // affine matrix * AffineCompact
1399 template<typename Other, int Options, int Dim, int HDim>
1400 struct transform_left_product_impl<Other,AffineCompact,Options,Dim,HDim, Dim,HDim>
1401 {
1402  typedef Transform<typename Other::Scalar,Dim,AffineCompact,Options> TransformType;
1403  typedef typename TransformType::MatrixType MatrixType;
1404  typedef TransformType ResultType;
1405  static ResultType run(const Other& other,const TransformType& tr)
1406  {
1407  ResultType res;
1408  res.matrix().noalias() = other.template block<Dim,Dim>(0,0) * tr.matrix();
1409  res.translation() += other.col(Dim);
1410  return res;
1411  }
1412 };
1413 
1414 // linear matrix * T
1415 template<typename Other,int Mode, int Options, int Dim, int HDim>
1416 struct transform_left_product_impl<Other,Mode,Options,Dim,HDim, Dim,Dim>
1417 {
1418  typedef Transform<typename Other::Scalar,Dim,Mode,Options> TransformType;
1419  typedef typename TransformType::MatrixType MatrixType;
1420  typedef TransformType ResultType;
1421  static ResultType run(const Other& other, const TransformType& tr)
1422  {
1423  TransformType res;
1424  if(Mode!=int(AffineCompact))
1425  res.matrix().row(Dim) = tr.matrix().row(Dim);
1426  res.matrix().template topRows<Dim>().noalias()
1427  = other * tr.matrix().template topRows<Dim>();
1428  return res;
1429  }
1430 };
1431 
1432 /**********************************************************
1433 *** Specializations of operator* with another Transform ***
1434 **********************************************************/
1435 
1436 template<typename Scalar, int Dim, int LhsMode, int LhsOptions, int RhsMode, int RhsOptions>
1437 struct transform_transform_product_impl<Transform<Scalar,Dim,LhsMode,LhsOptions>,Transform<Scalar,Dim,RhsMode,RhsOptions>,false >
1438 {
1439  enum { ResultMode = transform_product_result<LhsMode,RhsMode>::Mode };
1440  typedef Transform<Scalar,Dim,LhsMode,LhsOptions> Lhs;
1441  typedef Transform<Scalar,Dim,RhsMode,RhsOptions> Rhs;
1442  typedef Transform<Scalar,Dim,ResultMode,LhsOptions> ResultType;
1443  static ResultType run(const Lhs& lhs, const Rhs& rhs)
1444  {
1445  ResultType res;
1446  res.linear() = lhs.linear() * rhs.linear();
1447  res.translation() = lhs.linear() * rhs.translation() + lhs.translation();
1448  res.makeAffine();
1449  return res;
1450  }
1451 };
1452 
1453 template<typename Scalar, int Dim, int LhsMode, int LhsOptions, int RhsMode, int RhsOptions>
1454 struct transform_transform_product_impl<Transform<Scalar,Dim,LhsMode,LhsOptions>,Transform<Scalar,Dim,RhsMode,RhsOptions>,true >
1455 {
1456  typedef Transform<Scalar,Dim,LhsMode,LhsOptions> Lhs;
1457  typedef Transform<Scalar,Dim,RhsMode,RhsOptions> Rhs;
1458  typedef Transform<Scalar,Dim,Projective> ResultType;
1459  static ResultType run(const Lhs& lhs, const Rhs& rhs)
1460  {
1461  return ResultType( lhs.matrix() * rhs.matrix() );
1462  }
1463 };
1464 
1465 template<typename Scalar, int Dim, int LhsOptions, int RhsOptions>
1466 struct transform_transform_product_impl<Transform<Scalar,Dim,AffineCompact,LhsOptions>,Transform<Scalar,Dim,Projective,RhsOptions>,true >
1467 {
1468  typedef Transform<Scalar,Dim,AffineCompact,LhsOptions> Lhs;
1469  typedef Transform<Scalar,Dim,Projective,RhsOptions> Rhs;
1470  typedef Transform<Scalar,Dim,Projective> ResultType;
1471  static ResultType run(const Lhs& lhs, const Rhs& rhs)
1472  {
1473  ResultType res;
1474  res.matrix().template topRows<Dim>() = lhs.matrix() * rhs.matrix();
1475  res.matrix().row(Dim) = rhs.matrix().row(Dim);
1476  return res;
1477  }
1478 };
1479 
1480 template<typename Scalar, int Dim, int LhsOptions, int RhsOptions>
1481 struct transform_transform_product_impl<Transform<Scalar,Dim,Projective,LhsOptions>,Transform<Scalar,Dim,AffineCompact,RhsOptions>,true >
1482 {
1483  typedef Transform<Scalar,Dim,Projective,LhsOptions> Lhs;
1484  typedef Transform<Scalar,Dim,AffineCompact,RhsOptions> Rhs;
1485  typedef Transform<Scalar,Dim,Projective> ResultType;
1486  static ResultType run(const Lhs& lhs, const Rhs& rhs)
1487  {
1488  ResultType res(lhs.matrix().template leftCols<Dim>() * rhs.matrix());
1489  res.matrix().col(Dim) += lhs.matrix().col(Dim);
1490  return res;
1491  }
1492 };
1493 
1494 } // end namespace internal
1495 
1496 } // end namespace Eigen
1497 
1498 #endif // EIGEN_TRANSFORM_H
Transform inverse(TransformTraits traits=(TransformTraits) Mode) const
Definition: Transform.h:1182
bool isApprox(const DenseBase< OtherDerived > &other, const RealScalar &prec=NumTraits< Scalar >::dummy_precision()) const
Definition: Fuzzy.h:103
const MatrixType ConstMatrixType
Definition: Transform.h:218
Definition: Constants.h:383
Transform< float, 3, Affine > Affine3f
Definition: Transform.h:690
void setIdentity()
Definition: Transform.h:532
void computeRotationScaling(RotationMatrixType *rotation, ScalingMatrixType *scaling) const
Definition: Transform.h:1059
Transform< double, 2, AffineCompact > AffineCompact2d
Definition: Transform.h:701
Block< MatrixType, Dim, Dim, int(Mode)==(AffineCompact)&&(Options &RowMajor)==0 > LinearPart
Definition: Transform.h:222
const SingularValuesType & singularValues() const
Definition: SVDBase.h:111
Transform(const Transform< OtherScalarType, Dim, Mode, Options > &other)
Definition: Transform.h:617
Eigen::Index Index
Definition: Transform.h:214
_Scalar Scalar
Definition: Transform.h:210
const MatrixType & matrix() const
Definition: Transform.h:394
TranslationPart translation()
Definition: Transform.h:411
Transform(const EigenBase< OtherDerived > &other)
Definition: Transform.h:291
Definition: LDLT.h:16
Definition: Constants.h:447
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:627
Derived & setIdentity()
Definition: CwiseNullaryOp.h:779
QTransform toQTransform(void) const
Definition: Transform.h:799
Derived & derived()
Definition: EigenBase.h:44
const unsigned int RowMajorBit
Definition: Constants.h:61
Matrix< Scalar, Dim, Dim, Options > LinearMatrixType
Definition: Transform.h:220
QMatrix toQMatrix(void) const
Definition: Transform.h:755
Transform & shear(const Scalar &sx, const Scalar &sy)
Definition: Transform.h:952
Definition: Constants.h:454
Matrix< Scalar, Dim, 1 > VectorType
Definition: Transform.h:234
const OtherDerived::PlainObject operator*(const EigenBase< OtherDerived > &other) const
Definition: Transform.h:440
Definition: EigenBase.h:28
ConstTranslationPart translation() const
Definition: Transform.h:409
AffinePart affine()
Definition: Transform.h:406
Represents a translation transformation.
Definition: ForwardDeclarations.h:268
Transform< double, 2, Projective > Projective2d
Definition: Transform.h:710
Definition: Constants.h:326
Transform< float, 2, AffineCompact > AffineCompact2f
Definition: Transform.h:697
Derived & setZero(Index size)
Definition: CwiseNullaryOp.h:520
ConstLinearPart linear() const
Definition: Transform.h:399
internal::conditional< int(Mode)==int(AffineCompact), MatrixType &, Block< MatrixType, Dim, HDim > >::type AffinePart
Definition: Transform.h:228
Definition: Constants.h:452
Scalar * data()
Definition: Transform.h:604
Definition: Constants.h:322
TransformTraits
Definition: Constants.h:445
Transform< double, 3, Affine > Affine3d
Definition: Transform.h:694
ConstAffinePart affine() const
Definition: Transform.h:404
const Scalar * data() const
Definition: Transform.h:602
const MatrixVType & matrixV() const
Definition: SVDBase.h:99
Transform< double, 3, Isometry > Isometry3d
Definition: Transform.h:685
void makeAffine()
Definition: Transform.h:632
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:203
void computeScalingRotation(ScalingMatrixType *scaling, RotationMatrixType *rotation) const
Definition: Transform.h:1088
Transform< float, 2, Projective > Projective2f
Definition: Transform.h:706
Transform & preshear(const Scalar &sx, const Scalar &sy)
Definition: Transform.h:968
Transform & operator=(const EigenBase< OtherDerived > &other)
Definition: Transform.h:302
const Block< ConstMatrixType, Dim, Dim, int(Mode)==(AffineCompact)&&(Options &RowMajor)==0 > ConstLinearPart
Definition: Transform.h:224
Transform< float, 3, Projective > Projective3f
Definition: Transform.h:708
Transform< Scalar, Dim, TransformTimeDiagonalMode > TransformTimeDiagonalReturnType
Definition: Transform.h:245
Definition: Eigen_Colamd.h:54
Transform< float, 3, AffineCompact > AffineCompact3f
Definition: Transform.h:699
Transform< double, 3, AffineCompact > AffineCompact3d
Definition: Transform.h:703
internal::make_proper_matrix_type< Scalar, Rows, HDim, Options >::type MatrixType
Definition: Transform.h:216
Transform< float, 2, Affine > Affine2f
Definition: Transform.h:688
Transform< float, 3, Isometry > Isometry3f
Definition: Transform.h:681
Expression of a fixed-size or dynamic-size block.
Definition: Block.h:104
Translation< Scalar, Dim > TranslationType
Definition: Transform.h:240
Transform< double, 2, Affine > Affine2d
Definition: Transform.h:692
Transform< double, 2, Isometry > Isometry2d
Definition: Transform.h:683
Two-sided Jacobi SVD decomposition of a rectangular matrix.
Definition: ForwardDeclarations.h:255
const LinearMatrixType rotation() const
Definition: Transform.h:1038
Definition: Constants.h:387
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:538
Definition: Constants.h:450
internal::cast_return_type< Transform, Transform< NewScalarType, Dim, Mode, Options > >::type cast() const
Definition: Transform.h:612
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:679
Transform< double, 3, Projective > Projective3d
Definition: Transform.h:712
LinearPart linear()
Definition: Transform.h:401
internal::conditional< int(Mode)==int(AffineCompact), const MatrixType &, const Block< const MatrixType, Dim, HDim > >::type ConstAffinePart
Definition: Transform.h:232
MatrixType & matrix()
Definition: Transform.h:396
Transform()
Definition: Transform.h:255