Eigen  3.2.10
 
Loading...
Searching...
No Matches
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
15namespace Eigen {
16
17namespace internal {
18
19template<typename Transform>
20struct 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
31template< 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>
36struct transform_right_product_impl;
37
38template< typename Other,
39 int Mode,
40 int Options,
41 int Dim,
42 int HDim,
43 int OtherRows=Other::RowsAtCompileTime,
44 int OtherCols=Other::ColsAtCompileTime>
45struct transform_left_product_impl;
46
47template< typename Lhs,
48 typename Rhs,
49 bool AnyProjective =
50 transform_traits<Lhs>::IsProjective ||
51 transform_traits<Rhs>::IsProjective>
52struct transform_transform_product_impl;
53
54template< typename Other,
55 int Mode,
56 int Options,
57 int Dim,
58 int HDim,
59 int OtherRows=Other::RowsAtCompileTime,
60 int OtherCols=Other::ColsAtCompileTime>
61struct transform_construct_from_matrix;
62
63template<typename TransformType> struct transform_take_affine_part;
64
65template<int Mode> struct transform_make_affine;
66
67} // end namespace internal
68
183template<typename _Scalar, int _Dim, int _Mode, int _Options>
185{
186public:
187 EIGEN_MAKE_ALIGNED_OPERATOR_NEW_IF_VECTORIZABLE_FIXED_SIZE(_Scalar,_Dim==Dynamic ? Dynamic : (_Dim+1)*(_Dim+1))
188 enum {
189 Mode = _Mode,
190 Options = _Options,
191 Dim = _Dim,
192 HDim = _Dim+1,
193 Rows = int(Mode)==(AffineCompact) ? Dim : HDim
194 };
195
196 typedef _Scalar Scalar;
197 typedef DenseIndex Index;
199 typedef typename internal::make_proper_matrix_type<Scalar,Rows,HDim,Options>::type MatrixType;
205 typedef Block<MatrixType,Dim,Dim,int(Mode)==(AffineCompact) && (Options&RowMajor)==0> LinearPart;
207 typedef const Block<ConstMatrixType,Dim,Dim,int(Mode)==(AffineCompact) && (Options&RowMajor)==0> ConstLinearPart;
209 typedef typename internal::conditional<int(Mode)==int(AffineCompact),
210 MatrixType&,
213 typedef typename internal::conditional<int(Mode)==int(AffineCompact),
214 const MatrixType&,
219 typedef Block<MatrixType,Dim,1,int(Mode)==(AffineCompact)> TranslationPart;
221 typedef const Block<ConstMatrixType,Dim,1,int(Mode)==(AffineCompact)> ConstTranslationPart;
224
225 // this intermediate enum is needed to avoid an ICE with gcc 3.4 and 4.0
226 enum { TransformTimeDiagonalMode = ((Mode==int(Isometry))?Affine:int(Mode)) };
229
230protected:
231
232 MatrixType m_matrix;
233
234public:
235
238 inline Transform()
239 {
240 check_template_params();
241 internal::transform_make_affine<(int(Mode)==Affine) ? Affine : AffineCompact>::run(m_matrix);
242 }
243
244 inline Transform(const Transform& other)
245 {
246 check_template_params();
247 m_matrix = other.m_matrix;
248 }
249
250 inline explicit Transform(const TranslationType& t)
251 {
252 check_template_params();
253 *this = t;
254 }
255 inline explicit Transform(const UniformScaling<Scalar>& s)
256 {
257 check_template_params();
258 *this = s;
259 }
260 template<typename Derived>
261 inline explicit Transform(const RotationBase<Derived, Dim>& r)
262 {
263 check_template_params();
264 *this = r;
265 }
266
267 inline Transform& operator=(const Transform& other)
268 { m_matrix = other.m_matrix; return *this; }
269
270 typedef internal::transform_take_affine_part<Transform> take_affine_part;
271
273 template<typename OtherDerived>
274 inline explicit Transform(const EigenBase<OtherDerived>& other)
275 {
276 EIGEN_STATIC_ASSERT((internal::is_same<Scalar,typename OtherDerived::Scalar>::value),
277 YOU_MIXED_DIFFERENT_NUMERIC_TYPES__YOU_NEED_TO_USE_THE_CAST_METHOD_OF_MATRIXBASE_TO_CAST_NUMERIC_TYPES_EXPLICITLY);
278
279 check_template_params();
280 internal::transform_construct_from_matrix<OtherDerived,Mode,Options,Dim,HDim>::run(this, other.derived());
281 }
282
284 template<typename OtherDerived>
286 {
287 EIGEN_STATIC_ASSERT((internal::is_same<Scalar,typename OtherDerived::Scalar>::value),
288 YOU_MIXED_DIFFERENT_NUMERIC_TYPES__YOU_NEED_TO_USE_THE_CAST_METHOD_OF_MATRIXBASE_TO_CAST_NUMERIC_TYPES_EXPLICITLY);
289
290 internal::transform_construct_from_matrix<OtherDerived,Mode,Options,Dim,HDim>::run(this, other.derived());
291 return *this;
292 }
293
294 template<int OtherOptions>
296 {
297 check_template_params();
298 // only the options change, we can directly copy the matrices
299 m_matrix = other.matrix();
300 }
301
302 template<int OtherMode,int OtherOptions>
304 {
305 check_template_params();
306 // prevent conversions as:
307 // Affine | AffineCompact | Isometry = Projective
308 EIGEN_STATIC_ASSERT(EIGEN_IMPLIES(OtherMode==int(Projective), Mode==int(Projective)),
309 YOU_PERFORMED_AN_INVALID_TRANSFORMATION_CONVERSION)
310
311 // prevent conversions as:
312 // Isometry = Affine | AffineCompact
313 EIGEN_STATIC_ASSERT(EIGEN_IMPLIES(OtherMode==int(Affine)||OtherMode==int(AffineCompact), Mode!=int(Isometry)),
314 YOU_PERFORMED_AN_INVALID_TRANSFORMATION_CONVERSION)
315
316 enum { ModeIsAffineCompact = Mode == int(AffineCompact),
317 OtherModeIsAffineCompact = OtherMode == int(AffineCompact)
318 };
319
320 if(ModeIsAffineCompact == OtherModeIsAffineCompact)
321 {
322 // We need the block expression because the code is compiled for all
323 // combinations of transformations and will trigger a compile time error
324 // if one tries to assign the matrices directly
325 m_matrix.template block<Dim,Dim+1>(0,0) = other.matrix().template block<Dim,Dim+1>(0,0);
326 makeAffine();
327 }
328 else if(OtherModeIsAffineCompact)
329 {
330 typedef typename Transform<Scalar,Dim,OtherMode,OtherOptions>::MatrixType OtherMatrixType;
331 internal::transform_construct_from_matrix<OtherMatrixType,Mode,Options,Dim,HDim>::run(this, other.matrix());
332 }
333 else
334 {
335 // here we know that Mode == AffineCompact and OtherMode != AffineCompact.
336 // if OtherMode were Projective, the static assert above would already have caught it.
337 // So the only possibility is that OtherMode == Affine
338 linear() = other.linear();
339 translation() = other.translation();
340 }
341 }
342
343 template<typename OtherDerived>
344 Transform(const ReturnByValue<OtherDerived>& other)
345 {
346 check_template_params();
347 other.evalTo(*this);
348 }
349
350 template<typename OtherDerived>
351 Transform& operator=(const ReturnByValue<OtherDerived>& other)
352 {
353 other.evalTo(*this);
354 return *this;
355 }
356
357 #ifdef EIGEN_QT_SUPPORT
358 inline Transform(const QMatrix& other);
359 inline Transform& operator=(const QMatrix& other);
360 inline QMatrix toQMatrix(void) const;
361 inline Transform(const QTransform& other);
362 inline Transform& operator=(const QTransform& other);
363 inline QTransform toQTransform(void) const;
364 #endif
365
368 inline Scalar operator() (Index row, Index col) const { return m_matrix(row,col); }
371 inline Scalar& operator() (Index row, Index col) { return m_matrix(row,col); }
372
374 inline const MatrixType& matrix() const { return m_matrix; }
376 inline MatrixType& matrix() { return m_matrix; }
377
379 inline ConstLinearPart linear() const { return ConstLinearPart(m_matrix,0,0); }
381 inline LinearPart linear() { return LinearPart(m_matrix,0,0); }
382
384 inline ConstAffinePart affine() const { return take_affine_part::run(m_matrix); }
386 inline AffinePart affine() { return take_affine_part::run(m_matrix); }
387
389 inline ConstTranslationPart translation() const { return ConstTranslationPart(m_matrix,0,Dim); }
391 inline TranslationPart translation() { return TranslationPart(m_matrix,0,Dim); }
392
417 // note: this function is defined here because some compilers cannot find the respective declaration
418 template<typename OtherDerived>
419 EIGEN_STRONG_INLINE const typename OtherDerived::PlainObject
421 { return internal::transform_right_product_impl<Transform, OtherDerived>::run(*this,other.derived()); }
422
430 template<typename OtherDerived> friend
431 inline const typename internal::transform_left_product_impl<OtherDerived,Mode,Options,_Dim,_Dim+1>::ResultType
433 { return internal::transform_left_product_impl<OtherDerived,Mode,Options,Dim,HDim>::run(a.derived(),b); }
434
441 template<typename DiagonalDerived>
443 operator * (const DiagonalBase<DiagonalDerived> &b) const
444 {
446 res.linearExt() *= b;
447 return res;
448 }
449
456 template<typename DiagonalDerived>
458 operator * (const DiagonalBase<DiagonalDerived> &a, const Transform &b)
459 {
461 res.linear().noalias() = a*b.linear();
462 res.translation().noalias() = a*b.translation();
463 if (Mode!=int(AffineCompact))
464 res.matrix().row(Dim) = b.matrix().row(Dim);
465 return res;
466 }
467
468 template<typename OtherDerived>
469 inline Transform& operator*=(const EigenBase<OtherDerived>& other) { return *this = *this * other; }
470
472 inline const Transform operator * (const Transform& other) const
473 {
474 return internal::transform_transform_product_impl<Transform,Transform>::run(*this,other);
475 }
476
477 #ifdef __INTEL_COMPILER
478private:
479 // this intermediate structure permits to workaround a bug in ICC 11:
480 // error: template instantiation resulted in unexpected function type of "Eigen::Transform<double, 3, 32, 0>
481 // (const Eigen::Transform<double, 3, 2, 0> &) const"
482 // (the meaning of a name may have changed since the template declaration -- the type of the template is:
483 // "Eigen::internal::transform_transform_product_impl<Eigen::Transform<double, 3, 32, 0>,
484 // Eigen::Transform<double, 3, Mode, Options>, <expression>>::ResultType (const Eigen::Transform<double, 3, Mode, Options> &) const")
485 //
486 template<int OtherMode,int OtherOptions> struct icc_11_workaround
487 {
488 typedef internal::transform_transform_product_impl<Transform,Transform<Scalar,Dim,OtherMode,OtherOptions> > ProductType;
489 typedef typename ProductType::ResultType ResultType;
490 };
491
492public:
494 template<int OtherMode,int OtherOptions>
495 inline typename icc_11_workaround<OtherMode,OtherOptions>::ResultType
497 {
498 typedef typename icc_11_workaround<OtherMode,OtherOptions>::ProductType ProductType;
499 return ProductType::run(*this,other);
500 }
501 #else
503 template<int OtherMode,int OtherOptions>
504 inline typename internal::transform_transform_product_impl<Transform,Transform<Scalar,Dim,OtherMode,OtherOptions> >::ResultType
506 {
507 return internal::transform_transform_product_impl<Transform,Transform<Scalar,Dim,OtherMode,OtherOptions> >::run(*this,other);
508 }
509 #endif
510
512 void setIdentity() { m_matrix.setIdentity(); }
513
518 static const Transform Identity()
519 {
521 }
522
523 template<typename OtherDerived>
524 inline Transform& scale(const MatrixBase<OtherDerived> &other);
525
526 template<typename OtherDerived>
527 inline Transform& prescale(const MatrixBase<OtherDerived> &other);
528
529 inline Transform& scale(const Scalar& s);
530 inline Transform& prescale(const Scalar& s);
531
532 template<typename OtherDerived>
533 inline Transform& translate(const MatrixBase<OtherDerived> &other);
534
535 template<typename OtherDerived>
536 inline Transform& pretranslate(const MatrixBase<OtherDerived> &other);
537
538 template<typename RotationType>
539 inline Transform& rotate(const RotationType& rotation);
540
541 template<typename RotationType>
542 inline Transform& prerotate(const RotationType& rotation);
543
544 Transform& shear(const Scalar& sx, const Scalar& sy);
545 Transform& preshear(const Scalar& sx, const Scalar& sy);
546
547 inline Transform& operator=(const TranslationType& t);
548 inline Transform& operator*=(const TranslationType& t) { return translate(t.vector()); }
549 inline Transform operator*(const TranslationType& t) const;
550
551 inline Transform& operator=(const UniformScaling<Scalar>& t);
552 inline Transform& operator*=(const UniformScaling<Scalar>& s) { return scale(s.factor()); }
553 inline Transform<Scalar,Dim,(int(Mode)==int(Isometry)?int(Affine):int(Mode))> operator*(const UniformScaling<Scalar>& s) const
554 {
555 Transform<Scalar,Dim,(int(Mode)==int(Isometry)?int(Affine):int(Mode)),Options> res = *this;
556 res.scale(s.factor());
557 return res;
558 }
559
560 inline Transform& operator*=(const DiagonalMatrix<Scalar,Dim>& s) { linearExt() *= s; return *this; }
561
562 template<typename Derived>
563 inline Transform& operator=(const RotationBase<Derived,Dim>& r);
564 template<typename Derived>
565 inline Transform& operator*=(const RotationBase<Derived,Dim>& r) { return rotate(r.toRotationMatrix()); }
566 template<typename Derived>
567 inline Transform operator*(const RotationBase<Derived,Dim>& r) const;
568
570 template<typename RotationMatrixType, typename ScalingMatrixType>
571 void computeRotationScaling(RotationMatrixType *rotation, ScalingMatrixType *scaling) const;
572 template<typename ScalingMatrixType, typename RotationMatrixType>
573 void computeScalingRotation(ScalingMatrixType *scaling, RotationMatrixType *rotation) const;
574
575 template<typename PositionDerived, typename OrientationType, typename ScaleDerived>
576 Transform& fromPositionOrientationScale(const MatrixBase<PositionDerived> &position,
577 const OrientationType& orientation, const MatrixBase<ScaleDerived> &scale);
578
579 inline Transform inverse(TransformTraits traits = (TransformTraits)Mode) const;
580
582 const Scalar* data() const { return m_matrix.data(); }
584 Scalar* data() { return m_matrix.data(); }
585
591 template<typename NewScalarType>
592 inline typename internal::cast_return_type<Transform,Transform<NewScalarType,Dim,Mode,Options> >::type cast() const
593 { return typename internal::cast_return_type<Transform,Transform<NewScalarType,Dim,Mode,Options> >::type(*this); }
594
596 template<typename OtherScalarType>
598 {
599 check_template_params();
600 m_matrix = other.matrix().template cast<Scalar>();
601 }
602
607 bool isApprox(const Transform& other, const typename NumTraits<Scalar>::Real& prec = NumTraits<Scalar>::dummy_precision()) const
608 { return m_matrix.isApprox(other.m_matrix, prec); }
609
613 {
614 internal::transform_make_affine<int(Mode)>::run(m_matrix);
615 }
616
621 inline Block<MatrixType,int(Mode)==int(Projective)?HDim:Dim,Dim> linearExt()
622 { return m_matrix.template block<int(Mode)==int(Projective)?HDim:Dim,Dim>(0,0); }
627 inline const Block<MatrixType,int(Mode)==int(Projective)?HDim:Dim,Dim> linearExt() const
628 { return m_matrix.template block<int(Mode)==int(Projective)?HDim:Dim,Dim>(0,0); }
629
634 inline Block<MatrixType,int(Mode)==int(Projective)?HDim:Dim,1> translationExt()
635 { return m_matrix.template block<int(Mode)==int(Projective)?HDim:Dim,1>(0,Dim); }
640 inline const Block<MatrixType,int(Mode)==int(Projective)?HDim:Dim,1> translationExt() const
641 { return m_matrix.template block<int(Mode)==int(Projective)?HDim:Dim,1>(0,Dim); }
642
643
644 #ifdef EIGEN_TRANSFORM_PLUGIN
645 #include EIGEN_TRANSFORM_PLUGIN
646 #endif
647
648protected:
649 #ifndef EIGEN_PARSED_BY_DOXYGEN
650 static EIGEN_STRONG_INLINE void check_template_params()
651 {
652 EIGEN_STATIC_ASSERT((Options & (DontAlign|RowMajor)) == Options, INVALID_MATRIX_TEMPLATE_PARAMETERS)
653 }
654 #endif
655
656};
657
659typedef Transform<float,2,Isometry> Isometry2f;
661typedef Transform<float,3,Isometry> Isometry3f;
663typedef Transform<double,2,Isometry> Isometry2d;
665typedef Transform<double,3,Isometry> Isometry3d;
666
668typedef Transform<float,2,Affine> Affine2f;
670typedef Transform<float,3,Affine> Affine3f;
672typedef Transform<double,2,Affine> Affine2d;
674typedef Transform<double,3,Affine> Affine3d;
675
677typedef Transform<float,2,AffineCompact> AffineCompact2f;
679typedef Transform<float,3,AffineCompact> AffineCompact3f;
681typedef Transform<double,2,AffineCompact> AffineCompact2d;
683typedef Transform<double,3,AffineCompact> AffineCompact3d;
684
686typedef Transform<float,2,Projective> Projective2f;
688typedef Transform<float,3,Projective> Projective3f;
690typedef Transform<double,2,Projective> Projective2d;
692typedef Transform<double,3,Projective> Projective3d;
693
694/**************************
695*** Optional QT support ***
696**************************/
697
698#ifdef EIGEN_QT_SUPPORT
703template<typename Scalar, int Dim, int Mode,int Options>
705{
706 check_template_params();
707 *this = other;
708}
709
714template<typename Scalar, int Dim, int Mode,int Options>
715Transform<Scalar,Dim,Mode,Options>& Transform<Scalar,Dim,Mode,Options>::operator=(const QMatrix& other)
716{
717 EIGEN_STATIC_ASSERT(Dim==2, YOU_MADE_A_PROGRAMMING_MISTAKE)
718 m_matrix << other.m11(), other.m21(), other.dx(),
719 other.m12(), other.m22(), other.dy(),
720 0, 0, 1;
721 return *this;
722}
723
730template<typename Scalar, int Dim, int Mode, int Options>
732{
733 check_template_params();
734 EIGEN_STATIC_ASSERT(Dim==2, YOU_MADE_A_PROGRAMMING_MISTAKE)
735 return QMatrix(m_matrix.coeff(0,0), m_matrix.coeff(1,0),
736 m_matrix.coeff(0,1), m_matrix.coeff(1,1),
737 m_matrix.coeff(0,2), m_matrix.coeff(1,2));
738}
739
744template<typename Scalar, int Dim, int Mode,int Options>
746{
747 check_template_params();
748 *this = other;
749}
750
755template<typename Scalar, int Dim, int Mode, int Options>
756Transform<Scalar,Dim,Mode,Options>& Transform<Scalar,Dim,Mode,Options>::operator=(const QTransform& other)
757{
758 check_template_params();
759 EIGEN_STATIC_ASSERT(Dim==2, YOU_MADE_A_PROGRAMMING_MISTAKE)
760 if (Mode == int(AffineCompact))
761 m_matrix << other.m11(), other.m21(), other.dx(),
762 other.m12(), other.m22(), other.dy();
763 else
764 m_matrix << other.m11(), other.m21(), other.dx(),
765 other.m12(), other.m22(), other.dy(),
766 other.m13(), other.m23(), other.m33();
767 return *this;
768}
769
774template<typename Scalar, int Dim, int Mode, int Options>
776{
777 EIGEN_STATIC_ASSERT(Dim==2, YOU_MADE_A_PROGRAMMING_MISTAKE)
778 if (Mode == int(AffineCompact))
779 return QTransform(m_matrix.coeff(0,0), m_matrix.coeff(1,0),
780 m_matrix.coeff(0,1), m_matrix.coeff(1,1),
781 m_matrix.coeff(0,2), m_matrix.coeff(1,2));
782 else
783 return QTransform(m_matrix.coeff(0,0), m_matrix.coeff(1,0), m_matrix.coeff(2,0),
784 m_matrix.coeff(0,1), m_matrix.coeff(1,1), m_matrix.coeff(2,1),
785 m_matrix.coeff(0,2), m_matrix.coeff(1,2), m_matrix.coeff(2,2));
786}
787#endif
788
789/*********************
790*** Procedural API ***
791*********************/
792
797template<typename Scalar, int Dim, int Mode, int Options>
798template<typename OtherDerived>
800Transform<Scalar,Dim,Mode,Options>::scale(const MatrixBase<OtherDerived> &other)
801{
802 EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(OtherDerived,int(Dim))
803 EIGEN_STATIC_ASSERT(Mode!=int(Isometry), THIS_METHOD_IS_ONLY_FOR_SPECIFIC_TRANSFORMATIONS)
804 linearExt().noalias() = (linearExt() * other.asDiagonal());
805 return *this;
806}
807
812template<typename Scalar, int Dim, int Mode, int Options>
813inline Transform<Scalar,Dim,Mode,Options>& Transform<Scalar,Dim,Mode,Options>::scale(const Scalar& s)
814{
815 EIGEN_STATIC_ASSERT(Mode!=int(Isometry), THIS_METHOD_IS_ONLY_FOR_SPECIFIC_TRANSFORMATIONS)
816 linearExt() *= s;
817 return *this;
818}
819
824template<typename Scalar, int Dim, int Mode, int Options>
825template<typename OtherDerived>
827Transform<Scalar,Dim,Mode,Options>::prescale(const MatrixBase<OtherDerived> &other)
828{
829 EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(OtherDerived,int(Dim))
830 EIGEN_STATIC_ASSERT(Mode!=int(Isometry), THIS_METHOD_IS_ONLY_FOR_SPECIFIC_TRANSFORMATIONS)
831 affine().noalias() = (other.asDiagonal() * affine());
832 return *this;
833}
834
839template<typename Scalar, int Dim, int Mode, int Options>
840inline Transform<Scalar,Dim,Mode,Options>& Transform<Scalar,Dim,Mode,Options>::prescale(const Scalar& s)
841{
842 EIGEN_STATIC_ASSERT(Mode!=int(Isometry), THIS_METHOD_IS_ONLY_FOR_SPECIFIC_TRANSFORMATIONS)
843 m_matrix.template topRows<Dim>() *= s;
844 return *this;
845}
846
851template<typename Scalar, int Dim, int Mode, int Options>
852template<typename OtherDerived>
854Transform<Scalar,Dim,Mode,Options>::translate(const MatrixBase<OtherDerived> &other)
855{
856 EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(OtherDerived,int(Dim))
857 translationExt() += linearExt() * other;
858 return *this;
859}
860
865template<typename Scalar, int Dim, int Mode, int Options>
866template<typename OtherDerived>
868Transform<Scalar,Dim,Mode,Options>::pretranslate(const MatrixBase<OtherDerived> &other)
869{
870 EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(OtherDerived,int(Dim))
871 if(int(Mode)==int(Projective))
872 affine() += other * m_matrix.row(Dim);
873 else
874 translation() += other;
875 return *this;
876}
877
895template<typename Scalar, int Dim, int Mode, int Options>
896template<typename RotationType>
898Transform<Scalar,Dim,Mode,Options>::rotate(const RotationType& rotation)
899{
900 linearExt() *= internal::toRotationMatrix<Scalar,Dim>(rotation);
901 return *this;
902}
903
911template<typename Scalar, int Dim, int Mode, int Options>
912template<typename RotationType>
914Transform<Scalar,Dim,Mode,Options>::prerotate(const RotationType& rotation)
915{
916 m_matrix.template block<Dim,HDim>(0,0) = internal::toRotationMatrix<Scalar,Dim>(rotation)
917 * m_matrix.template block<Dim,HDim>(0,0);
918 return *this;
919}
920
926template<typename Scalar, int Dim, int Mode, int Options>
929{
930 EIGEN_STATIC_ASSERT(int(Dim)==2, YOU_MADE_A_PROGRAMMING_MISTAKE)
931 EIGEN_STATIC_ASSERT(Mode!=int(Isometry), THIS_METHOD_IS_ONLY_FOR_SPECIFIC_TRANSFORMATIONS)
932 VectorType tmp = linear().col(0)*sy + linear().col(1);
933 linear() << linear().col(0) + linear().col(1)*sx, tmp;
934 return *this;
935}
936
942template<typename Scalar, int Dim, int Mode, int Options>
945{
946 EIGEN_STATIC_ASSERT(int(Dim)==2, YOU_MADE_A_PROGRAMMING_MISTAKE)
947 EIGEN_STATIC_ASSERT(Mode!=int(Isometry), THIS_METHOD_IS_ONLY_FOR_SPECIFIC_TRANSFORMATIONS)
948 m_matrix.template block<Dim,HDim>(0,0) = LinearMatrixType(1, sx, sy, 1) * m_matrix.template block<Dim,HDim>(0,0);
949 return *this;
950}
951
952/******************************************************
953*** Scaling, Translation and Rotation compatibility ***
954******************************************************/
955
956template<typename Scalar, int Dim, int Mode, int Options>
957inline Transform<Scalar,Dim,Mode,Options>& Transform<Scalar,Dim,Mode,Options>::operator=(const TranslationType& t)
958{
959 linear().setIdentity();
960 translation() = t.vector();
961 makeAffine();
962 return *this;
963}
964
965template<typename Scalar, int Dim, int Mode, int Options>
966inline Transform<Scalar,Dim,Mode,Options> Transform<Scalar,Dim,Mode,Options>::operator*(const TranslationType& t) const
967{
968 Transform res = *this;
969 res.translate(t.vector());
970 return res;
971}
972
973template<typename Scalar, int Dim, int Mode, int Options>
974inline Transform<Scalar,Dim,Mode,Options>& Transform<Scalar,Dim,Mode,Options>::operator=(const UniformScaling<Scalar>& s)
975{
976 m_matrix.setZero();
977 linear().diagonal().fill(s.factor());
978 makeAffine();
979 return *this;
980}
981
982template<typename Scalar, int Dim, int Mode, int Options>
983template<typename Derived>
984inline Transform<Scalar,Dim,Mode,Options>& Transform<Scalar,Dim,Mode,Options>::operator=(const RotationBase<Derived,Dim>& r)
985{
986 linear() = internal::toRotationMatrix<Scalar,Dim>(r);
987 translation().setZero();
988 makeAffine();
989 return *this;
990}
991
992template<typename Scalar, int Dim, int Mode, int Options>
993template<typename Derived>
995{
996 Transform res = *this;
997 res.rotate(r.derived());
998 return res;
999}
1000
1001/************************
1002*** Special functions ***
1003************************/
1004
1012template<typename Scalar, int Dim, int Mode, int Options>
1015{
1016 LinearMatrixType result;
1018 return result;
1019}
1020
1021
1033template<typename Scalar, int Dim, int Mode, int Options>
1034template<typename RotationMatrixType, typename ScalingMatrixType>
1035void Transform<Scalar,Dim,Mode,Options>::computeRotationScaling(RotationMatrixType *rotation, ScalingMatrixType *scaling) const
1036{
1038
1039 Scalar x = (svd.matrixU() * svd.matrixV().adjoint()).determinant(); // so x has absolute value 1
1040 VectorType sv(svd.singularValues());
1041 sv.coeffRef(0) *= x;
1042 if(scaling) scaling->lazyAssign(svd.matrixV() * sv.asDiagonal() * svd.matrixV().adjoint());
1043 if(rotation)
1044 {
1045 LinearMatrixType m(svd.matrixU());
1046 m.col(0) /= x;
1047 rotation->lazyAssign(m * svd.matrixV().adjoint());
1048 }
1049}
1050
1062template<typename Scalar, int Dim, int Mode, int Options>
1063template<typename ScalingMatrixType, typename RotationMatrixType>
1064void Transform<Scalar,Dim,Mode,Options>::computeScalingRotation(ScalingMatrixType *scaling, RotationMatrixType *rotation) const
1065{
1067
1068 Scalar x = (svd.matrixU() * svd.matrixV().adjoint()).determinant(); // so x has absolute value 1
1069 VectorType sv(svd.singularValues());
1070 sv.coeffRef(0) *= x;
1071 if(scaling) scaling->lazyAssign(svd.matrixU() * sv.asDiagonal() * svd.matrixU().adjoint());
1072 if(rotation)
1073 {
1074 LinearMatrixType m(svd.matrixU());
1075 m.col(0) /= x;
1076 rotation->lazyAssign(m * svd.matrixV().adjoint());
1077 }
1078}
1079
1083template<typename Scalar, int Dim, int Mode, int Options>
1084template<typename PositionDerived, typename OrientationType, typename ScaleDerived>
1086Transform<Scalar,Dim,Mode,Options>::fromPositionOrientationScale(const MatrixBase<PositionDerived> &position,
1087 const OrientationType& orientation, const MatrixBase<ScaleDerived> &scale)
1088{
1089 linear() = internal::toRotationMatrix<Scalar,Dim>(orientation);
1090 linear() *= scale.asDiagonal();
1091 translation() = position;
1092 makeAffine();
1093 return *this;
1094}
1095
1096namespace internal {
1097
1098template<int Mode>
1099struct transform_make_affine
1100{
1101 template<typename MatrixType>
1102 static void run(MatrixType &mat)
1103 {
1104 static const int Dim = MatrixType::ColsAtCompileTime-1;
1105 mat.template block<1,Dim>(Dim,0).setZero();
1106 mat.coeffRef(Dim,Dim) = typename MatrixType::Scalar(1);
1107 }
1108};
1109
1110template<>
1111struct transform_make_affine<AffineCompact>
1112{
1113 template<typename MatrixType> static void run(MatrixType &) { }
1114};
1115
1116// selector needed to avoid taking the inverse of a 3x4 matrix
1117template<typename TransformType, int Mode=TransformType::Mode>
1118struct projective_transform_inverse
1119{
1120 static inline void run(const TransformType&, TransformType&)
1121 {}
1122};
1123
1124template<typename TransformType>
1125struct projective_transform_inverse<TransformType, Projective>
1126{
1127 static inline void run(const TransformType& m, TransformType& res)
1128 {
1129 res.matrix() = m.matrix().inverse();
1130 }
1131};
1132
1133} // end namespace internal
1134
1135
1156template<typename Scalar, int Dim, int Mode, int Options>
1159{
1160 Transform res;
1161 if (hint == Projective)
1162 {
1163 internal::projective_transform_inverse<Transform>::run(*this, res);
1164 }
1165 else
1166 {
1167 if (hint == Isometry)
1168 {
1169 res.matrix().template topLeftCorner<Dim,Dim>() = linear().transpose();
1170 }
1171 else if(hint&Affine)
1172 {
1173 res.matrix().template topLeftCorner<Dim,Dim>() = linear().inverse();
1174 }
1175 else
1176 {
1177 eigen_assert(false && "Invalid transform traits in Transform::Inverse");
1178 }
1179 // translation and remaining parts
1180 res.matrix().template topRightCorner<Dim,1>()
1181 = - res.matrix().template topLeftCorner<Dim,Dim>() * translation();
1182 res.makeAffine(); // we do need this, because in the beginning res is uninitialized
1183 }
1184 return res;
1185}
1186
1187namespace internal {
1188
1189/*****************************************************
1190*** Specializations of take affine part ***
1191*****************************************************/
1192
1193template<typename TransformType> struct transform_take_affine_part {
1194 typedef typename TransformType::MatrixType MatrixType;
1195 typedef typename TransformType::AffinePart AffinePart;
1196 typedef typename TransformType::ConstAffinePart ConstAffinePart;
1197 static inline AffinePart run(MatrixType& m)
1198 { return m.template block<TransformType::Dim,TransformType::HDim>(0,0); }
1199 static inline ConstAffinePart run(const MatrixType& m)
1200 { return m.template block<TransformType::Dim,TransformType::HDim>(0,0); }
1201};
1202
1203template<typename Scalar, int Dim, int Options>
1204struct transform_take_affine_part<Transform<Scalar,Dim,AffineCompact, Options> > {
1206 static inline MatrixType& run(MatrixType& m) { return m; }
1207 static inline const MatrixType& run(const MatrixType& m) { return m; }
1208};
1209
1210/*****************************************************
1211*** Specializations of construct from matrix ***
1212*****************************************************/
1213
1214template<typename Other, int Mode, int Options, int Dim, int HDim>
1215struct transform_construct_from_matrix<Other, Mode,Options,Dim,HDim, Dim,Dim>
1216{
1217 static inline void run(Transform<typename Other::Scalar,Dim,Mode,Options> *transform, const Other& other)
1218 {
1219 transform->linear() = other;
1220 transform->translation().setZero();
1221 transform->makeAffine();
1222 }
1223};
1224
1225template<typename Other, int Mode, int Options, int Dim, int HDim>
1226struct transform_construct_from_matrix<Other, Mode,Options,Dim,HDim, Dim,HDim>
1227{
1228 static inline void run(Transform<typename Other::Scalar,Dim,Mode,Options> *transform, const Other& other)
1229 {
1230 transform->affine() = other;
1231 transform->makeAffine();
1232 }
1233};
1234
1235template<typename Other, int Mode, int Options, int Dim, int HDim>
1236struct transform_construct_from_matrix<Other, Mode,Options,Dim,HDim, HDim,HDim>
1237{
1238 static inline void run(Transform<typename Other::Scalar,Dim,Mode,Options> *transform, const Other& other)
1239 { transform->matrix() = other; }
1240};
1241
1242template<typename Other, int Options, int Dim, int HDim>
1243struct transform_construct_from_matrix<Other, AffineCompact,Options,Dim,HDim, HDim,HDim>
1244{
1245 static inline void run(Transform<typename Other::Scalar,Dim,AffineCompact,Options> *transform, const Other& other)
1246 { transform->matrix() = other.template block<Dim,HDim>(0,0); }
1247};
1248
1249/**********************************************************
1250*** Specializations of operator* with rhs EigenBase ***
1251**********************************************************/
1252
1253template<int LhsMode,int RhsMode>
1254struct transform_product_result
1255{
1256 enum
1257 {
1258 Mode =
1259 (LhsMode == (int)Projective || RhsMode == (int)Projective ) ? Projective :
1260 (LhsMode == (int)Affine || RhsMode == (int)Affine ) ? Affine :
1261 (LhsMode == (int)AffineCompact || RhsMode == (int)AffineCompact ) ? AffineCompact :
1262 (LhsMode == (int)Isometry || RhsMode == (int)Isometry ) ? Isometry : Projective
1263 };
1264};
1265
1266template< typename TransformType, typename MatrixType >
1267struct transform_right_product_impl< TransformType, MatrixType, 0 >
1268{
1269 typedef typename MatrixType::PlainObject ResultType;
1270
1271 static EIGEN_STRONG_INLINE ResultType run(const TransformType& T, const MatrixType& other)
1272 {
1273 return T.matrix() * other;
1274 }
1275};
1276
1277template< typename TransformType, typename MatrixType >
1278struct transform_right_product_impl< TransformType, MatrixType, 1 >
1279{
1280 enum {
1281 Dim = TransformType::Dim,
1282 HDim = TransformType::HDim,
1283 OtherRows = MatrixType::RowsAtCompileTime,
1284 OtherCols = MatrixType::ColsAtCompileTime
1285 };
1286
1287 typedef typename MatrixType::PlainObject ResultType;
1288
1289 static EIGEN_STRONG_INLINE ResultType run(const TransformType& T, const MatrixType& other)
1290 {
1291 EIGEN_STATIC_ASSERT(OtherRows==HDim, YOU_MIXED_MATRICES_OF_DIFFERENT_SIZES);
1292
1293 typedef Block<ResultType, Dim, OtherCols, int(MatrixType::RowsAtCompileTime)==Dim> TopLeftLhs;
1294
1295 ResultType res(other.rows(),other.cols());
1296 TopLeftLhs(res, 0, 0, Dim, other.cols()).noalias() = T.affine() * other;
1297 res.row(OtherRows-1) = other.row(OtherRows-1);
1298
1299 return res;
1300 }
1301};
1302
1303template< typename TransformType, typename MatrixType >
1304struct transform_right_product_impl< TransformType, MatrixType, 2 >
1305{
1306 enum {
1307 Dim = TransformType::Dim,
1308 HDim = TransformType::HDim,
1309 OtherRows = MatrixType::RowsAtCompileTime,
1310 OtherCols = MatrixType::ColsAtCompileTime
1311 };
1312
1313 typedef typename MatrixType::PlainObject ResultType;
1314
1315 static EIGEN_STRONG_INLINE ResultType run(const TransformType& T, const MatrixType& other)
1316 {
1317 EIGEN_STATIC_ASSERT(OtherRows==Dim, YOU_MIXED_MATRICES_OF_DIFFERENT_SIZES);
1318
1319 typedef Block<ResultType, Dim, OtherCols, true> TopLeftLhs;
1320 ResultType res(Replicate<typename TransformType::ConstTranslationPart, 1, OtherCols>(T.translation(),1,other.cols()));
1321 TopLeftLhs(res, 0, 0, Dim, other.cols()).noalias() += T.linear() * other;
1322
1323 return res;
1324 }
1325};
1326
1327/**********************************************************
1328*** Specializations of operator* with lhs EigenBase ***
1329**********************************************************/
1330
1331// generic HDim x HDim matrix * T => Projective
1332template<typename Other,int Mode, int Options, int Dim, int HDim>
1333struct transform_left_product_impl<Other,Mode,Options,Dim,HDim, HDim,HDim>
1334{
1335 typedef Transform<typename Other::Scalar,Dim,Mode,Options> TransformType;
1336 typedef typename TransformType::MatrixType MatrixType;
1337 typedef Transform<typename Other::Scalar,Dim,Projective,Options> ResultType;
1338 static ResultType run(const Other& other,const TransformType& tr)
1339 { return ResultType(other * tr.matrix()); }
1340};
1341
1342// generic HDim x HDim matrix * AffineCompact => Projective
1343template<typename Other, int Options, int Dim, int HDim>
1344struct transform_left_product_impl<Other,AffineCompact,Options,Dim,HDim, HDim,HDim>
1345{
1346 typedef Transform<typename Other::Scalar,Dim,AffineCompact,Options> TransformType;
1347 typedef typename TransformType::MatrixType MatrixType;
1348 typedef Transform<typename Other::Scalar,Dim,Projective,Options> ResultType;
1349 static ResultType run(const Other& other,const TransformType& tr)
1350 {
1351 ResultType res;
1352 res.matrix().noalias() = other.template block<HDim,Dim>(0,0) * tr.matrix();
1353 res.matrix().col(Dim) += other.col(Dim);
1354 return res;
1355 }
1356};
1357
1358// affine matrix * T
1359template<typename Other,int Mode, int Options, int Dim, int HDim>
1360struct transform_left_product_impl<Other,Mode,Options,Dim,HDim, Dim,HDim>
1361{
1362 typedef Transform<typename Other::Scalar,Dim,Mode,Options> TransformType;
1363 typedef typename TransformType::MatrixType MatrixType;
1364 typedef TransformType ResultType;
1365 static ResultType run(const Other& other,const TransformType& tr)
1366 {
1367 ResultType res;
1368 res.affine().noalias() = other * tr.matrix();
1369 res.matrix().row(Dim) = tr.matrix().row(Dim);
1370 return res;
1371 }
1372};
1373
1374// affine matrix * AffineCompact
1375template<typename Other, int Options, int Dim, int HDim>
1376struct transform_left_product_impl<Other,AffineCompact,Options,Dim,HDim, Dim,HDim>
1377{
1378 typedef Transform<typename Other::Scalar,Dim,AffineCompact,Options> TransformType;
1379 typedef typename TransformType::MatrixType MatrixType;
1380 typedef TransformType ResultType;
1381 static ResultType run(const Other& other,const TransformType& tr)
1382 {
1383 ResultType res;
1384 res.matrix().noalias() = other.template block<Dim,Dim>(0,0) * tr.matrix();
1385 res.translation() += other.col(Dim);
1386 return res;
1387 }
1388};
1389
1390// linear matrix * T
1391template<typename Other,int Mode, int Options, int Dim, int HDim>
1392struct transform_left_product_impl<Other,Mode,Options,Dim,HDim, Dim,Dim>
1393{
1394 typedef Transform<typename Other::Scalar,Dim,Mode,Options> TransformType;
1395 typedef typename TransformType::MatrixType MatrixType;
1396 typedef TransformType ResultType;
1397 static ResultType run(const Other& other, const TransformType& tr)
1398 {
1399 TransformType res;
1400 if(Mode!=int(AffineCompact))
1401 res.matrix().row(Dim) = tr.matrix().row(Dim);
1402 res.matrix().template topRows<Dim>().noalias()
1403 = other * tr.matrix().template topRows<Dim>();
1404 return res;
1405 }
1406};
1407
1408/**********************************************************
1409*** Specializations of operator* with another Transform ***
1410**********************************************************/
1411
1412template<typename Scalar, int Dim, int LhsMode, int LhsOptions, int RhsMode, int RhsOptions>
1413struct transform_transform_product_impl<Transform<Scalar,Dim,LhsMode,LhsOptions>,Transform<Scalar,Dim,RhsMode,RhsOptions>,false >
1414{
1415 enum { ResultMode = transform_product_result<LhsMode,RhsMode>::Mode };
1416 typedef Transform<Scalar,Dim,LhsMode,LhsOptions> Lhs;
1417 typedef Transform<Scalar,Dim,RhsMode,RhsOptions> Rhs;
1418 typedef Transform<Scalar,Dim,ResultMode,LhsOptions> ResultType;
1419 static ResultType run(const Lhs& lhs, const Rhs& rhs)
1420 {
1421 ResultType res;
1422 res.linear() = lhs.linear() * rhs.linear();
1423 res.translation() = lhs.linear() * rhs.translation() + lhs.translation();
1424 res.makeAffine();
1425 return res;
1426 }
1427};
1428
1429template<typename Scalar, int Dim, int LhsMode, int LhsOptions, int RhsMode, int RhsOptions>
1430struct transform_transform_product_impl<Transform<Scalar,Dim,LhsMode,LhsOptions>,Transform<Scalar,Dim,RhsMode,RhsOptions>,true >
1431{
1432 typedef Transform<Scalar,Dim,LhsMode,LhsOptions> Lhs;
1433 typedef Transform<Scalar,Dim,RhsMode,RhsOptions> Rhs;
1434 typedef Transform<Scalar,Dim,Projective> ResultType;
1435 static ResultType run(const Lhs& lhs, const Rhs& rhs)
1436 {
1437 return ResultType( lhs.matrix() * rhs.matrix() );
1438 }
1439};
1440
1441template<typename Scalar, int Dim, int LhsOptions, int RhsOptions>
1442struct transform_transform_product_impl<Transform<Scalar,Dim,AffineCompact,LhsOptions>,Transform<Scalar,Dim,Projective,RhsOptions>,true >
1443{
1444 typedef Transform<Scalar,Dim,AffineCompact,LhsOptions> Lhs;
1445 typedef Transform<Scalar,Dim,Projective,RhsOptions> Rhs;
1446 typedef Transform<Scalar,Dim,Projective> ResultType;
1447 static ResultType run(const Lhs& lhs, const Rhs& rhs)
1448 {
1449 ResultType res;
1450 res.matrix().template topRows<Dim>() = lhs.matrix() * rhs.matrix();
1451 res.matrix().row(Dim) = rhs.matrix().row(Dim);
1452 return res;
1453 }
1454};
1455
1456template<typename Scalar, int Dim, int LhsOptions, int RhsOptions>
1457struct transform_transform_product_impl<Transform<Scalar,Dim,Projective,LhsOptions>,Transform<Scalar,Dim,AffineCompact,RhsOptions>,true >
1458{
1459 typedef Transform<Scalar,Dim,Projective,LhsOptions> Lhs;
1460 typedef Transform<Scalar,Dim,AffineCompact,RhsOptions> Rhs;
1461 typedef Transform<Scalar,Dim,Projective> ResultType;
1462 static ResultType run(const Lhs& lhs, const Rhs& rhs)
1463 {
1464 ResultType res(lhs.matrix().template leftCols<Dim>() * rhs.matrix());
1465 res.matrix().col(Dim) += lhs.matrix().col(Dim);
1466 return res;
1467 }
1468};
1469
1470} // end namespace internal
1471
1472} // end namespace Eigen
1473
1474#endif // EIGEN_TRANSFORM_H
Expression of a fixed-size or dynamic-size block.
Definition Block.h:104
RowXpr row(Index i)
Definition DenseBase.h:750
Two-sided Jacobi SVD decomposition of a rectangular matrix.
Definition JacobiSVD.h:521
const MatrixVType & matrixV() const
Definition JacobiSVD.h:649
const SingularValuesType & singularValues() const
Definition JacobiSVD.h:661
const MatrixUType & matrixU() const
Definition JacobiSVD.h:633
Base class for all dense matrices, vectors, and expressions.
Definition MatrixBase.h:50
static const IdentityReturnType Identity()
Definition CwiseNullaryOp.h:700
const DiagonalWrapper< const Derived > asDiagonal() const
Definition DiagonalMatrix.h:278
const AdjointReturnType adjoint() const
Definition Transpose.h:237
The matrix class, also used for vectors and row-vectors.
Definition Matrix.h:129
Derived & setZero(Index size)
Definition CwiseNullaryOp.h:515
Common base class for compact rotation representations.
Definition RotationBase.h:30
Represents an homogeneous transformation in a N dimensional space.
Definition Transform.h:185
Scalar operator()(Index row, Index col) const
Definition Transform.h:368
Matrix< Scalar, Dim, 1 > VectorType
Definition Transform.h:217
void computeRotationScaling(RotationMatrixType *rotation, ScalingMatrixType *scaling) const
Definition Transform.h:1035
Transform inverse(TransformTraits traits=(TransformTraits) Mode) const
Definition Transform.h:1158
const Block< ConstMatrixType, Dim, Dim, int(Mode)==(AffineCompact) &&(Options &RowMajor)==0 > ConstLinearPart
Definition Transform.h:207
Block< MatrixType, Dim, Dim, int(Mode)==(AffineCompact) &&(Options &RowMajor)==0 > LinearPart
Definition Transform.h:205
void setIdentity()
Definition Transform.h:512
void makeAffine()
Definition Transform.h:612
Scalar * data()
Definition Transform.h:584
Transform & shear(const Scalar &sx, const Scalar &sy)
Definition Transform.h:928
Transform(const Transform< OtherScalarType, Dim, Mode, Options > &other)
Definition Transform.h:597
QTransform toQTransform(void) const
Definition Transform.h:775
const Block< ConstMatrixType, Dim, 1, int(Mode)==(AffineCompact)> ConstTranslationPart
Definition Transform.h:221
Transform & preshear(const Scalar &sx, const Scalar &sy)
Definition Transform.h:944
Transform(const QTransform &other)
Definition Transform.h:745
internal::make_proper_matrix_type< Scalar, Rows, HDim, Options >::type MatrixType
Definition Transform.h:199
const Scalar * data() const
Definition Transform.h:582
const OtherDerived::PlainObject operator*(const EigenBase< OtherDerived > &other) const
Definition Transform.h:420
LinearPart linear()
Definition Transform.h:381
void computeScalingRotation(ScalingMatrixType *scaling, RotationMatrixType *rotation) const
Definition Transform.h:1064
static const Transform Identity()
Returns an identity transformation.
Definition Transform.h:518
MatrixType & matrix()
Definition Transform.h:376
internal::conditional< int(Mode)==int(AffineCompact), constMatrixType &, constBlock< constMatrixType, Dim, HDim > >::type ConstAffinePart
Definition Transform.h:215
TranslationPart translation()
Definition Transform.h:391
internal::conditional< int(Mode)==int(AffineCompact), MatrixType &, Block< MatrixType, Dim, HDim > >::type AffinePart
Definition Transform.h:211
Transform & scale(const Scalar &s)
Definition Transform.h:813
ConstAffinePart affine() const
Definition Transform.h:384
Transform & prescale(const Scalar &s)
Definition Transform.h:840
const MatrixType & matrix() const
Definition Transform.h:374
bool isApprox(const Transform &other, const typename NumTraits< Scalar >::Real &prec=NumTraits< Scalar >::dummy_precision()) const
Definition Transform.h:607
Transform()
Definition Transform.h:238
QMatrix toQMatrix(void) const
Definition Transform.h:731
Transform & operator=(const QTransform &other)
Definition Transform.h:756
Transform(const QMatrix &other)
Definition Transform.h:704
AffinePart affine()
Definition Transform.h:386
Block< MatrixType, Dim, 1, int(Mode)==(AffineCompact)> TranslationPart
Definition Transform.h:219
Transform & operator=(const QMatrix &other)
Definition Transform.h:715
internal::cast_return_type< Transform, Transform< NewScalarType, Dim, Mode, Options > >::type cast() const
Definition Transform.h:592
const MatrixType ConstMatrixType
Definition Transform.h:201
Translation< Scalar, Dim > TranslationType
Definition Transform.h:223
ConstTranslationPart translation() const
Definition Transform.h:389
Transform< Scalar, Dim, TransformTimeDiagonalMode > TransformTimeDiagonalReturnType
Definition Transform.h:228
ConstLinearPart linear() const
Definition Transform.h:379
Matrix< Scalar, Dim, Dim, Options > LinearMatrixType
Definition Transform.h:203
EIGEN_MAKE_ALIGNED_OPERATOR_NEW_IF_VECTORIZABLE_FIXED_SIZE(_Scalar, _Dim==Dynamic ? Dynamic :(_Dim+1) *(_Dim+1)) enum
Definition Transform.h:187
const LinearMatrixType rotation() const
Transform(const EigenBase< OtherDerived > &other)
Definition Transform.h:274
Scalar Scalar
Definition Transform.h:196
Transform & operator=(const EigenBase< OtherDerived > &other)
Definition Transform.h:285
Represents a translation transformation.
Definition Translation.h:31
TransformTraits
Definition Constants.h:389
@ ComputeFullV
Definition Constants.h:331
@ ComputeFullU
Definition Constants.h:327
@ Projective
Definition Constants.h:398
@ Affine
Definition Constants.h:394
@ Isometry
Definition Constants.h:391
@ AffineCompact
Definition Constants.h:396
@ RowMajor
Definition Constants.h:266
@ DontAlign
Definition Constants.h:270
Definition LDLT.h:18
Definition EigenBase.h:27
Derived & derived()
Definition EigenBase.h:34