12#ifndef EIGEN_TRANSFORM_H
13#define EIGEN_TRANSFORM_H
19template<
typename Transform>
20struct transform_traits
25 HDim = Transform::HDim,
26 Mode = Transform::Mode,
31template<
typename TransformType,
33 int Case = transform_traits<TransformType>::IsProjective ? 0
34 : int(MatrixType::RowsAtCompileTime) == int(transform_traits<TransformType>::HDim) ? 1
36struct transform_right_product_impl;
38template<
typename Other,
43 int OtherRows=Other::RowsAtCompileTime,
44 int OtherCols=Other::ColsAtCompileTime>
45struct transform_left_product_impl;
47template<
typename Lhs,
50 transform_traits<Lhs>::IsProjective ||
51 transform_traits<Rhs>::IsProjective>
52struct transform_transform_product_impl;
54template<
typename Other,
59 int OtherRows=Other::RowsAtCompileTime,
60 int OtherCols=Other::ColsAtCompileTime>
61struct transform_construct_from_matrix;
63template<
typename TransformType>
struct transform_take_affine_part;
175template<
typename _Scalar,
int _Dim,
int _Mode,
int _Options>
189 typedef DenseIndex Index;
191 typedef typename internal::make_proper_matrix_type<Scalar,Rows,HDim,Options>::type
MatrixType;
201 typedef typename internal::conditional<int(Mode)==int(
AffineCompact),
205 typedef typename internal::conditional<int(Mode)==int(
AffineCompact),
218 enum { TransformTimeDiagonalMode = ((Mode==int(
Isometry))?
Affine:int(Mode)) };
232 check_template_params();
239 check_template_params();
240 m_matrix = other.m_matrix;
245 check_template_params();
248 inline explicit Transform(
const UniformScaling<Scalar>& s)
250 check_template_params();
253 template<
typename Derived>
254 inline explicit Transform(
const RotationBase<Derived, Dim>& r)
256 check_template_params();
261 { m_matrix = other.m_matrix;
return *
this; }
263 typedef internal::transform_take_affine_part<Transform> take_affine_part;
266 template<
typename OtherDerived>
269 EIGEN_STATIC_ASSERT((internal::is_same<Scalar,typename OtherDerived::Scalar>::value),
270 YOU_MIXED_DIFFERENT_NUMERIC_TYPES__YOU_NEED_TO_USE_THE_CAST_METHOD_OF_MATRIXBASE_TO_CAST_NUMERIC_TYPES_EXPLICITLY);
272 check_template_params();
273 internal::transform_construct_from_matrix<OtherDerived,Mode,Options,Dim,HDim>::run(
this, other.
derived());
277 template<
typename OtherDerived>
280 EIGEN_STATIC_ASSERT((internal::is_same<Scalar,typename OtherDerived::Scalar>::value),
281 YOU_MIXED_DIFFERENT_NUMERIC_TYPES__YOU_NEED_TO_USE_THE_CAST_METHOD_OF_MATRIXBASE_TO_CAST_NUMERIC_TYPES_EXPLICITLY);
283 internal::transform_construct_from_matrix<OtherDerived,Mode,Options,Dim,HDim>::run(
this, other.
derived());
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)
324 internal::transform_construct_from_matrix<OtherMatrixType,Mode,Options,Dim,HDim>::run(
this, other.matrix());
331 linear() = other.linear();
336 template<
typename OtherDerived>
337 Transform(
const ReturnByValue<OtherDerived>& other)
339 check_template_params();
343 template<
typename OtherDerived>
344 Transform& operator=(
const ReturnByValue<OtherDerived>& other)
350 #ifdef EIGEN_QT_SUPPORT
398 template<
typename OtherDerived>
399 EIGEN_STRONG_INLINE
const typename internal::transform_right_product_impl<Transform, OtherDerived>::ResultType
401 {
return internal::transform_right_product_impl<Transform, OtherDerived>::run(*
this,other.
derived()); }
410 template<
typename OtherDerived>
friend
411 inline const typename internal::transform_left_product_impl<OtherDerived,Mode,Options,_Dim,_Dim+1>::ResultType
413 {
return internal::transform_left_product_impl<OtherDerived,Mode,Options,Dim,HDim>::run(a.
derived(),b); }
421 template<
typename DiagonalDerived>
436 template<
typename DiagonalDerived>
448 template<
typename OtherDerived>
454 return internal::transform_transform_product_impl<Transform,Transform>::run(*
this,other);
457 #ifdef __INTEL_COMPILER
466 template<
int OtherMode,
int OtherOptions>
struct icc_11_workaround
468 typedef internal::transform_transform_product_impl<Transform,Transform<Scalar,Dim,OtherMode,OtherOptions> > ProductType;
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>
484 inline typename internal::transform_transform_product_impl<Transform,Transform<Scalar,Dim,OtherMode,OtherOptions> >::ResultType
487 return internal::transform_transform_product_impl<Transform,Transform<Scalar,Dim,OtherMode,OtherOptions> >::run(*
this,other);
503 template<
typename OtherDerived>
506 template<
typename OtherDerived>
512 template<
typename OtherDerived>
515 template<
typename OtherDerived>
518 template<
typename RotationType>
521 template<
typename RotationType>
531 inline Transform& operator=(
const UniformScaling<Scalar>& t);
532 inline Transform& operator*=(
const UniformScaling<Scalar>& s) {
return scale(s.factor()); }
536 res.scale(s.factor());
540 inline Transform& operator*=(
const DiagonalMatrix<Scalar,Dim>& s) {
linear() *= s;
return *
this; }
542 template<
typename Derived>
543 inline Transform& operator=(
const RotationBase<Derived,Dim>& r);
544 template<
typename Derived>
545 inline Transform& operator*=(
const RotationBase<Derived,Dim>& r) {
return rotate(r.toRotationMatrix()); }
546 template<
typename Derived>
550 template<
typename RotationMatrixType,
typename ScalingMatrixType>
552 template<
typename ScalingMatrixType,
typename RotationMatrixType>
555 template<
typename PositionDerived,
typename OrientationType,
typename ScaleDerived>
571 template<
typename NewScalarType>
572 inline typename internal::cast_return_type<Transform,Transform<NewScalarType,Dim,Mode,Options> >::type
cast()
const
573 {
return typename internal::cast_return_type<Transform,Transform<NewScalarType,Dim,Mode,Options> >::type(*
this); }
576 template<
typename OtherScalarType>
579 check_template_params();
587 bool isApprox(
const Transform& other,
typename NumTraits<Scalar>::Real prec = NumTraits<Scalar>::dummy_precision())
const
588 {
return m_matrix.isApprox(other.m_matrix, prec); }
606 {
return m_matrix.template block<int(Mode)==int(Projective)?HDim:Dim,Dim>(0,0); }
611 inline const Block<MatrixType,int(Mode)==int(
Projective)?HDim:Dim,Dim> linearExt()
const
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
634 static EIGEN_STRONG_INLINE
void check_template_params()
636 EIGEN_STATIC_ASSERT((Options & (DontAlign|
RowMajor)) == Options, INVALID_MATRIX_TEMPLATE_PARAMETERS)
682#ifdef EIGEN_QT_SUPPORT
687template<
typename Scalar,
int Dim,
int Mode,
int Options>
690 check_template_params();
698template<
typename Scalar,
int Dim,
int Mode,
int Options>
701 EIGEN_STATIC_ASSERT(Dim==2, YOU_MADE_A_PROGRAMMING_MISTAKE)
702 m_matrix << other.m11(), other.m21(), other.dx(),
703 other.m12(), other.m22(), other.dy(),
714template<
typename Scalar,
int Dim,
int Mode,
int Options>
717 check_template_params();
718 EIGEN_STATIC_ASSERT(Dim==2, YOU_MADE_A_PROGRAMMING_MISTAKE)
719 return QMatrix(m_matrix.coeff(0,0), m_matrix.coeff(1,0),
720 m_matrix.coeff(0,1), m_matrix.coeff(1,1),
721 m_matrix.coeff(0,2), m_matrix.coeff(1,2));
728template<
typename Scalar,
int Dim,
int Mode,
int Options>
731 check_template_params();
739template<
typename Scalar,
int Dim,
int Mode,
int Options>
742 check_template_params();
743 EIGEN_STATIC_ASSERT(Dim==2, YOU_MADE_A_PROGRAMMING_MISTAKE)
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();
758template<
typename Scalar,
int Dim,
int Mode,
int Options>
761 EIGEN_STATIC_ASSERT(Dim==2, YOU_MADE_A_PROGRAMMING_MISTAKE)
763 return QTransform(m_matrix.coeff(0,0), m_matrix.coeff(1,0),
764 m_matrix.coeff(0,1), m_matrix.coeff(1,1),
765 m_matrix.coeff(0,2), m_matrix.coeff(1,2));
767 return QTransform(m_matrix.coeff(0,0), m_matrix.coeff(1,0), m_matrix.coeff(2,0),
768 m_matrix.coeff(0,1), m_matrix.coeff(1,1), m_matrix.coeff(2,1),
769 m_matrix.coeff(0,2), m_matrix.coeff(1,2), m_matrix.coeff(2,2));
781template<
typename Scalar,
int Dim,
int Mode,
int Options>
782template<
typename OtherDerived>
786 EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(OtherDerived,
int(Dim))
787 EIGEN_STATIC_ASSERT(Mode!=
int(
Isometry), THIS_METHOD_IS_ONLY_FOR_SPECIFIC_TRANSFORMATIONS)
788 linearExt().noalias() = (linearExt() * other.
asDiagonal());
796template<
typename Scalar,
int Dim,
int Mode,
int Options>
799 EIGEN_STATIC_ASSERT(Mode!=
int(
Isometry), THIS_METHOD_IS_ONLY_FOR_SPECIFIC_TRANSFORMATIONS)
808template<
typename Scalar,
int Dim,
int Mode,
int Options>
809template<
typename OtherDerived>
813 EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(OtherDerived,
int(Dim))
814 EIGEN_STATIC_ASSERT(Mode!=
int(
Isometry), THIS_METHOD_IS_ONLY_FOR_SPECIFIC_TRANSFORMATIONS)
815 m_matrix.template block<Dim,HDim>(0,0).noalias() = (other.
asDiagonal() * m_matrix.template block<Dim,HDim>(0,0));
823template<
typename Scalar,
int Dim,
int Mode,
int Options>
826 EIGEN_STATIC_ASSERT(Mode!=
int(
Isometry), THIS_METHOD_IS_ONLY_FOR_SPECIFIC_TRANSFORMATIONS)
827 m_matrix.template topRows<Dim>() *= s;
835template<
typename Scalar,
int Dim,
int Mode,
int Options>
836template<
typename OtherDerived>
840 EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(OtherDerived,
int(Dim))
841 translationExt() += linearExt() * other;
849template<
typename Scalar,
int Dim,
int Mode,
int Options>
850template<
typename OtherDerived>
854 EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(OtherDerived,
int(Dim))
879template<
typename Scalar,
int Dim,
int Mode,
int Options>
880template<
typename RotationType>
882Transform<Scalar,Dim,Mode,Options>::rotate(
const RotationType&
rotation)
884 linearExt() *= internal::toRotationMatrix<Scalar,Dim>(
rotation);
895template<
typename Scalar,
int Dim,
int Mode,
int Options>
896template<
typename RotationType>
898Transform<Scalar,Dim,Mode,Options>::prerotate(
const RotationType&
rotation)
900 m_matrix.template block<Dim,HDim>(0,0) = internal::toRotationMatrix<Scalar,Dim>(
rotation)
901 * m_matrix.template block<Dim,HDim>(0,0);
910template<
typename Scalar,
int Dim,
int Mode,
int Options>
914 EIGEN_STATIC_ASSERT(
int(Dim)==2, YOU_MADE_A_PROGRAMMING_MISTAKE)
915 EIGEN_STATIC_ASSERT(Mode!=
int(
Isometry), THIS_METHOD_IS_ONLY_FOR_SPECIFIC_TRANSFORMATIONS)
926template<
typename Scalar,
int Dim,
int Mode,
int Options>
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 m_matrix.template block<Dim,HDim>(0,0) =
LinearMatrixType(1, sx, sy, 1) * m_matrix.template block<Dim,HDim>(0,0);
940template<
typename Scalar,
int Dim,
int Mode,
int Options>
944 translation() = t.vector();
949template<
typename Scalar,
int Dim,
int Mode,
int Options>
952 Transform res = *
this;
953 res.translate(t.vector());
957template<
typename Scalar,
int Dim,
int Mode,
int Options>
961 linear().diagonal().fill(s.factor());
966template<
typename Scalar,
int Dim,
int Mode,
int Options>
967template<
typename Derived>
970 linear() = internal::toRotationMatrix<Scalar,Dim>(r);
971 translation().setZero();
976template<
typename Scalar,
int Dim,
int Mode,
int Options>
977template<
typename Derived>
981 res.rotate(r.derived());
996template<
typename Scalar,
int Dim,
int Mode,
int Options>
1017template<
typename Scalar,
int Dim,
int Mode,
int Options>
1018template<
typename RotationMatrixType,
typename ScalingMatrixType>
1025 sv.coeffRef(0) *= x;
1046template<
typename Scalar,
int Dim,
int Mode,
int Options>
1047template<
typename ScalingMatrixType,
typename RotationMatrixType>
1054 sv.coeffRef(0) *= x;
1067template<
typename Scalar,
int Dim,
int Mode,
int Options>
1068template<
typename PositionDerived,
typename OrientationType,
typename ScaleDerived>
1073 linear() = internal::toRotationMatrix<Scalar,Dim>(orientation);
1074 linear() *= scale.asDiagonal();
1083template<
typename TransformType,
int Mode=TransformType::Mode>
1084struct projective_transform_inverse
1086 static inline void run(
const TransformType&, TransformType&)
1090template<
typename TransformType>
1091struct projective_transform_inverse<TransformType,
Projective>
1093 static inline void run(
const TransformType& m, TransformType& res)
1095 res.matrix() = m.matrix().inverse();
1122template<
typename Scalar,
int Dim,
int Mode,
int Options>
1129 internal::projective_transform_inverse<Transform>::run(*
this, res);
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>()
1159template<
typename TransformType>
struct transform_take_affine_part {
1160 typedef typename TransformType::MatrixType
MatrixType;
1161 typedef typename TransformType::AffinePart AffinePart;
1162 typedef typename TransformType::ConstAffinePart ConstAffinePart;
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); }
1169template<
typename Scalar,
int Dim,
int Options>
1170struct transform_take_affine_part<Transform<Scalar,Dim,
AffineCompact, Options> > {
1172 static inline MatrixType& run(MatrixType& m) {
return m; }
1173 static inline const MatrixType& run(
const MatrixType& m) {
return m; }
1180template<
typename Other,
int Mode,
int Options,
int Dim,
int HDim>
1181struct transform_construct_from_matrix<Other, Mode,Options,Dim,HDim, Dim,Dim>
1183 static inline void run(Transform<typename Other::Scalar,Dim,Mode,Options> *transform,
const Other& other)
1185 transform->linear() = other;
1186 transform->translation().setZero();
1187 transform->makeAffine();
1191template<
typename Other,
int Mode,
int Options,
int Dim,
int HDim>
1192struct transform_construct_from_matrix<Other, Mode,Options,Dim,HDim, Dim,HDim>
1194 static inline void run(Transform<typename Other::Scalar,Dim,Mode,Options> *transform,
const Other& other)
1196 transform->affine() = other;
1197 transform->makeAffine();
1201template<
typename Other,
int Mode,
int Options,
int Dim,
int HDim>
1202struct transform_construct_from_matrix<Other, Mode,Options,Dim,HDim, HDim,HDim>
1204 static inline void run(Transform<typename Other::Scalar,Dim,Mode,Options> *transform,
const Other& other)
1205 { transform->matrix() = other; }
1208template<
typename Other,
int Options,
int Dim,
int HDim>
1209struct transform_construct_from_matrix<Other,
AffineCompact,Options,Dim,HDim, HDim,HDim>
1211 static inline void run(Transform<typename Other::Scalar,Dim,AffineCompact,Options> *transform,
const Other& other)
1212 { transform->matrix() = other.template block<Dim,HDim>(0,0); }
1219template<
int LhsMode,
int RhsMode>
1220struct transform_product_result
1232template<
typename TransformType,
typename MatrixType >
1233struct transform_right_product_impl< TransformType, MatrixType, 0 >
1235 typedef typename MatrixType::PlainObject ResultType;
1237 static EIGEN_STRONG_INLINE ResultType run(
const TransformType& T,
const MatrixType& other)
1239 return T.matrix() * other;
1243template<
typename TransformType,
typename MatrixType >
1244struct transform_right_product_impl< TransformType, MatrixType, 1 >
1247 Dim = TransformType::Dim,
1248 HDim = TransformType::HDim,
1249 OtherRows = MatrixType::RowsAtCompileTime,
1250 OtherCols = MatrixType::ColsAtCompileTime
1253 typedef typename MatrixType::PlainObject ResultType;
1255 static EIGEN_STRONG_INLINE ResultType run(
const TransformType& T,
const MatrixType& other)
1257 EIGEN_STATIC_ASSERT(OtherRows==HDim, YOU_MIXED_MATRICES_OF_DIFFERENT_SIZES);
1259 typedef Block<ResultType, Dim, OtherCols, int(MatrixType::RowsAtCompileTime)==Dim> TopLeftLhs;
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);
1269template<
typename TransformType,
typename MatrixType >
1270struct transform_right_product_impl< TransformType, MatrixType, 2 >
1273 Dim = TransformType::Dim,
1274 HDim = TransformType::HDim,
1275 OtherRows = MatrixType::RowsAtCompileTime,
1276 OtherCols = MatrixType::ColsAtCompileTime
1279 typedef typename MatrixType::PlainObject ResultType;
1281 static EIGEN_STRONG_INLINE ResultType run(
const TransformType& T,
const MatrixType& other)
1283 EIGEN_STATIC_ASSERT(OtherRows==Dim, YOU_MIXED_MATRICES_OF_DIFFERENT_SIZES);
1285 typedef Block<ResultType, Dim, OtherCols, true> TopLeftLhs;
1286 ResultType res(Replicate<typename TransformType::ConstTranslationPart, 1, OtherCols>(T.translation(),1,other.cols()));
1287 TopLeftLhs(res, 0, 0, Dim, other.cols()).noalias() += T.linear() * other;
1298template<
typename Other,
int Mode,
int Options,
int Dim,
int HDim>
1299struct transform_left_product_impl<Other,Mode,Options,Dim,HDim, HDim,HDim>
1301 typedef Transform<typename Other::Scalar,Dim,Mode,Options> TransformType;
1302 typedef typename TransformType::MatrixType MatrixType;
1303 typedef Transform<typename Other::Scalar,Dim,Projective,Options> ResultType;
1304 static ResultType run(
const Other& other,
const TransformType& tr)
1305 {
return ResultType(other * tr.matrix()); }
1309template<
typename Other,
int Options,
int Dim,
int HDim>
1310struct transform_left_product_impl<Other,
AffineCompact,Options,Dim,HDim, HDim,HDim>
1312 typedef Transform<typename Other::Scalar,Dim,AffineCompact,Options> TransformType;
1313 typedef typename TransformType::MatrixType MatrixType;
1314 typedef Transform<typename Other::Scalar,Dim,Projective,Options> ResultType;
1315 static ResultType run(
const Other& other,
const TransformType& tr)
1318 res.matrix().noalias() = other.template block<HDim,Dim>(0,0) * tr.matrix();
1319 res.matrix().col(Dim) += other.col(Dim);
1325template<
typename Other,
int Mode,
int Options,
int Dim,
int HDim>
1326struct transform_left_product_impl<Other,Mode,Options,Dim,HDim, Dim,HDim>
1328 typedef Transform<typename Other::Scalar,Dim,Mode,Options> TransformType;
1329 typedef typename TransformType::MatrixType MatrixType;
1330 typedef TransformType ResultType;
1331 static ResultType run(
const Other& other,
const TransformType& tr)
1334 res.affine().noalias() = other * tr.matrix();
1335 res.matrix().row(Dim) = tr.matrix().row(Dim);
1341template<
typename Other,
int Options,
int Dim,
int HDim>
1342struct transform_left_product_impl<Other,
AffineCompact,Options,Dim,HDim, Dim,HDim>
1344 typedef Transform<typename Other::Scalar,Dim,AffineCompact,Options> TransformType;
1345 typedef typename TransformType::MatrixType MatrixType;
1346 typedef TransformType ResultType;
1347 static ResultType run(
const Other& other,
const TransformType& tr)
1350 res.matrix().noalias() = other.template block<Dim,Dim>(0,0) * tr.matrix();
1351 res.translation() += other.col(Dim);
1357template<
typename Other,
int Mode,
int Options,
int Dim,
int HDim>
1358struct transform_left_product_impl<Other,Mode,Options,Dim,HDim, Dim,Dim>
1360 typedef Transform<typename Other::Scalar,Dim,Mode,Options> TransformType;
1361 typedef typename TransformType::MatrixType MatrixType;
1362 typedef TransformType ResultType;
1363 static ResultType run(
const Other& other,
const TransformType& tr)
1366 if(Mode!=
int(AffineCompact))
1367 res.matrix().row(Dim) = tr.matrix().row(Dim);
1368 res.matrix().template topRows<Dim>().noalias()
1369 = other * tr.matrix().template topRows<Dim>();
1378template<
typename Scalar,
int Dim,
int LhsMode,
int LhsOptions,
int RhsMode,
int RhsOptions>
1379struct transform_transform_product_impl<Transform<Scalar,Dim,LhsMode,LhsOptions>,Transform<Scalar,Dim,RhsMode,RhsOptions>,false >
1381 enum { ResultMode = transform_product_result<LhsMode,RhsMode>::Mode };
1382 typedef Transform<Scalar,Dim,LhsMode,LhsOptions> Lhs;
1383 typedef Transform<Scalar,Dim,RhsMode,RhsOptions> Rhs;
1384 typedef Transform<Scalar,Dim,ResultMode,LhsOptions> ResultType;
1385 static ResultType run(
const Lhs& lhs,
const Rhs& rhs)
1388 res.linear() = lhs.linear() * rhs.linear();
1389 res.translation() = lhs.linear() * rhs.translation() + lhs.translation();
1395template<
typename Scalar,
int Dim,
int LhsMode,
int LhsOptions,
int RhsMode,
int RhsOptions>
1396struct transform_transform_product_impl<Transform<Scalar,Dim,LhsMode,LhsOptions>,Transform<Scalar,Dim,RhsMode,RhsOptions>,true >
1398 typedef Transform<Scalar,Dim,LhsMode,LhsOptions> Lhs;
1399 typedef Transform<Scalar,Dim,RhsMode,RhsOptions> Rhs;
1400 typedef Transform<Scalar,Dim,Projective> ResultType;
1401 static ResultType run(
const Lhs& lhs,
const Rhs& rhs)
1403 return ResultType( lhs.matrix() * rhs.matrix() );
1407template<
typename Scalar,
int Dim,
int LhsOptions,
int RhsOptions>
1408struct transform_transform_product_impl<Transform<Scalar,Dim,
AffineCompact,LhsOptions>,Transform<Scalar,Dim,
Projective,RhsOptions>,true >
1410 typedef Transform<Scalar,Dim,AffineCompact,LhsOptions> Lhs;
1411 typedef Transform<Scalar,Dim,Projective,RhsOptions> Rhs;
1412 typedef Transform<Scalar,Dim,Projective> ResultType;
1413 static ResultType run(
const Lhs& lhs,
const Rhs& rhs)
1416 res.matrix().template topRows<Dim>() = lhs.matrix() * rhs.matrix();
1417 res.matrix().row(Dim) = rhs.matrix().row(Dim);
1422template<
typename Scalar,
int Dim,
int LhsOptions,
int RhsOptions>
1423struct transform_transform_product_impl<Transform<Scalar,Dim,
Projective,LhsOptions>,Transform<Scalar,Dim,
AffineCompact,RhsOptions>,true >
1425 typedef Transform<Scalar,Dim,Projective,LhsOptions> Lhs;
1426 typedef Transform<Scalar,Dim,AffineCompact,RhsOptions> Rhs;
1427 typedef Transform<Scalar,Dim,Projective> ResultType;
1428 static ResultType run(
const Lhs& lhs,
const Rhs& rhs)
1430 ResultType res(lhs.matrix().template leftCols<Dim>() * rhs.matrix());
1431 res.matrix().col(Dim) += lhs.matrix().col(Dim);
Expression of a fixed-size or dynamic-size block.
Definition Block.h:99
ColXpr col(Index i)
Definition DenseBase.h:553
RowXpr row(Index i)
Definition DenseBase.h:570
Two-sided Jacobi SVD decomposition of a rectangular matrix.
Definition JacobiSVD.h:479
const MatrixVType & matrixV() const
Definition JacobiSVD.h:604
const SingularValuesType & singularValues() const
Definition JacobiSVD.h:616
const MatrixUType & matrixU() const
Definition JacobiSVD.h:588
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:273
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 a translation transformation.
Definition Translation.h:31
TransformTraits
Definition Constants.h:382
@ RowMajor
Definition Constants.h:259
@ ComputeFullV
Definition Constants.h:324
@ ComputeFullU
Definition Constants.h:320
@ Projective
Definition Constants.h:391
@ Affine
Definition Constants.h:387
@ Isometry
Definition Constants.h:384
@ AffineCompact
Definition Constants.h:389
Definition EigenBase.h:27
Derived & derived()
Definition EigenBase.h:34