12 #ifndef EIGEN_TRANSFORM_H 13 #define EIGEN_TRANSFORM_H 19 template<
typename Transform>
31 template<
typename TransformType,
38 template<
typename Other,
43 int OtherRows=Other::RowsAtCompileTime,
44 int OtherCols=Other::ColsAtCompileTime>
47 template<
typename Lhs,
54 template<
typename Other,
59 int OtherRows=Other::RowsAtCompileTime,
60 int OtherCols=Other::ColsAtCompileTime>
175 template<
typename _Scalar,
int _Dim,
int _Mode,
int _Options>
232 check_template_params();
239 check_template_params();
245 check_template_params();
250 check_template_params();
253 template<
typename Derived>
256 check_template_params();
261 { m_matrix = other.
m_matrix;
return *
this; }
266 template<
typename OtherDerived>
270 YOU_MIXED_DIFFERENT_NUMERIC_TYPES__YOU_NEED_TO_USE_THE_CAST_METHOD_OF_MATRIXBASE_TO_CAST_NUMERIC_TYPES_EXPLICITLY);
272 check_template_params();
277 template<
typename OtherDerived>
281 YOU_MIXED_DIFFERENT_NUMERIC_TYPES__YOU_NEED_TO_USE_THE_CAST_METHOD_OF_MATRIXBASE_TO_CAST_NUMERIC_TYPES_EXPLICITLY);
287 template<
int OtherOptions>
290 check_template_params();
292 m_matrix = other.
matrix();
295 template<
int OtherMode,
int OtherOptions>
298 check_template_params();
302 YOU_PERFORMED_AN_INVALID_TRANSFORMATION_CONVERSION)
307 YOU_PERFORMED_AN_INVALID_TRANSFORMATION_CONVERSION)
313 if(ModeIsAffineCompact == OtherModeIsAffineCompact)
318 m_matrix.template block<Dim,Dim+1>(0,0) = other.
matrix().template block<Dim,Dim+1>(0,0);
321 else if(OtherModeIsAffineCompact)
331 linear() = other.
linear();
336 template<
typename OtherDerived>
339 check_template_params();
343 template<
typename OtherDerived>
350 #ifdef EIGEN_QT_SUPPORT 352 inline Transform& operator=(
const QMatrix& other);
353 inline QMatrix toQMatrix(
void)
const;
354 inline Transform(
const QTransform& other);
355 inline Transform& operator=(
const QTransform& other);
356 inline QTransform toQTransform(
void)
const;
361 inline Scalar operator() (Index
row, Index
col)
const {
return m_matrix(row,col); }
364 inline Scalar& operator() (Index
row, Index
col) {
return m_matrix(row,col); }
367 inline const MatrixType&
matrix()
const {
return m_matrix; }
369 inline MatrixType&
matrix() {
return m_matrix; }
372 inline ConstLinearPart
linear()
const {
return ConstLinearPart(m_matrix,0,0); }
374 inline LinearPart
linear() {
return LinearPart(m_matrix,0,0); }
377 inline ConstAffinePart
affine()
const {
return take_affine_part::run(m_matrix); }
379 inline AffinePart
affine() {
return take_affine_part::run(m_matrix); }
382 inline ConstTranslationPart
translation()
const {
return ConstTranslationPart(m_matrix,0,
Dim); }
398 template<
typename OtherDerived>
410 template<
typename OtherDerived>
friend 421 template<
typename DiagonalDerived>
422 inline const TransformTimeDiagonalReturnType
425 TransformTimeDiagonalReturnType res(*
this);
436 template<
typename DiagonalDerived>
437 friend inline TransformTimeDiagonalReturnType
440 TransformTimeDiagonalReturnType res;
448 template<
typename OtherDerived>
457 #ifdef __INTEL_COMPILER 466 template<
int OtherMode,
int OtherOptions>
struct icc_11_workaround
469 typedef typename ProductType::ResultType ResultType;
474 template<
int OtherMode,
int OtherOptions>
475 inline typename icc_11_workaround<OtherMode,OtherOptions>::ResultType
478 typedef typename icc_11_workaround<OtherMode,OtherOptions>::ProductType ProductType;
479 return ProductType::run(*
this,other);
483 template<
int OtherMode,
int OtherOptions>
500 return Transform(MatrixType::Identity());
503 template<
typename OtherDerived>
506 template<
typename OtherDerived>
510 inline Transform& prescale(
const Scalar& s);
512 template<
typename OtherDerived>
515 template<
typename OtherDerived>
518 template<
typename RotationType>
521 template<
typename RotationType>
522 inline Transform& prerotate(
const RotationType& rotation);
524 Transform& shear(
const Scalar& sx,
const Scalar& sy);
525 Transform& preshear(
const Scalar& sx,
const Scalar& sy);
527 inline Transform& operator=(
const TranslationType& t);
542 template<
typename Derived>
544 template<
typename Derived>
546 template<
typename Derived>
549 const LinearMatrixType rotation()
const;
550 template<
typename RotationMatrixType,
typename ScalingMatrixType>
551 void computeRotationScaling(RotationMatrixType *rotation, ScalingMatrixType *scaling)
const;
552 template<
typename ScalingMatrixType,
typename RotationMatrixType>
553 void computeScalingRotation(ScalingMatrixType *scaling, RotationMatrixType *rotation)
const;
555 template<
typename PositionDerived,
typename OrientationType,
typename ScaleDerived>
562 const Scalar*
data()
const {
return m_matrix.
data(); }
571 template<
typename NewScalarType>
576 template<
typename OtherScalarType>
579 check_template_params();
580 m_matrix = other.
matrix().template cast<Scalar>();
588 {
return m_matrix.isApprox(other.
m_matrix, prec); }
596 matrix().template block<1,Dim>(
Dim,0).
setZero();
597 matrix().coeffRef(Dim,Dim) = Scalar(1);
606 {
return m_matrix.template block<int(Mode)==int(Projective)?HDim:Dim,Dim>(0,0); }
612 {
return m_matrix.template block<int(Mode)==int(Projective)?HDim:Dim,Dim>(0,0); }
619 {
return m_matrix.template block<int(Mode)==int(Projective)?HDim:Dim,1>(0,
Dim); }
625 {
return m_matrix.template block<int(Mode)==int(Projective)?HDim:Dim,1>(0,
Dim); }
628 #ifdef EIGEN_TRANSFORM_PLUGIN 629 #include EIGEN_TRANSFORM_PLUGIN 633 #ifndef EIGEN_PARSED_BY_DOXYGEN 682 #ifdef EIGEN_QT_SUPPORT 687 template<
typename Scalar,
int Dim,
int Mode,
int Options>
690 check_template_params();
698 template<
typename Scalar,
int Dim,
int Mode,
int Options>
702 m_matrix << other.m11(), other.m21(), other.dx(),
703 other.m12(), other.m22(), other.dy(),
714 template<
typename Scalar,
int Dim,
int Mode,
int Options>
717 check_template_params();
719 return QMatrix(m_matrix.
coeff(0,0), m_matrix.
coeff(1,0),
728 template<
typename Scalar,
int Dim,
int Mode,
int Options>
731 check_template_params();
739 template<
typename Scalar,
int Dim,
int Mode,
int Options>
742 check_template_params();
745 m_matrix << other.m11(), other.m21(), other.dx(),
746 other.m12(), other.m22(), other.dy();
748 m_matrix << other.m11(), other.m21(), other.dx(),
749 other.m12(), other.m22(), other.dy(),
750 other.m13(), other.m23(), other.m33();
758 template<
typename Scalar,
int Dim,
int Mode,
int Options>
763 return QTransform(m_matrix.
coeff(0,0), m_matrix.
coeff(1,0),
767 return QTransform(m_matrix.
coeff(0,0), m_matrix.
coeff(1,0), m_matrix.
coeff(2,0),
781 template<
typename Scalar,
int Dim,
int Mode,
int Options>
782 template<
typename OtherDerived>
788 linearExt().noalias() = (linearExt() * other.
asDiagonal());
796 template<
typename Scalar,
int Dim,
int Mode,
int Options>
808 template<
typename Scalar,
int Dim,
int Mode,
int Options>
809 template<
typename OtherDerived>
815 m_matrix.template block<Dim,HDim>(0,0).noalias() = (other.
asDiagonal() * m_matrix.template block<Dim,HDim>(0,0));
823 template<
typename Scalar,
int Dim,
int Mode,
int Options>
827 m_matrix.template topRows<Dim>() *= s;
835 template<
typename Scalar,
int Dim,
int Mode,
int Options>
836 template<
typename OtherDerived>
841 translationExt() += linearExt() * other;
849 template<
typename Scalar,
int Dim,
int Mode,
int Options>
850 template<
typename OtherDerived>
856 affine() += other * m_matrix.row(
Dim);
858 translation() += other;
879 template<
typename Scalar,
int Dim,
int Mode,
int Options>
880 template<
typename RotationType>
884 linearExt() *= internal::toRotationMatrix<Scalar,Dim>(rotation);
895 template<
typename Scalar,
int Dim,
int Mode,
int Options>
896 template<
typename RotationType>
900 m_matrix.template block<Dim,HDim>(0,0) = internal::toRotationMatrix<Scalar,Dim>(rotation)
901 * m_matrix.template block<Dim,HDim>(0,0);
910 template<
typename Scalar,
int Dim,
int Mode,
int Options>
916 VectorType tmp = linear().col(0)*sy + linear().col(1);
917 linear() << linear().col(0) + linear().col(1)*sx, tmp;
926 template<
typename Scalar,
int Dim,
int Mode,
int Options>
932 m_matrix.template block<Dim,HDim>(0,0) = LinearMatrixType(1, sx, sy, 1) * m_matrix.template block<Dim,HDim>(0,0);
940 template<
typename Scalar,
int Dim,
int Mode,
int Options>
944 translation() = t.
vector();
949 template<
typename Scalar,
int Dim,
int Mode,
int Options>
957 template<
typename Scalar,
int Dim,
int Mode,
int Options>
961 linear().diagonal().fill(s.
factor());
966 template<
typename Scalar,
int Dim,
int Mode,
int Options>
967 template<
typename Derived>
970 linear() = internal::toRotationMatrix<Scalar,Dim>(r);
971 translation().setZero();
976 template<
typename Scalar,
int Dim,
int Mode,
int Options>
977 template<
typename Derived>
996 template<
typename Scalar,
int Dim,
int Mode,
int Options>
1000 LinearMatrixType result;
1001 computeRotationScaling(&result, (LinearMatrixType*)0);
1017 template<
typename Scalar,
int Dim,
int Mode,
int Options>
1018 template<
typename RotationMatrixType,
typename ScalingMatrixType>
1025 sv.coeffRef(0) *= x;
1026 if(scaling) scaling->lazyAssign(svd.
matrixV() * sv.asDiagonal() * svd.
matrixV().adjoint());
1029 LinearMatrixType m(svd.
matrixU());
1031 rotation->lazyAssign(m * svd.
matrixV().adjoint());
1046 template<
typename Scalar,
int Dim,
int Mode,
int Options>
1047 template<
typename ScalingMatrixType,
typename RotationMatrixType>
1054 sv.coeffRef(0) *= x;
1055 if(scaling) scaling->lazyAssign(svd.
matrixU() * sv.asDiagonal() * svd.
matrixU().adjoint());
1058 LinearMatrixType m(svd.
matrixU());
1060 rotation->lazyAssign(m * svd.
matrixV().adjoint());
1067 template<
typename Scalar,
int Dim,
int Mode,
int Options>
1068 template<
typename PositionDerived,
typename OrientationType,
typename ScaleDerived>
1073 linear() = internal::toRotationMatrix<Scalar,Dim>(orientation);
1075 translation() = position;
1083 template<
typename TransformType,
int Mode=TransformType::Mode>
1086 static inline void run(
const TransformType&, TransformType&)
1090 template<
typename TransformType>
1093 static inline void run(
const TransformType& m, TransformType& res)
1095 res.matrix() = m.matrix().inverse();
1122 template<
typename Scalar,
int Dim,
int Mode,
int Options>
1135 res.
matrix().template topLeftCorner<Dim,Dim>() = linear().transpose();
1139 res.
matrix().template topLeftCorner<Dim,Dim>() = linear().inverse();
1143 eigen_assert(
false &&
"Invalid transform traits in Transform::Inverse");
1146 res.
matrix().template topRightCorner<Dim,1>()
1147 = - res.
matrix().template topLeftCorner<Dim,Dim>() * translation();
1163 static inline AffinePart
run(MatrixType& m)
1164 {
return m.template block<TransformType::Dim,TransformType::HDim>(0,0); }
1165 static inline ConstAffinePart
run(
const MatrixType& m)
1166 {
return m.template block<TransformType::Dim,TransformType::HDim>(0,0); }
1169 template<
typename Scalar,
int Dim,
int Options>
1172 static inline MatrixType&
run(MatrixType& m) {
return m; }
1173 static inline const MatrixType&
run(
const MatrixType& m) {
return m; }
1180 template<
typename Other,
int Mode,
int Options,
int Dim,
int HDim>
1185 transform->
linear() = other;
1191 template<
typename Other,
int Mode,
int Options,
int Dim,
int HDim>
1196 transform->
affine() = other;
1201 template<
typename Other,
int Mode,
int Options,
int Dim,
int HDim>
1205 { transform->
matrix() = other; }
1208 template<
typename Other,
int Options,
int Dim,
int HDim>
1212 { transform->
matrix() = other.template block<Dim,HDim>(0,0); }
1219 template<
int LhsMode,
int RhsMode>
1232 template<
typename TransformType,
typename MatrixType >
1239 return T.matrix() * other;
1243 template<
typename TransformType,
typename MatrixType >
1249 OtherRows = MatrixType::RowsAtCompileTime,
1250 OtherCols = MatrixType::ColsAtCompileTime
1261 ResultType res(other.rows(),other.cols());
1262 TopLeftLhs(res, 0, 0,
Dim, other.cols()).noalias() = T.affine() * other;
1263 res.row(OtherRows-1) = other.row(OtherRows-1);
1269 template<
typename TransformType,
typename MatrixType >
1275 OtherRows = MatrixType::RowsAtCompileTime,
1276 OtherCols = MatrixType::ColsAtCompileTime
1287 TopLeftLhs(res, 0, 0,
Dim, other.cols()).noalias() += T.linear() * other;
1298 template<
typename Other,
int Mode,
int Options,
int Dim,
int HDim>
1304 static ResultType
run(
const Other& other,
const TransformType& tr)
1305 {
return ResultType(other * tr.
matrix()); }
1309 template<
typename Other,
int Options,
int Dim,
int HDim>
1315 static ResultType
run(
const Other& other,
const TransformType& tr)
1318 res.
matrix().noalias() = other.template block<HDim,Dim>(0,0) * tr.
matrix();
1325 template<
typename Other,
int Mode,
int Options,
int Dim,
int HDim>
1331 static ResultType
run(
const Other& other,
const TransformType& tr)
1341 template<
typename Other,
int Options,
int Dim,
int HDim>
1347 static ResultType
run(
const Other& other,
const TransformType& tr)
1350 res.
matrix().noalias() = other.template block<Dim,Dim>(0,0) * tr.
matrix();
1357 template<
typename Other,
int Mode,
int Options,
int Dim,
int HDim>
1363 static ResultType
run(
const Other& other,
const TransformType& tr)
1368 res.
matrix().template topRows<Dim>().noalias()
1369 = other * tr.
matrix().template topRows<Dim>();
1378 template<
typename Scalar,
int Dim,
int LhsMode,
int LhsOptions,
int RhsMode,
int RhsOptions>
1385 static ResultType
run(
const Lhs& lhs,
const Rhs& rhs)
1395 template<
typename Scalar,
int Dim,
int LhsMode,
int LhsOptions,
int RhsMode,
int RhsOptions>
1401 static ResultType
run(
const Lhs& lhs,
const Rhs& rhs)
1407 template<
typename Scalar,
int Dim,
int LhsOptions,
int RhsOptions>
1413 static ResultType
run(
const Lhs& lhs,
const Rhs& rhs)
1422 template<
typename Scalar,
int Dim,
int LhsOptions,
int RhsOptions>
1428 static ResultType
run(
const Lhs& lhs,
const Rhs& rhs)
1430 ResultType res(lhs.
matrix().template leftCols<Dim>() * rhs.
matrix());
1440 #endif // EIGEN_TRANSFORM_H
#define EIGEN_STRONG_INLINE
Transform< float, 3, Affine > Affine3f
Transform< double, 2, AffineCompact > AffineCompact2d
const VectorType & vector() const
Represents a diagonal matrix with its storage.
Holds information about the various numeric (i.e. scalar) types allowed by Eigen. ...
const internal::permut_matrix_product_retval< PermutationDerived, Derived, OnTheRight > operator*(const MatrixBase< Derived > &matrix, const PermutationBase< PermutationDerived > &permutation)
#define EIGEN_STATIC_ASSERT(CONDITION, MSG)
const SingularValuesType & singularValues() const
Represents a translation transformation.
Transform< double, 2, Projective > Projective2d
const CwiseUnaryOp< internal::scalar_inverse_op< Scalar >, const Derived > inverse() const
Transform< float, 2, AffineCompact > AffineCompact2f
EIGEN_STRONG_INLINE const Scalar & coeff(Index rowId, Index colId) const
Transform< double, 3, Affine > Affine3d
Expression of the multiple replication of a matrix or vector.
Common base class for compact rotation representations.
Transform< double, 3, Isometry > Isometry3d
TFSIMD_FORCE_INLINE const tfScalar & x() const
Transform< float, 2, Projective > Projective2f
Derived & setZero(Index size)
Transform< float, 3, Projective > Projective3f
EIGEN_DEFAULT_DENSE_INDEX_TYPE DenseIndex
EIGEN_STRONG_INLINE const Scalar * data() const
Transform< float, 3, AffineCompact > AffineCompact3f
Transform< double, 3, AffineCompact > AffineCompact3d
Transform< float, 2, Affine > Affine2f
Transform< float, 3, Isometry > Isometry3f
Expression of a fixed-size or dynamic-size block.
Transform< double, 2, Affine > Affine2d
Transform< double, 2, Isometry > Isometry2d
TFSIMD_FORCE_INLINE Vector3 rotate(const Vector3 &wAxis, const tfScalar angle) const
Two-sided Jacobi SVD decomposition of a rectangular matrix.
const Derived & derived() const
const MatrixUType & matrixU() const
#define EIGEN_IMPLIES(a, b)
const DiagonalWrapper< const Derived > asDiagonal() const
The matrix class, also used for vectors and row-vectors.
void evalTo(Dest &dst) const
Base class for all dense matrices, vectors, and expressions.
const MatrixVType & matrixV() const
RotationMatrixType toRotationMatrix() const
Transform< float, 2, Isometry > Isometry2f
Transform< double, 3, Projective > Projective3d
#define EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(TYPE, SIZE)