Eigen  3.2.5
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<int Mode> struct transform_make_affine;
66 
67 } // end namespace internal
68 
177 template<typename _Scalar, int _Dim, int _Mode, int _Options>
178 class Transform
179 {
180 public:
181  EIGEN_MAKE_ALIGNED_OPERATOR_NEW_IF_VECTORIZABLE_FIXED_SIZE(_Scalar,_Dim==Dynamic ? Dynamic : (_Dim+1)*(_Dim+1))
182  enum {
183  Mode = _Mode,
184  Options = _Options,
185  Dim = _Dim,
186  HDim = _Dim+1,
187  Rows = int(Mode)==(AffineCompact) ? Dim : HDim
188  };
190  typedef _Scalar Scalar;
191  typedef DenseIndex Index;
195  typedef const MatrixType ConstMatrixType;
203  typedef typename internal::conditional<int(Mode)==int(AffineCompact),
204  MatrixType&,
207  typedef typename internal::conditional<int(Mode)==int(AffineCompact),
208  const MatrixType&,
218 
219  // this intermediate enum is needed to avoid an ICE with gcc 3.4 and 4.0
220  enum { TransformTimeDiagonalMode = ((Mode==int(Isometry))?Affine:int(Mode)) };
223 
224 protected:
225 
226  MatrixType m_matrix;
227 
228 public:
229 
232  inline Transform()
233  {
234  check_template_params();
235  internal::transform_make_affine<(int(Mode)==Affine) ? Affine : AffineCompact>::run(m_matrix);
236  }
237 
238  inline Transform(const Transform& other)
239  {
240  check_template_params();
241  m_matrix = other.m_matrix;
242  }
243 
244  inline explicit Transform(const TranslationType& t)
245  {
246  check_template_params();
247  *this = t;
248  }
249  inline explicit Transform(const UniformScaling<Scalar>& s)
250  {
251  check_template_params();
252  *this = s;
253  }
254  template<typename Derived>
255  inline explicit Transform(const RotationBase<Derived, Dim>& r)
256  {
257  check_template_params();
258  *this = r;
259  }
260 
261  inline Transform& operator=(const Transform& other)
262  { m_matrix = other.m_matrix; return *this; }
263 
264  typedef internal::transform_take_affine_part<Transform> take_affine_part;
265 
267  template<typename OtherDerived>
268  inline explicit Transform(const EigenBase<OtherDerived>& other)
269  {
270  EIGEN_STATIC_ASSERT((internal::is_same<Scalar,typename OtherDerived::Scalar>::value),
271  YOU_MIXED_DIFFERENT_NUMERIC_TYPES__YOU_NEED_TO_USE_THE_CAST_METHOD_OF_MATRIXBASE_TO_CAST_NUMERIC_TYPES_EXPLICITLY);
272 
273  check_template_params();
274  internal::transform_construct_from_matrix<OtherDerived,Mode,Options,Dim,HDim>::run(this, other.derived());
275  }
276 
278  template<typename OtherDerived>
280  {
281  EIGEN_STATIC_ASSERT((internal::is_same<Scalar,typename OtherDerived::Scalar>::value),
282  YOU_MIXED_DIFFERENT_NUMERIC_TYPES__YOU_NEED_TO_USE_THE_CAST_METHOD_OF_MATRIXBASE_TO_CAST_NUMERIC_TYPES_EXPLICITLY);
283 
284  internal::transform_construct_from_matrix<OtherDerived,Mode,Options,Dim,HDim>::run(this, other.derived());
285  return *this;
286  }
287 
288  template<int OtherOptions>
290  {
291  check_template_params();
292  // only the options change, we can directly copy the matrices
293  m_matrix = other.matrix();
294  }
295 
296  template<int OtherMode,int OtherOptions>
297  inline Transform(const Transform<Scalar,Dim,OtherMode,OtherOptions>& other)
298  {
299  check_template_params();
300  // prevent conversions as:
301  // Affine | AffineCompact | Isometry = Projective
302  EIGEN_STATIC_ASSERT(EIGEN_IMPLIES(OtherMode==int(Projective), Mode==int(Projective)),
303  YOU_PERFORMED_AN_INVALID_TRANSFORMATION_CONVERSION)
304 
305  // prevent conversions as:
306  // Isometry = Affine | AffineCompact
307  EIGEN_STATIC_ASSERT(EIGEN_IMPLIES(OtherMode==int(Affine)||OtherMode==int(AffineCompact), Mode!=int(Isometry)),
308  YOU_PERFORMED_AN_INVALID_TRANSFORMATION_CONVERSION)
309 
310  enum { ModeIsAffineCompact = Mode == int(AffineCompact),
311  OtherModeIsAffineCompact = OtherMode == int(AffineCompact)
312  };
313 
314  if(ModeIsAffineCompact == OtherModeIsAffineCompact)
315  {
316  // We need the block expression because the code is compiled for all
317  // combinations of transformations and will trigger a compile time error
318  // if one tries to assign the matrices directly
319  m_matrix.template block<Dim,Dim+1>(0,0) = other.matrix().template block<Dim,Dim+1>(0,0);
320  makeAffine();
321  }
322  else if(OtherModeIsAffineCompact)
323  {
324  typedef typename Transform<Scalar,Dim,OtherMode,OtherOptions>::MatrixType OtherMatrixType;
325  internal::transform_construct_from_matrix<OtherMatrixType,Mode,Options,Dim,HDim>::run(this, other.matrix());
326  }
327  else
328  {
329  // here we know that Mode == AffineCompact and OtherMode != AffineCompact.
330  // if OtherMode were Projective, the static assert above would already have caught it.
331  // So the only possibility is that OtherMode == Affine
332  linear() = other.linear();
333  translation() = other.translation();
334  }
335  }
336 
337  template<typename OtherDerived>
338  Transform(const ReturnByValue<OtherDerived>& other)
339  {
340  check_template_params();
341  other.evalTo(*this);
342  }
343 
344  template<typename OtherDerived>
345  Transform& operator=(const ReturnByValue<OtherDerived>& other)
346  {
347  other.evalTo(*this);
348  return *this;
349  }
350 
351  #ifdef EIGEN_QT_SUPPORT
352  inline Transform(const QMatrix& other);
353  inline Transform& operator=(const QMatrix& other);
354  inline QMatrix toQMatrix(void) const;
355  inline Transform(const QTransform& other);
356  inline Transform& operator=(const QTransform& other);
357  inline QTransform toQTransform(void) const;
358  #endif
359 
362  inline Scalar operator() (Index row, Index col) const { return m_matrix(row,col); }
365  inline Scalar& operator() (Index row, Index col) { return m_matrix(row,col); }
366 
368  inline const MatrixType& matrix() const { return m_matrix; }
370  inline MatrixType& matrix() { return m_matrix; }
371 
373  inline ConstLinearPart linear() const { return ConstLinearPart(m_matrix,0,0); }
375  inline LinearPart linear() { return LinearPart(m_matrix,0,0); }
376 
378  inline ConstAffinePart affine() const { return take_affine_part::run(m_matrix); }
380  inline AffinePart affine() { return take_affine_part::run(m_matrix); }
381 
383  inline ConstTranslationPart translation() const { return ConstTranslationPart(m_matrix,0,Dim); }
385  inline TranslationPart translation() { return TranslationPart(m_matrix,0,Dim); }
386 
398  // note: this function is defined here because some compilers cannot find the respective declaration
399  template<typename OtherDerived>
400  EIGEN_STRONG_INLINE const typename internal::transform_right_product_impl<Transform, OtherDerived>::ResultType
401  operator * (const EigenBase<OtherDerived> &other) const
402  { return internal::transform_right_product_impl<Transform, OtherDerived>::run(*this,other.derived()); }
403 
411  template<typename OtherDerived> friend
412  inline const typename internal::transform_left_product_impl<OtherDerived,Mode,Options,_Dim,_Dim+1>::ResultType
413  operator * (const EigenBase<OtherDerived> &a, const Transform &b)
414  { return internal::transform_left_product_impl<OtherDerived,Mode,Options,Dim,HDim>::run(a.derived(),b); }
415 
422  template<typename DiagonalDerived>
423  inline const TransformTimeDiagonalReturnType
424  operator * (const DiagonalBase<DiagonalDerived> &b) const
425  {
426  TransformTimeDiagonalReturnType res(*this);
427  res.linear() *= b;
428  return res;
429  }
430 
437  template<typename DiagonalDerived>
438  friend inline TransformTimeDiagonalReturnType
439  operator * (const DiagonalBase<DiagonalDerived> &a, const Transform &b)
440  {
441  TransformTimeDiagonalReturnType res;
442  res.linear().noalias() = a*b.linear();
443  res.translation().noalias() = a*b.translation();
444  if (Mode!=int(AffineCompact))
445  res.matrix().row(Dim) = b.matrix().row(Dim);
446  return res;
447  }
448 
449  template<typename OtherDerived>
450  inline Transform& operator*=(const EigenBase<OtherDerived>& other) { return *this = *this * other; }
451 
453  inline const Transform operator * (const Transform& other) const
454  {
455  return internal::transform_transform_product_impl<Transform,Transform>::run(*this,other);
456  }
457 
458  #ifdef __INTEL_COMPILER
459 private:
460  // this intermediate structure permits to workaround a bug in ICC 11:
461  // error: template instantiation resulted in unexpected function type of "Eigen::Transform<double, 3, 32, 0>
462  // (const Eigen::Transform<double, 3, 2, 0> &) const"
463  // (the meaning of a name may have changed since the template declaration -- the type of the template is:
464  // "Eigen::internal::transform_transform_product_impl<Eigen::Transform<double, 3, 32, 0>,
465  // Eigen::Transform<double, 3, Mode, Options>, <expression>>::ResultType (const Eigen::Transform<double, 3, Mode, Options> &) const")
466  //
467  template<int OtherMode,int OtherOptions> struct icc_11_workaround
468  {
469  typedef internal::transform_transform_product_impl<Transform,Transform<Scalar,Dim,OtherMode,OtherOptions> > ProductType;
470  typedef typename ProductType::ResultType ResultType;
471  };
472 
473 public:
475  template<int OtherMode,int OtherOptions>
476  inline typename icc_11_workaround<OtherMode,OtherOptions>::ResultType
477  operator * (const Transform<Scalar,Dim,OtherMode,OtherOptions>& other) const
478  {
479  typedef typename icc_11_workaround<OtherMode,OtherOptions>::ProductType ProductType;
480  return ProductType::run(*this,other);
481  }
482  #else
483 
484  template<int OtherMode,int OtherOptions>
485  inline typename internal::transform_transform_product_impl<Transform,Transform<Scalar,Dim,OtherMode,OtherOptions> >::ResultType
486  operator * (const Transform<Scalar,Dim,OtherMode,OtherOptions>& other) const
487  {
488  return internal::transform_transform_product_impl<Transform,Transform<Scalar,Dim,OtherMode,OtherOptions> >::run(*this,other);
489  }
490  #endif
491 
493  void setIdentity() { m_matrix.setIdentity(); }
494 
499  static const Transform Identity()
500  {
501  return Transform(MatrixType::Identity());
502  }
503 
504  template<typename OtherDerived>
505  inline Transform& scale(const MatrixBase<OtherDerived> &other);
506 
507  template<typename OtherDerived>
508  inline Transform& prescale(const MatrixBase<OtherDerived> &other);
509 
510  inline Transform& scale(const Scalar& s);
511  inline Transform& prescale(const Scalar& s);
512 
513  template<typename OtherDerived>
514  inline Transform& translate(const MatrixBase<OtherDerived> &other);
515 
516  template<typename OtherDerived>
517  inline Transform& pretranslate(const MatrixBase<OtherDerived> &other);
518 
519  template<typename RotationType>
520  inline Transform& rotate(const RotationType& rotation);
521 
522  template<typename RotationType>
523  inline Transform& prerotate(const RotationType& rotation);
524 
525  Transform& shear(const Scalar& sx, const Scalar& sy);
526  Transform& preshear(const Scalar& sx, const Scalar& sy);
527 
528  inline Transform& operator=(const TranslationType& t);
529  inline Transform& operator*=(const TranslationType& t) { return translate(t.vector()); }
530  inline Transform operator*(const TranslationType& t) const;
531 
532  inline Transform& operator=(const UniformScaling<Scalar>& t);
533  inline Transform& operator*=(const UniformScaling<Scalar>& s) { return scale(s.factor()); }
534  inline Transform<Scalar,Dim,(int(Mode)==int(Isometry)?int(Affine):int(Mode))> operator*(const UniformScaling<Scalar>& s) const
535  {
536  Transform<Scalar,Dim,(int(Mode)==int(Isometry)?int(Affine):int(Mode)),Options> res = *this;
537  res.scale(s.factor());
538  return res;
539  }
540 
541  inline Transform& operator*=(const DiagonalMatrix<Scalar,Dim>& s) { linear() *= s; return *this; }
542 
543  template<typename Derived>
544  inline Transform& operator=(const RotationBase<Derived,Dim>& r);
545  template<typename Derived>
546  inline Transform& operator*=(const RotationBase<Derived,Dim>& r) { return rotate(r.toRotationMatrix()); }
547  template<typename Derived>
548  inline Transform operator*(const RotationBase<Derived,Dim>& r) const;
549 
550  const LinearMatrixType rotation() const;
551  template<typename RotationMatrixType, typename ScalingMatrixType>
552  void computeRotationScaling(RotationMatrixType *rotation, ScalingMatrixType *scaling) const;
553  template<typename ScalingMatrixType, typename RotationMatrixType>
554  void computeScalingRotation(ScalingMatrixType *scaling, RotationMatrixType *rotation) const;
555 
556  template<typename PositionDerived, typename OrientationType, typename ScaleDerived>
557  Transform& fromPositionOrientationScale(const MatrixBase<PositionDerived> &position,
558  const OrientationType& orientation, const MatrixBase<ScaleDerived> &scale);
559 
560  inline Transform inverse(TransformTraits traits = (TransformTraits)Mode) const;
561 
563  const Scalar* data() const { return m_matrix.data(); }
565  Scalar* data() { return m_matrix.data(); }
566 
572  template<typename NewScalarType>
573  inline typename internal::cast_return_type<Transform,Transform<NewScalarType,Dim,Mode,Options> >::type cast() const
574  { return typename internal::cast_return_type<Transform,Transform<NewScalarType,Dim,Mode,Options> >::type(*this); }
575 
577  template<typename OtherScalarType>
579  {
580  check_template_params();
581  m_matrix = other.matrix().template cast<Scalar>();
582  }
583 
588  bool isApprox(const Transform& other, const typename NumTraits<Scalar>::Real& prec = NumTraits<Scalar>::dummy_precision()) const
589  { return m_matrix.isApprox(other.m_matrix, prec); }
590 
593  void makeAffine()
594  {
595  internal::transform_make_affine<int(Mode)>::run(m_matrix);
596  }
597 
603  { return m_matrix.template block<int(Mode)==int(Projective)?HDim:Dim,Dim>(0,0); }
608  inline const Block<MatrixType,int(Mode)==int(Projective)?HDim:Dim,Dim> linearExt() const
609  { return m_matrix.template block<int(Mode)==int(Projective)?HDim:Dim,Dim>(0,0); }
610 
615  inline Block<MatrixType,int(Mode)==int(Projective)?HDim:Dim,1> translationExt()
616  { return m_matrix.template block<int(Mode)==int(Projective)?HDim:Dim,1>(0,Dim); }
621  inline const Block<MatrixType,int(Mode)==int(Projective)?HDim:Dim,1> translationExt() const
622  { return m_matrix.template block<int(Mode)==int(Projective)?HDim:Dim,1>(0,Dim); }
623 
624 
625  #ifdef EIGEN_TRANSFORM_PLUGIN
626  #include EIGEN_TRANSFORM_PLUGIN
627  #endif
628 
629 protected:
630  #ifndef EIGEN_PARSED_BY_DOXYGEN
631  static EIGEN_STRONG_INLINE void check_template_params()
632  {
633  EIGEN_STATIC_ASSERT((Options & (DontAlign|RowMajor)) == Options, INVALID_MATRIX_TEMPLATE_PARAMETERS)
634  }
635  #endif
636 
637 };
638 
647 
656 
665 
674 
675 /**************************
676 *** Optional QT support ***
677 **************************/
678 
679 #ifdef EIGEN_QT_SUPPORT
680 
684 template<typename Scalar, int Dim, int Mode,int Options>
686 {
687  check_template_params();
688  *this = other;
689 }
690 
695 template<typename Scalar, int Dim, int Mode,int Options>
697 {
698  EIGEN_STATIC_ASSERT(Dim==2, YOU_MADE_A_PROGRAMMING_MISTAKE)
699  m_matrix << other.m11(), other.m21(), other.dx(),
700  other.m12(), other.m22(), other.dy(),
701  0, 0, 1;
702  return *this;
703 }
704 
711 template<typename Scalar, int Dim, int Mode, int Options>
713 {
714  check_template_params();
715  EIGEN_STATIC_ASSERT(Dim==2, YOU_MADE_A_PROGRAMMING_MISTAKE)
716  return QMatrix(m_matrix.coeff(0,0), m_matrix.coeff(1,0),
717  m_matrix.coeff(0,1), m_matrix.coeff(1,1),
718  m_matrix.coeff(0,2), m_matrix.coeff(1,2));
719 }
720 
725 template<typename Scalar, int Dim, int Mode,int Options>
727 {
728  check_template_params();
729  *this = other;
730 }
731 
736 template<typename Scalar, int Dim, int Mode, int Options>
738 {
739  check_template_params();
740  EIGEN_STATIC_ASSERT(Dim==2, YOU_MADE_A_PROGRAMMING_MISTAKE)
741  if (Mode == int(AffineCompact))
742  m_matrix << other.m11(), other.m21(), other.dx(),
743  other.m12(), other.m22(), other.dy();
744  else
745  m_matrix << other.m11(), other.m21(), other.dx(),
746  other.m12(), other.m22(), other.dy(),
747  other.m13(), other.m23(), other.m33();
748  return *this;
749 }
750 
755 template<typename Scalar, int Dim, int Mode, int Options>
757 {
758  EIGEN_STATIC_ASSERT(Dim==2, YOU_MADE_A_PROGRAMMING_MISTAKE)
759  if (Mode == int(AffineCompact))
760  return QTransform(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  else
764  return QTransform(m_matrix.coeff(0,0), m_matrix.coeff(1,0), m_matrix.coeff(2,0),
765  m_matrix.coeff(0,1), m_matrix.coeff(1,1), m_matrix.coeff(2,1),
766  m_matrix.coeff(0,2), m_matrix.coeff(1,2), m_matrix.coeff(2,2));
767 }
768 #endif
769 
770 /*********************
771 *** Procedural API ***
772 *********************/
773 
778 template<typename Scalar, int Dim, int Mode, int Options>
779 template<typename OtherDerived>
782 {
783  EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(OtherDerived,int(Dim))
784  EIGEN_STATIC_ASSERT(Mode!=int(Isometry), THIS_METHOD_IS_ONLY_FOR_SPECIFIC_TRANSFORMATIONS)
785  linearExt().noalias() = (linearExt() * other.asDiagonal());
786  return *this;
787 }
788 
793 template<typename Scalar, int Dim, int Mode, int Options>
795 {
796  EIGEN_STATIC_ASSERT(Mode!=int(Isometry), THIS_METHOD_IS_ONLY_FOR_SPECIFIC_TRANSFORMATIONS)
797  linearExt() *= s;
798  return *this;
799 }
800 
805 template<typename Scalar, int Dim, int Mode, int Options>
806 template<typename OtherDerived>
809 {
810  EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(OtherDerived,int(Dim))
811  EIGEN_STATIC_ASSERT(Mode!=int(Isometry), THIS_METHOD_IS_ONLY_FOR_SPECIFIC_TRANSFORMATIONS)
812  m_matrix.template block<Dim,HDim>(0,0).noalias() = (other.asDiagonal() * m_matrix.template block<Dim,HDim>(0,0));
813  return *this;
814 }
815 
820 template<typename Scalar, int Dim, int Mode, int Options>
822 {
823  EIGEN_STATIC_ASSERT(Mode!=int(Isometry), THIS_METHOD_IS_ONLY_FOR_SPECIFIC_TRANSFORMATIONS)
824  m_matrix.template topRows<Dim>() *= s;
825  return *this;
826 }
827 
832 template<typename Scalar, int Dim, int Mode, int Options>
833 template<typename OtherDerived>
836 {
837  EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(OtherDerived,int(Dim))
838  translationExt() += linearExt() * other;
839  return *this;
840 }
841 
846 template<typename Scalar, int Dim, int Mode, int Options>
847 template<typename OtherDerived>
850 {
851  EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(OtherDerived,int(Dim))
852  if(int(Mode)==int(Projective))
853  affine() += other * m_matrix.row(Dim);
854  else
855  translation() += other;
856  return *this;
857 }
858 
876 template<typename Scalar, int Dim, int Mode, int Options>
877 template<typename RotationType>
879 Transform<Scalar,Dim,Mode,Options>::rotate(const RotationType& rotation)
880 {
881  linearExt() *= internal::toRotationMatrix<Scalar,Dim>(rotation);
882  return *this;
883 }
884 
892 template<typename Scalar, int Dim, int Mode, int Options>
893 template<typename RotationType>
896 {
897  m_matrix.template block<Dim,HDim>(0,0) = internal::toRotationMatrix<Scalar,Dim>(rotation)
898  * m_matrix.template block<Dim,HDim>(0,0);
899  return *this;
900 }
901 
907 template<typename Scalar, int Dim, int Mode, int Options>
909 Transform<Scalar,Dim,Mode,Options>::shear(const Scalar& sx, const Scalar& sy)
910 {
911  EIGEN_STATIC_ASSERT(int(Dim)==2, YOU_MADE_A_PROGRAMMING_MISTAKE)
912  EIGEN_STATIC_ASSERT(Mode!=int(Isometry), THIS_METHOD_IS_ONLY_FOR_SPECIFIC_TRANSFORMATIONS)
913  VectorType tmp = linear().col(0)*sy + linear().col(1);
914  linear() << linear().col(0) + linear().col(1)*sx, tmp;
915  return *this;
916 }
917 
923 template<typename Scalar, int Dim, int Mode, int Options>
925 Transform<Scalar,Dim,Mode,Options>::preshear(const Scalar& sx, const Scalar& sy)
926 {
927  EIGEN_STATIC_ASSERT(int(Dim)==2, YOU_MADE_A_PROGRAMMING_MISTAKE)
928  EIGEN_STATIC_ASSERT(Mode!=int(Isometry), THIS_METHOD_IS_ONLY_FOR_SPECIFIC_TRANSFORMATIONS)
929  m_matrix.template block<Dim,HDim>(0,0) = LinearMatrixType(1, sx, sy, 1) * m_matrix.template block<Dim,HDim>(0,0);
930  return *this;
931 }
932 
933 /******************************************************
934 *** Scaling, Translation and Rotation compatibility ***
935 ******************************************************/
936 
937 template<typename Scalar, int Dim, int Mode, int Options>
939 {
940  linear().setIdentity();
941  translation() = t.vector();
942  makeAffine();
943  return *this;
944 }
945 
946 template<typename Scalar, int Dim, int Mode, int Options>
947 inline Transform<Scalar,Dim,Mode,Options> Transform<Scalar,Dim,Mode,Options>::operator*(const TranslationType& t) const
948 {
949  Transform res = *this;
950  res.translate(t.vector());
951  return res;
952 }
953 
954 template<typename Scalar, int Dim, int Mode, int Options>
955 inline Transform<Scalar,Dim,Mode,Options>& Transform<Scalar,Dim,Mode,Options>::operator=(const UniformScaling<Scalar>& s)
956 {
957  m_matrix.setZero();
958  linear().diagonal().fill(s.factor());
959  makeAffine();
960  return *this;
961 }
962 
963 template<typename Scalar, int Dim, int Mode, int Options>
964 template<typename Derived>
965 inline Transform<Scalar,Dim,Mode,Options>& Transform<Scalar,Dim,Mode,Options>::operator=(const RotationBase<Derived,Dim>& r)
966 {
967  linear() = internal::toRotationMatrix<Scalar,Dim>(r);
968  translation().setZero();
969  makeAffine();
970  return *this;
971 }
972 
973 template<typename Scalar, int Dim, int Mode, int Options>
974 template<typename Derived>
975 inline Transform<Scalar,Dim,Mode,Options> Transform<Scalar,Dim,Mode,Options>::operator*(const RotationBase<Derived,Dim>& r) const
976 {
977  Transform res = *this;
978  res.rotate(r.derived());
979  return res;
980 }
981 
982 /************************
983 *** Special functions ***
984 ************************/
985 
993 template<typename Scalar, int Dim, int Mode, int Options>
994 const typename Transform<Scalar,Dim,Mode,Options>::LinearMatrixType
996 {
997  LinearMatrixType result;
998  computeRotationScaling(&result, (LinearMatrixType*)0);
999  return result;
1000 }
1001 
1002 
1014 template<typename Scalar, int Dim, int Mode, int Options>
1015 template<typename RotationMatrixType, typename ScalingMatrixType>
1016 void Transform<Scalar,Dim,Mode,Options>::computeRotationScaling(RotationMatrixType *rotation, ScalingMatrixType *scaling) const
1017 {
1019 
1020  Scalar x = (svd.matrixU() * svd.matrixV().adjoint()).determinant(); // so x has absolute value 1
1021  VectorType sv(svd.singularValues());
1022  sv.coeffRef(0) *= x;
1023  if(scaling) scaling->lazyAssign(svd.matrixV() * sv.asDiagonal() * svd.matrixV().adjoint());
1024  if(rotation)
1025  {
1026  LinearMatrixType m(svd.matrixU());
1027  m.col(0) /= x;
1028  rotation->lazyAssign(m * svd.matrixV().adjoint());
1029  }
1030 }
1031 
1043 template<typename Scalar, int Dim, int Mode, int Options>
1044 template<typename ScalingMatrixType, typename RotationMatrixType>
1045 void Transform<Scalar,Dim,Mode,Options>::computeScalingRotation(ScalingMatrixType *scaling, RotationMatrixType *rotation) const
1046 {
1048 
1049  Scalar x = (svd.matrixU() * svd.matrixV().adjoint()).determinant(); // so x has absolute value 1
1050  VectorType sv(svd.singularValues());
1051  sv.coeffRef(0) *= x;
1052  if(scaling) scaling->lazyAssign(svd.matrixU() * sv.asDiagonal() * svd.matrixU().adjoint());
1053  if(rotation)
1054  {
1055  LinearMatrixType m(svd.matrixU());
1056  m.col(0) /= x;
1057  rotation->lazyAssign(m * svd.matrixV().adjoint());
1058  }
1059 }
1060 
1064 template<typename Scalar, int Dim, int Mode, int Options>
1065 template<typename PositionDerived, typename OrientationType, typename ScaleDerived>
1068  const OrientationType& orientation, const MatrixBase<ScaleDerived> &scale)
1069 {
1070  linear() = internal::toRotationMatrix<Scalar,Dim>(orientation);
1071  linear() *= scale.asDiagonal();
1072  translation() = position;
1073  makeAffine();
1074  return *this;
1075 }
1076 
1077 namespace internal {
1078 
1079 template<int Mode>
1080 struct transform_make_affine
1081 {
1082  template<typename MatrixType>
1083  static void run(MatrixType &mat)
1084  {
1085  static const int Dim = MatrixType::ColsAtCompileTime-1;
1086  mat.template block<1,Dim>(Dim,0).setZero();
1087  mat.coeffRef(Dim,Dim) = typename MatrixType::Scalar(1);
1088  }
1089 };
1090 
1091 template<>
1092 struct transform_make_affine<AffineCompact>
1093 {
1094  template<typename MatrixType> static void run(MatrixType &) { }
1095 };
1096 
1097 // selector needed to avoid taking the inverse of a 3x4 matrix
1098 template<typename TransformType, int Mode=TransformType::Mode>
1099 struct projective_transform_inverse
1100 {
1101  static inline void run(const TransformType&, TransformType&)
1102  {}
1103 };
1104 
1105 template<typename TransformType>
1106 struct projective_transform_inverse<TransformType, Projective>
1107 {
1108  static inline void run(const TransformType& m, TransformType& res)
1109  {
1110  res.matrix() = m.matrix().inverse();
1111  }
1112 };
1113 
1114 } // end namespace internal
1115 
1116 
1137 template<typename Scalar, int Dim, int Mode, int Options>
1138 Transform<Scalar,Dim,Mode,Options>
1140 {
1141  Transform res;
1142  if (hint == Projective)
1143  {
1144  internal::projective_transform_inverse<Transform>::run(*this, res);
1145  }
1146  else
1147  {
1148  if (hint == Isometry)
1149  {
1150  res.matrix().template topLeftCorner<Dim,Dim>() = linear().transpose();
1151  }
1152  else if(hint&Affine)
1153  {
1154  res.matrix().template topLeftCorner<Dim,Dim>() = linear().inverse();
1155  }
1156  else
1157  {
1158  eigen_assert(false && "Invalid transform traits in Transform::Inverse");
1159  }
1160  // translation and remaining parts
1161  res.matrix().template topRightCorner<Dim,1>()
1162  = - res.matrix().template topLeftCorner<Dim,Dim>() * translation();
1163  res.makeAffine(); // we do need this, because in the beginning res is uninitialized
1164  }
1165  return res;
1166 }
1167 
1168 namespace internal {
1169 
1170 /*****************************************************
1171 *** Specializations of take affine part ***
1172 *****************************************************/
1173 
1174 template<typename TransformType> struct transform_take_affine_part {
1175  typedef typename TransformType::MatrixType MatrixType;
1176  typedef typename TransformType::AffinePart AffinePart;
1177  typedef typename TransformType::ConstAffinePart ConstAffinePart;
1178  static inline AffinePart run(MatrixType& m)
1179  { return m.template block<TransformType::Dim,TransformType::HDim>(0,0); }
1180  static inline ConstAffinePart run(const MatrixType& m)
1181  { return m.template block<TransformType::Dim,TransformType::HDim>(0,0); }
1182 };
1183 
1184 template<typename Scalar, int Dim, int Options>
1185 struct transform_take_affine_part<Transform<Scalar,Dim,AffineCompact, Options> > {
1186  typedef typename Transform<Scalar,Dim,AffineCompact,Options>::MatrixType MatrixType;
1187  static inline MatrixType& run(MatrixType& m) { return m; }
1188  static inline const MatrixType& run(const MatrixType& m) { return m; }
1189 };
1190 
1191 /*****************************************************
1192 *** Specializations of construct from matrix ***
1193 *****************************************************/
1194 
1195 template<typename Other, int Mode, int Options, int Dim, int HDim>
1196 struct transform_construct_from_matrix<Other, Mode,Options,Dim,HDim, Dim,Dim>
1197 {
1198  static inline void run(Transform<typename Other::Scalar,Dim,Mode,Options> *transform, const Other& other)
1199  {
1200  transform->linear() = other;
1201  transform->translation().setZero();
1202  transform->makeAffine();
1203  }
1204 };
1205 
1206 template<typename Other, int Mode, int Options, int Dim, int HDim>
1207 struct transform_construct_from_matrix<Other, Mode,Options,Dim,HDim, Dim,HDim>
1208 {
1209  static inline void run(Transform<typename Other::Scalar,Dim,Mode,Options> *transform, const Other& other)
1210  {
1211  transform->affine() = other;
1212  transform->makeAffine();
1213  }
1214 };
1215 
1216 template<typename Other, int Mode, int Options, int Dim, int HDim>
1217 struct transform_construct_from_matrix<Other, Mode,Options,Dim,HDim, HDim,HDim>
1218 {
1219  static inline void run(Transform<typename Other::Scalar,Dim,Mode,Options> *transform, const Other& other)
1220  { transform->matrix() = other; }
1221 };
1222 
1223 template<typename Other, int Options, int Dim, int HDim>
1224 struct transform_construct_from_matrix<Other, AffineCompact,Options,Dim,HDim, HDim,HDim>
1225 {
1226  static inline void run(Transform<typename Other::Scalar,Dim,AffineCompact,Options> *transform, const Other& other)
1227  { transform->matrix() = other.template block<Dim,HDim>(0,0); }
1228 };
1229 
1230 /**********************************************************
1231 *** Specializations of operator* with rhs EigenBase ***
1232 **********************************************************/
1233 
1234 template<int LhsMode,int RhsMode>
1235 struct transform_product_result
1236 {
1237  enum
1238  {
1239  Mode =
1240  (LhsMode == (int)Projective || RhsMode == (int)Projective ) ? Projective :
1241  (LhsMode == (int)Affine || RhsMode == (int)Affine ) ? Affine :
1242  (LhsMode == (int)AffineCompact || RhsMode == (int)AffineCompact ) ? AffineCompact :
1243  (LhsMode == (int)Isometry || RhsMode == (int)Isometry ) ? Isometry : Projective
1244  };
1245 };
1246 
1247 template< typename TransformType, typename MatrixType >
1248 struct transform_right_product_impl< TransformType, MatrixType, 0 >
1249 {
1250  typedef typename MatrixType::PlainObject ResultType;
1251 
1252  static EIGEN_STRONG_INLINE ResultType run(const TransformType& T, const MatrixType& other)
1253  {
1254  return T.matrix() * other;
1255  }
1256 };
1257 
1258 template< typename TransformType, typename MatrixType >
1259 struct transform_right_product_impl< TransformType, MatrixType, 1 >
1260 {
1261  enum {
1262  Dim = TransformType::Dim,
1263  HDim = TransformType::HDim,
1264  OtherRows = MatrixType::RowsAtCompileTime,
1265  OtherCols = MatrixType::ColsAtCompileTime
1266  };
1267 
1268  typedef typename MatrixType::PlainObject ResultType;
1269 
1270  static EIGEN_STRONG_INLINE ResultType run(const TransformType& T, const MatrixType& other)
1271  {
1272  EIGEN_STATIC_ASSERT(OtherRows==HDim, YOU_MIXED_MATRICES_OF_DIFFERENT_SIZES);
1273 
1274  typedef Block<ResultType, Dim, OtherCols, int(MatrixType::RowsAtCompileTime)==Dim> TopLeftLhs;
1275 
1276  ResultType res(other.rows(),other.cols());
1277  TopLeftLhs(res, 0, 0, Dim, other.cols()).noalias() = T.affine() * other;
1278  res.row(OtherRows-1) = other.row(OtherRows-1);
1279 
1280  return res;
1281  }
1282 };
1283 
1284 template< typename TransformType, typename MatrixType >
1285 struct transform_right_product_impl< TransformType, MatrixType, 2 >
1286 {
1287  enum {
1288  Dim = TransformType::Dim,
1289  HDim = TransformType::HDim,
1290  OtherRows = MatrixType::RowsAtCompileTime,
1291  OtherCols = MatrixType::ColsAtCompileTime
1292  };
1293 
1294  typedef typename MatrixType::PlainObject ResultType;
1295 
1296  static EIGEN_STRONG_INLINE ResultType run(const TransformType& T, const MatrixType& other)
1297  {
1298  EIGEN_STATIC_ASSERT(OtherRows==Dim, YOU_MIXED_MATRICES_OF_DIFFERENT_SIZES);
1299 
1300  typedef Block<ResultType, Dim, OtherCols, true> TopLeftLhs;
1301  ResultType res(Replicate<typename TransformType::ConstTranslationPart, 1, OtherCols>(T.translation(),1,other.cols()));
1302  TopLeftLhs(res, 0, 0, Dim, other.cols()).noalias() += T.linear() * other;
1303 
1304  return res;
1305  }
1306 };
1307 
1308 /**********************************************************
1309 *** Specializations of operator* with lhs EigenBase ***
1310 **********************************************************/
1311 
1312 // generic HDim x HDim matrix * T => Projective
1313 template<typename Other,int Mode, int Options, int Dim, int HDim>
1314 struct transform_left_product_impl<Other,Mode,Options,Dim,HDim, HDim,HDim>
1315 {
1316  typedef Transform<typename Other::Scalar,Dim,Mode,Options> TransformType;
1317  typedef typename TransformType::MatrixType MatrixType;
1318  typedef Transform<typename Other::Scalar,Dim,Projective,Options> ResultType;
1319  static ResultType run(const Other& other,const TransformType& tr)
1320  { return ResultType(other * tr.matrix()); }
1321 };
1322 
1323 // generic HDim x HDim matrix * AffineCompact => Projective
1324 template<typename Other, int Options, int Dim, int HDim>
1325 struct transform_left_product_impl<Other,AffineCompact,Options,Dim,HDim, HDim,HDim>
1326 {
1327  typedef Transform<typename Other::Scalar,Dim,AffineCompact,Options> TransformType;
1328  typedef typename TransformType::MatrixType MatrixType;
1329  typedef Transform<typename Other::Scalar,Dim,Projective,Options> ResultType;
1330  static ResultType run(const Other& other,const TransformType& tr)
1331  {
1332  ResultType res;
1333  res.matrix().noalias() = other.template block<HDim,Dim>(0,0) * tr.matrix();
1334  res.matrix().col(Dim) += other.col(Dim);
1335  return res;
1336  }
1337 };
1338 
1339 // affine matrix * T
1340 template<typename Other,int Mode, int Options, int Dim, int HDim>
1341 struct transform_left_product_impl<Other,Mode,Options,Dim,HDim, Dim,HDim>
1342 {
1343  typedef Transform<typename Other::Scalar,Dim,Mode,Options> TransformType;
1344  typedef typename TransformType::MatrixType MatrixType;
1345  typedef TransformType ResultType;
1346  static ResultType run(const Other& other,const TransformType& tr)
1347  {
1348  ResultType res;
1349  res.affine().noalias() = other * tr.matrix();
1350  res.matrix().row(Dim) = tr.matrix().row(Dim);
1351  return res;
1352  }
1353 };
1354 
1355 // affine matrix * AffineCompact
1356 template<typename Other, int Options, int Dim, int HDim>
1357 struct transform_left_product_impl<Other,AffineCompact,Options,Dim,HDim, Dim,HDim>
1358 {
1359  typedef Transform<typename Other::Scalar,Dim,AffineCompact,Options> TransformType;
1360  typedef typename TransformType::MatrixType MatrixType;
1361  typedef TransformType ResultType;
1362  static ResultType run(const Other& other,const TransformType& tr)
1363  {
1364  ResultType res;
1365  res.matrix().noalias() = other.template block<Dim,Dim>(0,0) * tr.matrix();
1366  res.translation() += other.col(Dim);
1367  return res;
1368  }
1369 };
1370 
1371 // linear matrix * T
1372 template<typename Other,int Mode, int Options, int Dim, int HDim>
1373 struct transform_left_product_impl<Other,Mode,Options,Dim,HDim, Dim,Dim>
1374 {
1375  typedef Transform<typename Other::Scalar,Dim,Mode,Options> TransformType;
1376  typedef typename TransformType::MatrixType MatrixType;
1377  typedef TransformType ResultType;
1378  static ResultType run(const Other& other, const TransformType& tr)
1379  {
1380  TransformType res;
1381  if(Mode!=int(AffineCompact))
1382  res.matrix().row(Dim) = tr.matrix().row(Dim);
1383  res.matrix().template topRows<Dim>().noalias()
1384  = other * tr.matrix().template topRows<Dim>();
1385  return res;
1386  }
1387 };
1388 
1389 /**********************************************************
1390 *** Specializations of operator* with another Transform ***
1391 **********************************************************/
1392 
1393 template<typename Scalar, int Dim, int LhsMode, int LhsOptions, int RhsMode, int RhsOptions>
1394 struct transform_transform_product_impl<Transform<Scalar,Dim,LhsMode,LhsOptions>,Transform<Scalar,Dim,RhsMode,RhsOptions>,false >
1395 {
1396  enum { ResultMode = transform_product_result<LhsMode,RhsMode>::Mode };
1397  typedef Transform<Scalar,Dim,LhsMode,LhsOptions> Lhs;
1398  typedef Transform<Scalar,Dim,RhsMode,RhsOptions> Rhs;
1399  typedef Transform<Scalar,Dim,ResultMode,LhsOptions> ResultType;
1400  static ResultType run(const Lhs& lhs, const Rhs& rhs)
1401  {
1402  ResultType res;
1403  res.linear() = lhs.linear() * rhs.linear();
1404  res.translation() = lhs.linear() * rhs.translation() + lhs.translation();
1405  res.makeAffine();
1406  return res;
1407  }
1408 };
1409 
1410 template<typename Scalar, int Dim, int LhsMode, int LhsOptions, int RhsMode, int RhsOptions>
1411 struct transform_transform_product_impl<Transform<Scalar,Dim,LhsMode,LhsOptions>,Transform<Scalar,Dim,RhsMode,RhsOptions>,true >
1412 {
1413  typedef Transform<Scalar,Dim,LhsMode,LhsOptions> Lhs;
1414  typedef Transform<Scalar,Dim,RhsMode,RhsOptions> Rhs;
1415  typedef Transform<Scalar,Dim,Projective> ResultType;
1416  static ResultType run(const Lhs& lhs, const Rhs& rhs)
1417  {
1418  return ResultType( lhs.matrix() * rhs.matrix() );
1419  }
1420 };
1421 
1422 template<typename Scalar, int Dim, int LhsOptions, int RhsOptions>
1423 struct transform_transform_product_impl<Transform<Scalar,Dim,AffineCompact,LhsOptions>,Transform<Scalar,Dim,Projective,RhsOptions>,true >
1424 {
1425  typedef Transform<Scalar,Dim,AffineCompact,LhsOptions> Lhs;
1426  typedef Transform<Scalar,Dim,Projective,RhsOptions> Rhs;
1427  typedef Transform<Scalar,Dim,Projective> ResultType;
1428  static ResultType run(const Lhs& lhs, const Rhs& rhs)
1429  {
1430  ResultType res;
1431  res.matrix().template topRows<Dim>() = lhs.matrix() * rhs.matrix();
1432  res.matrix().row(Dim) = rhs.matrix().row(Dim);
1433  return res;
1434  }
1435 };
1436 
1437 template<typename Scalar, int Dim, int LhsOptions, int RhsOptions>
1438 struct transform_transform_product_impl<Transform<Scalar,Dim,Projective,LhsOptions>,Transform<Scalar,Dim,AffineCompact,RhsOptions>,true >
1439 {
1440  typedef Transform<Scalar,Dim,Projective,LhsOptions> Lhs;
1441  typedef Transform<Scalar,Dim,AffineCompact,RhsOptions> Rhs;
1442  typedef Transform<Scalar,Dim,Projective> ResultType;
1443  static ResultType run(const Lhs& lhs, const Rhs& rhs)
1444  {
1445  ResultType res(lhs.matrix().template leftCols<Dim>() * rhs.matrix());
1446  res.matrix().col(Dim) += lhs.matrix().col(Dim);
1447  return res;
1448  }
1449 };
1450 
1451 } // end namespace internal
1452 
1453 } // end namespace Eigen
1454 
1455 #endif // EIGEN_TRANSFORM_H
Definition: Constants.h:270
QMatrix toQMatrix(void) const
Definition: Transform.h:712
QTransform toQTransform(void) const
Definition: Transform.h:756
Definition: Constants.h:398
ConstLinearPart linear() const
Definition: Transform.h:373
Block< MatrixType, Dim, Dim, int(Mode)==(AffineCompact)&&(Options &RowMajor)==0 > LinearPart
Definition: Transform.h:199
const MatrixType ConstMatrixType
Definition: Transform.h:195
RowXpr row(Index i)
Definition: DenseBase.h:750
const Scalar * data() const
Definition: PlainObjectBase.h:212
Transform()
Definition: Transform.h:232
Transform & shear(const Scalar &sx, const Scalar &sy)
Definition: Transform.h:909
Matrix< Scalar, Dim, 1 > VectorType
Definition: Transform.h:211
void setIdentity()
Definition: Transform.h:493
bool isApprox(const DenseBase< OtherDerived > &other, const RealScalar &prec=NumTraits< Scalar >::dummy_precision()) const
Definition: Fuzzy.h:98
Transform< float, 2, Projective > Projective2f
Definition: Transform.h:667
Transform< float, 2, Isometry > Isometry2f
Definition: Transform.h:640
Transform< float, 2, AffineCompact > AffineCompact2f
Definition: Transform.h:658
Transform< Scalar, Dim, TransformTimeDiagonalMode > TransformTimeDiagonalReturnType
Definition: Transform.h:222
const LinearMatrixType rotation() const
Definition: Transform.h:995
Definition: LDLT.h:16
Definition: Constants.h:394
internal::conditional< int(Mode)==int(AffineCompact), const MatrixType &, const Block< const MatrixType, Dim, HDim > >::type ConstAffinePart
Definition: Transform.h:209
Block< MatrixType, Dim, 1, int(Mode)==(AffineCompact)> TranslationPart
Definition: Transform.h:213
Holds information about the various numeric (i.e. scalar) types allowed by Eigen. ...
Definition: NumTraits.h:88
Scalar * data()
Definition: Transform.h:565
Definition: Constants.h:331
Transform< double, 2, Affine > Affine2d
Definition: Transform.h:653
const SingularValuesType & singularValues() const
Definition: JacobiSVD.h:641
_Scalar Scalar
Definition: Transform.h:188
internal::cast_return_type< Transform, Transform< NewScalarType, Dim, Mode, Options > >::type cast() const
Definition: Transform.h:573
Definition: Constants.h:391
Transform< double, 3, AffineCompact > AffineCompact3d
Definition: Transform.h:664
Definition: EigenBase.h:26
Represents a translation transformation.
Definition: ForwardDeclarations.h:236
bool isApprox(const Transform &other, const typename NumTraits< Scalar >::Real &prec=NumTraits< Scalar >::dummy_precision()) const
Definition: Transform.h:588
Transform< double, 3, Affine > Affine3d
Definition: Transform.h:655
void makeAffine()
Definition: Transform.h:593
TransformTraits
Definition: Constants.h:389
void computeScalingRotation(ScalingMatrixType *scaling, RotationMatrixType *rotation) const
Definition: Transform.h:1045
Translation< Scalar, Dim > TranslationType
Definition: Transform.h:217
const internal::transform_right_product_impl< Transform, OtherDerived >::ResultType operator*(const EigenBase< OtherDerived > &other) const
Definition: Transform.h:401
Transform< float, 3, Affine > Affine3f
Definition: Transform.h:651
ConstAffinePart affine() const
Definition: Transform.h:378
Transform< float, 3, Projective > Projective3f
Definition: Transform.h:669
LinearPart linear()
Definition: Transform.h:375
Derived & derived()
Definition: EigenBase.h:34
Definition: Constants.h:396
const MatrixUType & matrixU() const
Definition: JacobiSVD.h:613
static const Transform Identity()
Returns an identity transformation.
Definition: Transform.h:499
const MatrixType & matrix() const
Definition: Transform.h:368
Transform< double, 2, Isometry > Isometry2d
Definition: Transform.h:644
AffinePart affine()
Definition: Transform.h:380
Transform(const EigenBase< OtherDerived > &other)
Definition: Transform.h:268
Transform inverse(TransformTraits traits=(TransformTraits) Mode) const
Definition: Transform.h:1139
internal::make_proper_matrix_type< Scalar, Rows, HDim, Options >::type MatrixType
Definition: Transform.h:193
Transform< double, 3, Projective > Projective3d
Definition: Transform.h:673
Transform< float, 3, AffineCompact > AffineCompact3f
Definition: Transform.h:660
Transform(const Transform< OtherScalarType, Dim, Mode, Options > &other)
Definition: Transform.h:578
const Block< ConstMatrixType, Dim, Dim, int(Mode)==(AffineCompact)&&(Options &RowMajor)==0 > ConstLinearPart
Definition: Transform.h:201
Transform< double, 2, AffineCompact > AffineCompact2d
Definition: Transform.h:662
const Scalar * data() const
Definition: Transform.h:563
Definition: Eigen_Colamd.h:54
const MatrixVType & matrixV() const
Definition: JacobiSVD.h:629
Expression of a fixed-size or dynamic-size block.
Definition: Block.h:103
internal::conditional< int(Mode)==int(AffineCompact), MatrixType &, Block< MatrixType, Dim, HDim > >::type AffinePart
Definition: Transform.h:205
Transform< float, 3, Isometry > Isometry3f
Definition: Transform.h:642
Transform< float, 2, Affine > Affine2f
Definition: Transform.h:649
Transform & operator=(const EigenBase< OtherDerived > &other)
Definition: Transform.h:279
const Block< ConstMatrixType, Dim, 1, int(Mode)==(AffineCompact)> ConstTranslationPart
Definition: Transform.h:215
Two-sided Jacobi SVD decomposition of a rectangular matrix.
Definition: ForwardDeclarations.h:224
Derived & setIdentity()
Definition: CwiseNullaryOp.h:772
MatrixType & matrix()
Definition: Transform.h:370
Definition: Constants.h:266
Transform & preshear(const Scalar &sx, const Scalar &sy)
Definition: Transform.h:925
TranslationPart translation()
Definition: Transform.h:385
Transform< double, 2, Projective > Projective2d
Definition: Transform.h:671
void computeRotationScaling(RotationMatrixType *rotation, ScalingMatrixType *scaling) const
Definition: Transform.h:1016
The matrix class, also used for vectors and row-vectors.
Definition: Matrix.h:127
Definition: Constants.h:327
const DiagonalWrapper< const Derived > asDiagonal() const
Definition: DiagonalMatrix.h:278
ConstTranslationPart translation() const
Definition: Transform.h:383
Base class for all dense matrices, vectors, and expressions.
Definition: MatrixBase.h:48
EIGEN_MAKE_ALIGNED_OPERATOR_NEW_IF_VECTORIZABLE_FIXED_SIZE(_Scalar, _Dim==Dynamic?Dynamic:(_Dim+1)*(_Dim+1)) enum
Definition: Transform.h:181
Represents an homogeneous transformation in a N dimensional space.
Definition: ForwardDeclarations.h:261
Transform< double, 3, Isometry > Isometry3d
Definition: Transform.h:646
Matrix< Scalar, Dim, Dim, Options > LinearMatrixType
Definition: Transform.h:197
Derived & setZero(Index size)
Definition: CwiseNullaryOp.h:515