12 #ifndef EIGEN_TRANSFORM_H
13 #define EIGEN_TRANSFORM_H
22 template <
typename Transform>
32 template <
typename TransformType,
typename MatrixType,
36 int RhsCols = MatrixType::ColsAtCompileTime>
39 template <
typename Other,
int Mode,
int Options,
int Dim,
int HDim,
int OtherRows = Other::RowsAtCompileTime,
40 int OtherCols = Other::ColsAtCompileTime>
43 template <
typename Lhs,
typename Rhs,
47 template <
typename Other,
int Mode,
int Options,
int Dim,
int HDim,
int OtherRows = Other::RowsAtCompileTime,
48 int OtherCols = Other::ColsAtCompileTime>
51 template <
typename TransformType>
54 template <
typename Scalar_,
int Dim_,
int Mode_,
int Options_>
62 ColsAtCompileTime = Dim1,
63 MaxRowsAtCompileTime = RowsAtCompileTime,
64 MaxColsAtCompileTime = ColsAtCompileTime,
70 struct transform_make_affine;
191 template <
typename Scalar_,
int Dim_,
int Mode_,
int Options_>
259 template <
typename Derived>
268 template <
typename OtherDerived>
272 YOU_MIXED_DIFFERENT_NUMERIC_TYPES__YOU_NEED_TO_USE_THE_CAST_METHOD_OF_MATRIXBASE_TO_CAST_NUMERIC_TYPES_EXPLICITLY);
279 template <
typename OtherDerived>
283 YOU_MIXED_DIFFERENT_NUMERIC_TYPES__YOU_NEED_TO_USE_THE_CAST_METHOD_OF_MATRIXBASE_TO_CAST_NUMERIC_TYPES_EXPLICITLY);
289 template <
int OtherOptions>
296 template <
int OtherMode,
int OtherOptions>
302 YOU_PERFORMED_AN_INVALID_TRANSFORMATION_CONVERSION)
308 YOU_PERFORMED_AN_INVALID_TRANSFORMATION_CONVERSION)
319 m_matrix.template block<Dim, Dim + 1>(0, 0) = other.
matrix().template block<Dim, Dim + 1>(0, 0);
333 template <
typename OtherDerived>
339 template <
typename OtherDerived>
345 #ifdef EIGEN_QT_SUPPORT
346 #if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
349 inline QMatrix toQMatrix(
void)
const;
351 inline Transform(
const QTransform& other);
353 inline QTransform toQTransform(
void)
const;
414 template <
typename OtherDerived>
416 OtherDerived>::ResultType
428 template <
typename OtherDerived>
430 Dim_, Dim_ + 1>::ResultType
441 template <
typename DiagonalDerived>
445 res.linearExt() *=
b;
455 template <
typename DiagonalDerived>
459 res.linear().noalias() =
a *
b.linear();
460 res.translation().noalias() =
a *
b.translation();
465 template <
typename OtherDerived>
467 return *
this = *
this * other;
485 template <
int OtherMode,
int OtherOptions>
486 struct icc_11_workaround {
489 typedef typename ProductType::ResultType ResultType;
494 template <
int OtherMode,
int OtherOptions>
495 inline typename icc_11_workaround<OtherMode, OtherOptions>::ResultType
operator*(
496 const Transform<Scalar, Dim, OtherMode, OtherOptions>& other)
const {
497 typedef typename icc_11_workaround<OtherMode, OtherOptions>::ProductType ProductType;
502 template <
int OtherMode,
int OtherOptions>
504 typename internal::transform_transform_product_impl<
Transform,
505 Transform<Scalar, Dim, OtherMode, OtherOptions> >::ResultType
521 template <
typename OtherDerived>
524 template <
typename OtherDerived>
530 template <
typename OtherDerived>
533 template <
typename OtherDerived>
536 template <
typename RotationType>
539 template <
typename RotationType>
557 res.scale(
s.factor());
566 template <
typename Derived>
568 template <
typename Derived>
570 return rotate(
r.toRotationMatrix());
572 template <
typename Derived>
578 template <
typename RotationMatrixType,
typename ScalingMatrixType>
580 template <
typename ScalingMatrixType,
typename RotationMatrixType>
583 template <
typename PositionDerived,
typename OrientationType,
typename ScaleDerived>
585 const OrientationType& orientation,
600 template <
typename NewScalarType>
608 template <
typename OtherScalarType>
632 return m_matrix.template block < int(Mode) == int(Projective) ? HDim : Dim, Dim > (0, 0);
639 return m_matrix.template block < int(Mode) == int(Projective) ? HDim : Dim, Dim > (0, 0);
647 return m_matrix.template block < int(Mode) == int(Projective) ? HDim : Dim, 1 > (0,
Dim);
655 return m_matrix.template block < int(Mode) == int(Projective) ? HDim : Dim, 1 > (0,
Dim);
658 #ifdef EIGEN_TRANSFORM_PLUGIN
659 #include EIGEN_TRANSFORM_PLUGIN
663 #ifndef EIGEN_PARSED_BY_DOXYGEN
710 #ifdef EIGEN_QT_SUPPORT
712 #if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
717 template <
typename Scalar,
int Dim,
int Mode,
int Options>
719 check_template_params();
727 template <
typename Scalar,
int Dim,
int Mode,
int Options>
731 m_matrix << other.m11(), other.m21(), other.dx(), other.m12(), other.m22(), other.dy();
733 m_matrix << other.m11(), other.m21(), other.dx(), other.m12(), other.m22(), other.dy(), 0, 0, 1;
743 template <
typename Scalar,
int Dim,
int Mode,
int Options>
744 QMatrix Transform<Scalar, Dim, Mode, Options>::toQMatrix(
void)
const {
745 check_template_params();
747 return QMatrix(m_matrix.
coeff(0, 0), m_matrix.
coeff(1, 0), m_matrix.
coeff(0, 1), m_matrix.
coeff(1, 1),
756 template <
typename Scalar,
int Dim,
int Mode,
int Options>
758 check_template_params();
766 template <
typename Scalar,
int Dim,
int Mode,
int Options>
768 check_template_params();
771 m_matrix << other.m11(), other.m21(), other.dx(), other.m12(), other.m22(), other.dy();
773 m_matrix << other.m11(), other.m21(), other.dx(), other.m12(), other.m22(), other.dy(), other.m13(), other.m23(),
782 template <
typename Scalar,
int Dim,
int Mode,
int Options>
783 QTransform Transform<Scalar, Dim, Mode, Options>::toQTransform(
void)
const {
786 return QTransform(m_matrix.
coeff(0, 0), m_matrix.
coeff(1, 0), m_matrix.
coeff(0, 1), m_matrix.
coeff(1, 1),
789 return QTransform(m_matrix.
coeff(0, 0), m_matrix.
coeff(1, 0), m_matrix.
coeff(2, 0), m_matrix.
coeff(0, 1),
791 m_matrix.
coeff(2, 2));
803 template <
typename Scalar,
int Dim,
int Mode,
int Options>
804 template <
typename OtherDerived>
809 linearExt().noalias() = (linearExt() * other.
asDiagonal());
817 template <
typename Scalar,
int Dim,
int Mode,
int Options>
829 template <
typename Scalar,
int Dim,
int Mode,
int Options>
830 template <
typename OtherDerived>
835 affine().noalias() = (other.
asDiagonal() * affine());
843 template <
typename Scalar,
int Dim,
int Mode,
int Options>
847 m_matrix.template topRows<Dim>() *=
s;
855 template <
typename Scalar,
int Dim,
int Mode,
int Options>
856 template <
typename OtherDerived>
860 translationExt() += linearExt() * other;
868 template <
typename Scalar,
int Dim,
int Mode,
int Options>
869 template <
typename OtherDerived>
874 affine() += other * m_matrix.row(
Dim);
876 translation() += other;
897 template <
typename Scalar,
int Dim,
int Mode,
int Options>
898 template <
typename RotationType>
900 const RotationType& rotation) {
901 linearExt() *= internal::toRotationMatrix<Scalar, Dim>(rotation);
912 template <
typename Scalar,
int Dim,
int Mode,
int Options>
913 template <
typename RotationType>
915 const RotationType& rotation) {
916 m_matrix.template block<Dim, HDim>(0, 0) =
917 internal::toRotationMatrix<Scalar, Dim>(rotation) * m_matrix.template block<Dim, HDim>(0, 0);
926 template <
typename Scalar,
int Dim,
int Mode,
int Options>
932 linear() << linear().col(0) + linear().col(1) * sx,
tmp;
941 template <
typename Scalar,
int Dim,
int Mode,
int Options>
946 m_matrix.template block<Dim, HDim>(0, 0) =
947 LinearMatrixType({{1, sy}, {sx, 1}}) * m_matrix.template block<Dim, HDim>(0, 0);
955 template <
typename Scalar,
int Dim,
int Mode,
int Options>
959 translation() =
t.vector();
964 template <
typename Scalar,
int Dim,
int Mode,
int Options>
968 res.translate(
t.vector());
972 template <
typename Scalar,
int Dim,
int Mode,
int Options>
976 linear().diagonal().fill(
s.factor());
981 template <
typename Scalar,
int Dim,
int Mode,
int Options>
982 template <
typename Derived>
985 linear() = internal::toRotationMatrix<Scalar, Dim>(
r);
986 translation().setZero();
991 template <
typename Scalar,
int Dim,
int Mode,
int Options>
992 template <
typename Derived>
996 res.rotate(
r.derived());
1007 template <
typename TransformType>
1009 typedef typename TransformType::LinearMatrixType LinearMatrixType;
1010 LinearMatrixType result;
1011 t.computeRotationScaling(&result, (LinearMatrixType*)0);
1017 template <
typename TransformType>
1033 template <
typename Scalar,
int Dim,
int Mode,
int Options>
1050 template <
typename Scalar,
int Dim,
int Mode,
int Options>
1051 template <
typename RotationMatrixType,
typename ScalingMatrixType>
1053 ScalingMatrixType* scaling)
const {
1062 if (scaling) *scaling =
svd.matrixV() * sv.asDiagonal() *
svd.matrixV().adjoint();
1065 m.col(
Dim - 1) *=
x;
1066 *rotation =
m *
svd.matrixV().adjoint();
1081 template <
typename Scalar,
int Dim,
int Mode,
int Options>
1082 template <
typename ScalingMatrixType,
typename RotationMatrixType>
1084 ScalingMatrixType* scaling, RotationMatrixType* rotation)
const {
1093 if (scaling) *scaling =
svd.matrixU() * sv.asDiagonal() *
svd.matrixU().adjoint();
1096 m.col(
Dim - 1) *=
x;
1097 *rotation =
m *
svd.matrixV().adjoint();
1104 template <
typename Scalar,
int Dim,
int Mode,
int Options>
1105 template <
typename PositionDerived,
typename OrientationType,
typename ScaleDerived>
1108 const OrientationType& orientation,
1110 linear() = internal::toRotationMatrix<Scalar, Dim>(orientation);
1112 translation() = position;
1121 template <
typename MatrixType>
1123 static const int Dim = MatrixType::ColsAtCompileTime - 1;
1131 template <
typename MatrixType>
1136 template <
typename TransformType,
int Mode = TransformType::Mode>
1141 template <
typename TransformType>
1144 res.matrix() =
m.matrix().inverse();
1170 template <
typename Scalar,
int Dim,
int Mode,
int Options>
1178 res.matrix().template topLeftCorner<Dim, Dim>() = linear().transpose();
1179 }
else if (hint &
Affine) {
1180 res.matrix().template topLeftCorner<Dim, Dim>() = linear().inverse();
1182 eigen_assert(
false &&
"Invalid transform traits in Transform::Inverse");
1185 res.matrix().template topRightCorner<Dim, 1>() = -
res.matrix().template topLeftCorner<Dim, Dim>() * translation();
1197 template <
typename TransformType>
1203 return m.template block<TransformType::Dim, TransformType::HDim>(0, 0);
1206 return m.template block<TransformType::Dim, TransformType::HDim>(0, 0);
1210 template <
typename Scalar,
int Dim,
int Options>
1221 template <
typename Other,
int Mode,
int Options,
int Dim,
int HDim>
1231 template <
typename Other,
int Mode,
int Options,
int Dim,
int HDim>
1240 template <
typename Other,
int Mode,
int Options,
int Dim,
int HDim>
1248 template <
typename Other,
int Options,
int Dim,
int HDim>
1252 transform->matrix() = other.template block<Dim, HDim>(0, 0);
1260 template <
int LhsMode,
int RhsMode>
1271 template <
typename TransformType,
typename MatrixType,
int RhsCols>
1276 return T.matrix() * other;
1280 template <
typename TransformType,
typename MatrixType,
int RhsCols>
1284 HDim = TransformType::HDim,
1285 OtherRows = MatrixType::RowsAtCompileTime,
1286 OtherCols = MatrixType::ColsAtCompileTime
1297 TopLeftLhs(
res, 0, 0,
Dim, other.cols()).noalias() =
T.affine() * other;
1298 res.row(OtherRows - 1) = other.row(OtherRows - 1);
1304 template <
typename TransformType,
typename MatrixType,
int RhsCols>
1308 HDim = TransformType::HDim,
1309 OtherRows = MatrixType::RowsAtCompileTime,
1310 OtherCols = MatrixType::ColsAtCompileTime
1321 TopLeftLhs(
res, 0, 0,
Dim, other.cols()).noalias() +=
T.linear() * other;
1327 template <
typename TransformType,
typename MatrixType>
1333 HDim = TransformType::HDim,
1334 OtherRows = MatrixType::RowsAtCompileTime,
1335 WorkingRows =
plain_enum_min(TransformMatrix::RowsAtCompileTime, HDim)
1344 rhs.template head<Dim>() = other;
1347 return res.template head<Dim>();
1356 template <
typename Other,
int Mode,
int Options,
int Dim,
int HDim>
1367 template <
typename Other,
int Options,
int Dim,
int HDim>
1374 res.matrix().noalias() = other.template block<HDim, Dim>(0, 0) * tr.
matrix();
1375 res.matrix().col(
Dim) += other.col(
Dim);
1381 template <
typename Other,
int Mode,
int Options,
int Dim,
int HDim>
1388 res.affine().noalias() = other * tr.
matrix();
1395 template <
typename Other,
int Options,
int Dim,
int HDim>
1402 res.matrix().noalias() = other.template block<Dim, Dim>(0, 0) * tr.
matrix();
1403 res.translation() += other.col(
Dim);
1409 template <
typename Other,
int Mode,
int Options,
int Dim,
int HDim>
1417 res.matrix().template topRows<Dim>().noalias() = other * tr.
matrix().template topRows<Dim>();
1426 template <
typename Scalar,
int Dim,
int LhsMode,
int LhsOptions,
int RhsMode,
int RhsOptions>
1442 template <
typename Scalar,
int Dim,
int LhsMode,
int LhsOptions,
int RhsMode,
int RhsOptions>
1453 template <
typename Scalar,
int Dim,
int LhsOptions,
int RhsOptions>
1467 template <
typename Scalar,
int Dim,
int LhsOptions,
int RhsOptions>
cout<< "Here is the matrix m:"<< endl<< m<< endl;JacobiSVD< MatrixXf, ComputeThinU|ComputeThinV > svd(m)
#define EIGEN_CONST_CONDITIONAL(cond)
Definition: Macros.h:1060
#define EIGEN_NOEXCEPT
Definition: Macros.h:1267
#define EIGEN_CONSTEXPR
Definition: Macros.h:758
#define EIGEN_DEVICE_FUNC
Definition: Macros.h:892
#define eigen_assert(x)
Definition: Macros.h:910
#define EIGEN_STRONG_INLINE
Definition: Macros.h:834
cout<< "Here is the matrix m:"<< endl<< m<< endl;Matrix< ptrdiff_t, 3, 1 > res
Definition: PartialRedux_count.cpp:3
#define EIGEN_STATIC_ASSERT(X, MSG)
Definition: StaticAssert.h:26
#define EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(TYPE, SIZE)
Definition: StaticAssert.h:50
Scalar * b
Definition: benchVecAdd.cpp:17
SCALAR Scalar
Definition: bench_gemm.cpp:45
MatrixXf MatrixType
Definition: benchmark-blocking-sizes.cpp:52
Expression of a fixed-size or dynamic-size block.
Definition: Block.h:110
Base class for diagonal matrices and expressions.
Definition: DiagonalMatrix.h:33
Represents a diagonal matrix with its storage.
Definition: DiagonalMatrix.h:172
Two-sided Jacobi SVD decomposition of a rectangular matrix.
Definition: JacobiSVD.h:500
Base class for all dense matrices, vectors, and expressions.
Definition: MatrixBase.h:52
EIGEN_DEVICE_FUNC const DiagonalWrapper< const Derived > asDiagonal() const
Definition: DiagonalMatrix.h:347
The matrix class, also used for vectors and row-vectors.
Definition: Eigen/Eigen/src/Core/Matrix.h:186
EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE Scalar & coeffRef(Index rowId, Index colId)
Definition: PlainObjectBase.h:217
EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE const Scalar & coeff(Index rowId, Index colId) const
Definition: PlainObjectBase.h:198
constexpr EIGEN_DEVICE_FUNC const Scalar * data() const
Definition: PlainObjectBase.h:273
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE EIGEN_CONSTEXPR Index cols() const EIGEN_NOEXCEPT
Definition: PlainObjectBase.h:192
EIGEN_DEVICE_FUNC Derived & setZero(Index size)
Definition: CwiseNullaryOp.h:569
Expression of the multiple replication of a matrix or vector.
Definition: Replicate.h:64
Definition: ReturnByValue.h:50
EIGEN_DEVICE_FUNC void evalTo(Dest &dst) const
Definition: ReturnByValue.h:58
Common base class for compact rotation representations.
Definition: RotationBase.h:32
void setZero()
Definition: SparseMatrix.h:303
Scalar & coeffRef(Index row, Index col)
Definition: SparseMatrix.h:275
Represents a translation transformation.
Definition: Translation.h:33
void determinant(const MatrixType &m)
Definition: determinant.cpp:15
EIGEN_DONT_INLINE void transform(const Transformation &t, Data &data)
Definition: geometry.cpp:25
Transform< double, 3, Affine > Affine3d
Definition: Transform.h:686
Transform< float, 2, Projective > Projective2f
Definition: Transform.h:698
Transform< float, 2, AffineCompact > AffineCompact2f
Definition: Transform.h:689
Transform< double, 3, Projective > Projective3d
Definition: Transform.h:704
Transform< double, 3, Isometry > Isometry3d
Definition: Transform.h:677
Transform< float, 3, Affine > Affine3f
Definition: Transform.h:682
Transform< float, 2, Affine > Affine2f
Definition: Transform.h:680
Transform< float, 3, Projective > Projective3f
Definition: Transform.h:700
Transform< double, 2, AffineCompact > AffineCompact2d
Definition: Transform.h:693
Transform< float, 2, Isometry > Isometry2f
Definition: Transform.h:671
Transform< double, 2, Affine > Affine2d
Definition: Transform.h:684
Transform< float, 3, AffineCompact > AffineCompact3f
Definition: Transform.h:691
Transform< double, 2, Isometry > Isometry2d
Definition: Transform.h:675
Transform< float, 3, Isometry > Isometry3f
Definition: Transform.h:673
Transform< double, 2, Projective > Projective2d
Definition: Transform.h:702
Transform< double, 3, AffineCompact > AffineCompact3d
Definition: Transform.h:695
TransformTraits
Definition: Constants.h:453
@ DontAlign
Definition: Constants.h:324
@ RowMajor
Definition: Constants.h:320
@ Affine
Definition: Constants.h:458
@ Projective
Definition: Constants.h:462
@ AffineCompact
Definition: Constants.h:460
@ Isometry
Definition: Constants.h:455
const unsigned int RowMajorBit
Definition: Constants.h:70
RealScalar s
Definition: level1_cplx_impl.h:130
const Scalar * a
Definition: level2_cplx_impl.h:32
int * m
Definition: level2_cplx_impl.h:294
Eigen::Matrix< Scalar, Dynamic, Dynamic, ColMajor > tmp
Definition: level3_impl.h:365
constexpr int plain_enum_min(A a, B b)
Definition: Meta.h:649
@ Lhs
Definition: TensorContractionMapper.h:20
@ Rhs
Definition: TensorContractionMapper.h:20
constexpr bool check_implication(bool a, bool b)
Definition: Meta.h:740
Namespace containing all symbols from the Eigen library.
Definition: bench_norm.cpp:70
auto run(Kernel kernel, Args &&... args) -> decltype(kernel(args...))
Definition: gpu_test_helper.h:414
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
The Index type as used for the API.
Definition: Meta.h:83
const int Dynamic
Definition: Constants.h:25
Extend namespace for flags.
Definition: fsi_chan_precond_driver.cc:56
int Case
What case are we considering: Choose one from the enumeration Cases.
Definition: common_young_laplace_stuff.h:53
static const unsigned Dim
Problem dimension.
Definition: two_d_tilted_square.cc:62
type
Definition: compute_granudrum_aor.py:141
Definition: Eigen_Colamd.h:49
list x
Definition: plotDoE.py:28
t
Definition: plotPSD.py:36
Definition: Constants.h:519
Definition: EigenBase.h:33
constexpr EIGEN_DEVICE_FUNC Derived & derived()
Definition: EigenBase.h:49
Holds information about the various numeric (i.e. scalar) types allowed by Eigen.
Definition: NumTraits.h:217
Definition: XprHelper.h:583
Definition: ForwardDeclarations.h:21
void run(const string &dir_name, LinearSolver *linear_solver_pt, const unsigned nel_1d, bool mess_up_order)
Definition: two_d_poisson_compare_solvers.cc:317