12 #ifndef EIGEN_TRANSFORM_H
13 #define EIGEN_TRANSFORM_H
19 template<
typename Transform>
31 template<
typename TransformType,
36 int RhsCols = MatrixType::ColsAtCompileTime>
39 template<
typename Other,
44 int OtherRows=Other::RowsAtCompileTime,
45 int OtherCols=Other::ColsAtCompileTime>
48 template<
typename Lhs,
55 template<
typename Other,
60 int OtherRows=Other::RowsAtCompileTime,
61 int OtherCols=Other::ColsAtCompileTime>
66 template<
typename _Scalar,
int _Dim,
int _Mode,
int _Options>
75 ColsAtCompileTime = Dim1,
76 MaxRowsAtCompileTime = RowsAtCompileTime,
77 MaxColsAtCompileTime = ColsAtCompileTime,
82 template<
int Mode>
struct transform_make_affine;
203 template<
typename _Scalar,
int _Dim,
int _Mode,
int _Options>
275 template<
typename Derived>
285 template<
typename OtherDerived>
289 YOU_MIXED_DIFFERENT_NUMERIC_TYPES__YOU_NEED_TO_USE_THE_CAST_METHOD_OF_MATRIXBASE_TO_CAST_NUMERIC_TYPES_EXPLICITLY);
296 template<
typename OtherDerived>
300 YOU_MIXED_DIFFERENT_NUMERIC_TYPES__YOU_NEED_TO_USE_THE_CAST_METHOD_OF_MATRIXBASE_TO_CAST_NUMERIC_TYPES_EXPLICITLY);
306 template<
int OtherOptions>
314 template<
int OtherMode,
int OtherOptions>
321 YOU_PERFORMED_AN_INVALID_TRANSFORMATION_CONVERSION)
326 YOU_PERFORMED_AN_INVALID_TRANSFORMATION_CONVERSION)
337 m_matrix.template block<Dim,Dim+1>(0,0) = other.
matrix().template block<Dim,Dim+1>(0,0);
355 template<
typename OtherDerived>
362 template<
typename OtherDerived>
369 #ifdef EIGEN_QT_SUPPORT
372 inline QMatrix toQMatrix(
void)
const;
373 inline Transform(
const QTransform& other);
375 inline QTransform toQTransform(
void)
const;
433 template<
typename OtherDerived>
445 template<
typename OtherDerived>
friend
456 template<
typename DiagonalDerived>
471 template<
typename DiagonalDerived>
483 template<
typename OtherDerived>
501 template<
int OtherMode,
int OtherOptions>
struct icc_11_workaround
504 typedef typename ProductType::ResultType ResultType;
509 template<
int OtherMode,
int OtherOptions>
510 inline typename icc_11_workaround<OtherMode,OtherOptions>::ResultType
511 operator * (
const Transform<Scalar,Dim,OtherMode,OtherOptions>& other)
const
513 typedef typename icc_11_workaround<OtherMode,OtherOptions>::ProductType ProductType;
514 return ProductType::run(*
this,other);
518 template<
int OtherMode,
int OtherOptions>
519 EIGEN_DEVICE_FUNC inline typename internal::transform_transform_product_impl<Transform,Transform<Scalar,Dim,OtherMode,OtherOptions> >::ResultType
535 return Transform(MatrixType::Identity());
538 template<
typename OtherDerived>
542 template<
typename OtherDerived>
549 template<
typename OtherDerived>
553 template<
typename OtherDerived>
557 template<
typename RotationType>
561 template<
typename RotationType>
592 template<
typename Derived>
594 template<
typename Derived>
596 template<
typename Derived>
602 template<
typename RotationMatrixType,
typename ScalingMatrixType>
605 template<
typename ScalingMatrixType,
typename RotationMatrixType>
609 template<
typename PositionDerived,
typename OrientationType,
typename ScaleDerived>
627 template<
typename NewScalarType>
632 template<
typename OtherScalarType>
658 {
return m_matrix.template block<int(Mode)==int(Projective)?HDim:Dim,Dim>(0,0); }
664 {
return m_matrix.template block<int(Mode)==int(Projective)?HDim:Dim,Dim>(0,0); }
671 {
return m_matrix.template block<int(Mode)==int(Projective)?HDim:Dim,1>(0,Dim); }
677 {
return m_matrix.template block<int(Mode)==int(Projective)?HDim:Dim,1>(0,Dim); }
680 #ifdef EIGEN_TRANSFORM_PLUGIN
681 #include EIGEN_TRANSFORM_PLUGIN
685 #ifndef EIGEN_PARSED_BY_DOXYGEN
734 #ifdef EIGEN_QT_SUPPORT
739 template<
typename Scalar,
int Dim,
int Mode,
int Options>
742 check_template_params();
750 template<
typename Scalar,
int Dim,
int Mode,
int Options>
755 m_matrix << other.m11(), other.m21(), other.dx(),
756 other.m12(), other.m22(), other.dy();
758 m_matrix << other.m11(), other.m21(), other.dx(),
759 other.m12(), other.m22(), other.dy(),
770 template<
typename Scalar,
int Dim,
int Mode,
int Options>
771 QMatrix Transform<Scalar,Dim,Mode,Options>::toQMatrix(
void)
const
773 check_template_params();
775 return QMatrix(m_matrix.
coeff(0,0), m_matrix.
coeff(1,0),
784 template<
typename Scalar,
int Dim,
int Mode,
int Options>
787 check_template_params();
795 template<
typename Scalar,
int Dim,
int Mode,
int Options>
798 check_template_params();
801 m_matrix << other.m11(), other.m21(), other.dx(),
802 other.m12(), other.m22(), other.dy();
804 m_matrix << other.m11(), other.m21(), other.dx(),
805 other.m12(), other.m22(), other.dy(),
806 other.m13(), other.m23(), other.m33();
814 template<
typename Scalar,
int Dim,
int Mode,
int Options>
815 QTransform Transform<Scalar,Dim,Mode,Options>::toQTransform(
void)
const
819 return QTransform(m_matrix.
coeff(0,0), m_matrix.
coeff(1,0),
823 return QTransform(m_matrix.
coeff(0,0), m_matrix.
coeff(1,0), m_matrix.
coeff(2,0),
837 template<
typename Scalar,
int Dim,
int Mode,
int Options>
838 template<
typename OtherDerived>
844 linearExt().noalias() = (linearExt() * other.
asDiagonal());
852 template<
typename Scalar,
int Dim,
int Mode,
int Options>
864 template<
typename Scalar,
int Dim,
int Mode,
int Options>
865 template<
typename OtherDerived>
871 affine().noalias() = (other.
asDiagonal() * affine());
879 template<
typename Scalar,
int Dim,
int Mode,
int Options>
883 m_matrix.template topRows<Dim>() *= s;
891 template<
typename Scalar,
int Dim,
int Mode,
int Options>
892 template<
typename OtherDerived>
897 translationExt() += linearExt() * other;
905 template<
typename Scalar,
int Dim,
int Mode,
int Options>
906 template<
typename OtherDerived>
912 affine() += other * m_matrix.row(Dim);
914 translation() += other;
935 template<
typename Scalar,
int Dim,
int Mode,
int Options>
936 template<
typename RotationType>
940 linearExt() *= internal::toRotationMatrix<Scalar,Dim>(rotation);
951 template<
typename Scalar,
int Dim,
int Mode,
int Options>
952 template<
typename RotationType>
956 m_matrix.template block<Dim,HDim>(0,0) = internal::toRotationMatrix<Scalar,Dim>(rotation)
957 * m_matrix.template block<Dim,HDim>(0,0);
966 template<
typename Scalar,
int Dim,
int Mode,
int Options>
972 VectorType tmp = linear().col(0)*sy + linear().col(1);
973 linear() << linear().col(0) + linear().col(1)*sx, tmp;
982 template<
typename Scalar,
int Dim,
int Mode,
int Options>
988 m_matrix.template block<Dim,HDim>(0,0) =
LinearMatrixType(1, sx, sy, 1) * m_matrix.template block<Dim,HDim>(0,0);
996 template<
typename Scalar,
int Dim,
int Mode,
int Options>
1000 translation() = t.
vector();
1005 template<
typename Scalar,
int Dim,
int Mode,
int Options>
1013 template<
typename Scalar,
int Dim,
int Mode,
int Options>
1017 linear().diagonal().fill(s.
factor());
1022 template<
typename Scalar,
int Dim,
int Mode,
int Options>
1023 template<
typename Derived>
1026 linear() = internal::toRotationMatrix<Scalar,Dim>(r);
1027 translation().setZero();
1032 template<
typename Scalar,
int Dim,
int Mode,
int Options>
1033 template<
typename Derived>
1047 template<
typename TransformType>
1049 const typename TransformType::LinearMatrixType
run(
const TransformType& t)
1051 typedef typename TransformType::LinearMatrixType LinearMatrixType;
1052 LinearMatrixType result;
1053 t.computeRotationScaling(&result, (LinearMatrixType*)0);
1058 template<
typename TransformType>
1060 typename TransformType::ConstLinearPart
run(
const TransformType& t)
1076 template<
typename Scalar,
int Dim,
int Mode,
int Options>
1096 template<
typename Scalar,
int Dim,
int Mode,
int Options>
1097 template<
typename RotationMatrixType,
typename ScalingMatrixType>
1106 if(scaling) *scaling = svd.
matrixV() * sv.asDiagonal() * svd.
matrixV().adjoint();
1111 *rotation = m * svd.
matrixV().adjoint();
1126 template<
typename Scalar,
int Dim,
int Mode,
int Options>
1127 template<
typename ScalingMatrixType,
typename RotationMatrixType>
1136 if(scaling) *scaling = svd.
matrixU() * sv.asDiagonal() * svd.
matrixU().adjoint();
1141 *rotation = m * svd.
matrixV().adjoint();
1148 template<
typename Scalar,
int Dim,
int Mode,
int Options>
1149 template<
typename PositionDerived,
typename OrientationType,
typename ScaleDerived>
1154 linear() = internal::toRotationMatrix<Scalar,Dim>(orientation);
1156 translation() = position;
1166 template<
typename MatrixType>
1169 static const int Dim = MatrixType::ColsAtCompileTime-1;
1170 mat.template block<1,Dim>(Dim,0).setZero();
1171 mat.coeffRef(Dim,Dim) =
typename MatrixType::Scalar(1);
1182 template<
typename TransformType,
int Mode=TransformType::Mode>
1189 template<
typename TransformType>
1194 res.matrix() = m.matrix().inverse();
1221 template<
typename Scalar,
int Dim,
int Mode,
int Options>
1234 res.
matrix().template topLeftCorner<Dim,Dim>() = linear().transpose();
1238 res.
matrix().template topLeftCorner<Dim,Dim>() = linear().inverse();
1242 eigen_assert(
false &&
"Invalid transform traits in Transform::Inverse");
1245 res.
matrix().template topRightCorner<Dim,1>()
1246 = - res.
matrix().template topLeftCorner<Dim,Dim>() * translation();
1263 {
return m.template block<TransformType::Dim,TransformType::HDim>(0,0); }
1265 {
return m.template block<TransformType::Dim,TransformType::HDim>(0,0); }
1268 template<
typename Scalar,
int Dim,
int Options>
1279 template<
typename Other,
int Mode,
int Options,
int Dim,
int HDim>
1284 transform->
linear() = other;
1290 template<
typename Other,
int Mode,
int Options,
int Dim,
int HDim>
1295 transform->
affine() = other;
1300 template<
typename Other,
int Mode,
int Options,
int Dim,
int HDim>
1304 { transform->
matrix() = other; }
1307 template<
typename Other,
int Options,
int Dim,
int HDim>
1311 { transform->
matrix() = other.template block<Dim,HDim>(0,0); }
1318 template<
int LhsMode,
int RhsMode>
1331 template<
typename TransformType,
typename MatrixType,
int RhsCols>
1338 return T.matrix() * other;
1342 template<
typename TransformType,
typename MatrixType,
int RhsCols>
1346 Dim = TransformType::Dim,
1347 HDim = TransformType::HDim,
1348 OtherRows = MatrixType::RowsAtCompileTime,
1349 OtherCols = MatrixType::ColsAtCompileTime
1358 typedef Block<
ResultType, Dim, OtherCols, int(MatrixType::RowsAtCompileTime)==Dim> TopLeftLhs;
1361 TopLeftLhs(res, 0, 0, Dim, other.cols()).noalias() = T.affine() * other;
1362 res.row(OtherRows-1) = other.row(OtherRows-1);
1368 template<
typename TransformType,
typename MatrixType,
int RhsCols>
1372 Dim = TransformType::Dim,
1373 HDim = TransformType::HDim,
1374 OtherRows = MatrixType::RowsAtCompileTime,
1375 OtherCols = MatrixType::ColsAtCompileTime
1386 TopLeftLhs(res, 0, 0, Dim, other.cols()).noalias() += T.linear() * other;
1392 template<
typename TransformType,
typename MatrixType >
1397 Dim = TransformType::Dim,
1398 HDim = TransformType::HDim,
1399 OtherRows = MatrixType::RowsAtCompileTime,
1410 rhs.template head<Dim>() = other; rhs[Dim] =
typename ResultType::Scalar(1);
1412 return res.template head<Dim>();
1421 template<
typename Other,
int Mode,
int Options,
int Dim,
int HDim>
1432 template<
typename Other,
int Options,
int Dim,
int HDim>
1441 res.
matrix().noalias() = other.template block<HDim,Dim>(0,0) * tr.
matrix();
1442 res.
matrix().col(Dim) += other.col(Dim);
1448 template<
typename Other,
int Mode,
int Options,
int Dim,
int HDim>
1464 template<
typename Other,
int Options,
int Dim,
int HDim>
1473 res.
matrix().noalias() = other.template block<Dim,Dim>(0,0) * tr.
matrix();
1480 template<
typename Other,
int Mode,
int Options,
int Dim,
int HDim>
1491 res.
matrix().template topRows<Dim>().noalias()
1492 = other * tr.
matrix().template topRows<Dim>();
1501 template<
typename Scalar,
int Dim,
int LhsMode,
int LhsOptions,
int RhsMode,
int RhsOptions>
1518 template<
typename Scalar,
int Dim,
int LhsMode,
int LhsOptions,
int RhsMode,
int RhsOptions>
1530 template<
typename Scalar,
int Dim,
int LhsOptions,
int RhsOptions>
1545 template<
typename Scalar,
int Dim,
int LhsOptions,
int RhsOptions>
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE ColXpr col(Index i)
This is the const version of col().
Definition: BlockMethods.h:1097
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE RowXpr row(Index i)
This is the const version of row(). */.
Definition: BlockMethods.h:1118
#define EIGEN_CONST_CONDITIONAL(cond)
Definition: Macros.h:1153
#define EIGEN_PLAIN_ENUM_MIN(a, b)
Definition: Macros.h:1288
#define EIGEN_NOEXCEPT
Definition: Macros.h:1418
#define EIGEN_CONSTEXPR
Definition: Macros.h:787
#define EIGEN_DEVICE_FUNC
Definition: Macros.h:976
#define eigen_assert(x)
Definition: Macros.h:1037
#define EIGEN_IMPLIES(a, b)
Definition: Macros.h:1315
#define EIGEN_STRONG_INLINE
Definition: Macros.h:917
#define EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(TYPE, SIZE)
Definition: StaticAssert.h:157
#define EIGEN_STATIC_ASSERT(CONDITION, MSG)
Definition: StaticAssert.h:127
Expression of a fixed-size or dynamic-size block.
Definition: Block.h:105
Definition: DiagonalMatrix.h:19
Represents a diagonal matrix with its storage.
Definition: DiagonalMatrix.h:142
Two-sided Jacobi SVD decomposition of a rectangular matrix.
Definition: JacobiSVD.h:490
Base class for all dense matrices, vectors, and expressions.
Definition: MatrixBase.h:50
EIGEN_DEVICE_FUNC const DiagonalWrapper< const Derived > asDiagonal() const
Definition: DiagonalMatrix.h:325
The matrix class, also used for vectors and row-vectors.
Definition: Matrix.h:180
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar & coeffRef(Index rowId, Index colId)
Definition: PlainObjectBase.h:175
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE EIGEN_CONSTEXPR Index cols() const EIGEN_NOEXCEPT
Definition: PlainObjectBase.h:145
EIGEN_DEVICE_FUNC Derived & setZero(Index size)
Definition: CwiseNullaryOp.h:562
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Scalar * data() const
Definition: PlainObjectBase.h:247
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Scalar & coeff(Index rowId, Index colId) const
Definition: PlainObjectBase.h:152
Expression of the multiple replication of a matrix or vector.
Definition: Replicate.h:63
Definition: ReturnByValue.h:52
EIGEN_DEVICE_FUNC void evalTo(Dest &dst) const
Definition: ReturnByValue.h:61
Common base class for compact rotation representations.
Definition: RotationBase.h:30
EIGEN_DEVICE_FUNC const Derived & derived() const
Definition: RotationBase.h:41
EIGEN_DEVICE_FUNC RotationMatrixType toRotationMatrix() const
Definition: RotationBase.h:45
const MatrixVType & matrixV() const
Definition: SVDBase.h:117
const SingularValuesType & singularValues() const
Definition: SVDBase.h:129
const MatrixUType & matrixU() const
Definition: SVDBase.h:101
Represents a translation transformation.
Definition: Translation.h:31
EIGEN_DEVICE_FUNC const VectorType & vector() const
Definition: Translation.h:87
Transform< float, 3, Projective > Projective3f
Definition: Transform.h:724
Transform< float, 2, Projective > Projective2f
Definition: Transform.h:722
Transform< float, 3, AffineCompact > AffineCompact3f
Definition: Transform.h:715
Transform< float, 3, Affine > Affine3f
Definition: Transform.h:706
Transform< double, 3, Projective > Projective3d
Definition: Transform.h:728
Transform< double, 2, Isometry > Isometry2d
Definition: Transform.h:699
Transform< double, 3, Isometry > Isometry3d
Definition: Transform.h:701
Transform< double, 2, AffineCompact > AffineCompact2d
Definition: Transform.h:717
Transform< float, 2, Isometry > Isometry2f
Definition: Transform.h:695
Transform< double, 3, Affine > Affine3d
Definition: Transform.h:710
Transform< double, 3, AffineCompact > AffineCompact3d
Definition: Transform.h:719
Transform< double, 2, Affine > Affine2d
Definition: Transform.h:708
Transform< double, 2, Projective > Projective2d
Definition: Transform.h:726
Transform< float, 3, Isometry > Isometry3f
Definition: Transform.h:697
Transform< float, 2, AffineCompact > AffineCompact2f
Definition: Transform.h:713
Transform< float, 2, Affine > Affine2f
Definition: Transform.h:704
TransformTraits
Definition: Constants.h:455
@ DontAlign
Definition: Constants.h:325
@ RowMajor
Definition: Constants.h:321
@ ComputeFullV
Definition: Constants.h:397
@ ComputeFullU
Definition: Constants.h:393
@ Affine
Definition: Constants.h:460
@ Projective
Definition: Constants.h:464
@ AffineCompact
Definition: Constants.h:462
@ Isometry
Definition: Constants.h:457
const unsigned int RowMajorBit
Definition: Constants.h:66
Namespace containing all symbols from the Eigen library.
Definition: LDLT.h:16
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
The Index type as used for the API.
Definition: Meta.h:74
const int Dynamic
Definition: Constants.h:22
type
The type the bitset is encoded with.
Definition: bitset.hpp:44
Flags
Special flags for archives.
Definition: cereal.hpp:185
Definition: document.h:416
const GenericPointer< typename T::ValueType > T2 T::AllocatorType & a
Definition: pointer.h:1181
Definition: Constants.h:507
Definition: EigenBase.h:30
EIGEN_DEVICE_FUNC Derived & derived()
Definition: EigenBase.h:46
Holds information about the various numeric (i.e. scalar) types allowed by Eigen.
Definition: NumTraits.h:233
Definition: XprHelper.h:510
Definition: ForwardDeclarations.h:17
#define const
Definition: zconf.h:233