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;
65template<
int Mode>
struct transform_make_affine;
183template<
typename _Scalar,
int _Dim,
int _Mode,
int _Options>
197 typedef DenseIndex Index;
199 typedef typename internal::make_proper_matrix_type<Scalar,Rows,HDim,Options>::type
MatrixType;
209 typedef typename internal::conditional<int(Mode)==int(
AffineCompact),
213 typedef typename internal::conditional<int(Mode)==int(
AffineCompact),
226 enum { TransformTimeDiagonalMode = ((Mode==int(
Isometry))?
Affine:int(Mode)) };
240 check_template_params();
246 check_template_params();
247 m_matrix = other.m_matrix;
252 check_template_params();
255 inline explicit Transform(
const UniformScaling<Scalar>& s)
257 check_template_params();
260 template<
typename Derived>
261 inline explicit Transform(
const RotationBase<Derived, Dim>& r)
263 check_template_params();
268 { m_matrix = other.m_matrix;
return *
this; }
270 typedef internal::transform_take_affine_part<Transform> take_affine_part;
273 template<
typename OtherDerived>
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);
279 check_template_params();
280 internal::transform_construct_from_matrix<OtherDerived,Mode,Options,Dim,HDim>::run(
this, other.
derived());
284 template<
typename OtherDerived>
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);
290 internal::transform_construct_from_matrix<OtherDerived,Mode,Options,Dim,HDim>::run(
this, other.
derived());
294 template<
int OtherOptions>
297 check_template_params();
299 m_matrix = other.
matrix();
302 template<
int OtherMode,
int OtherOptions>
305 check_template_params();
309 YOU_PERFORMED_AN_INVALID_TRANSFORMATION_CONVERSION)
314 YOU_PERFORMED_AN_INVALID_TRANSFORMATION_CONVERSION)
320 if(ModeIsAffineCompact == OtherModeIsAffineCompact)
325 m_matrix.template block<Dim,Dim+1>(0,0) = other.matrix().template block<Dim,Dim+1>(0,0);
328 else if(OtherModeIsAffineCompact)
331 internal::transform_construct_from_matrix<OtherMatrixType,Mode,Options,Dim,HDim>::run(
this, other.matrix());
338 linear() = other.linear();
343 template<
typename OtherDerived>
344 Transform(
const ReturnByValue<OtherDerived>& other)
346 check_template_params();
350 template<
typename OtherDerived>
351 Transform& operator=(
const ReturnByValue<OtherDerived>& other)
357 #ifdef EIGEN_QT_SUPPORT
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()); }
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); }
441 template<
typename DiagonalDerived>
446 res.linearExt() *= b;
456 template<
typename DiagonalDerived>
468 template<
typename OtherDerived>
474 return internal::transform_transform_product_impl<Transform,Transform>::run(*
this,other);
477 #ifdef __INTEL_COMPILER
486 template<
int OtherMode,
int OtherOptions>
struct icc_11_workaround
488 typedef internal::transform_transform_product_impl<Transform,Transform<Scalar,Dim,OtherMode,OtherOptions> > ProductType;
489 typedef typename ProductType::ResultType ResultType;
494 template<
int OtherMode,
int OtherOptions>
495 inline typename icc_11_workaround<OtherMode,OtherOptions>::ResultType
498 typedef typename icc_11_workaround<OtherMode,OtherOptions>::ProductType ProductType;
499 return ProductType::run(*
this,other);
503 template<
int OtherMode,
int OtherOptions>
504 inline typename internal::transform_transform_product_impl<Transform,Transform<Scalar,Dim,OtherMode,OtherOptions> >::ResultType
507 return internal::transform_transform_product_impl<Transform,Transform<Scalar,Dim,OtherMode,OtherOptions> >::run(*
this,other);
523 template<
typename OtherDerived>
526 template<
typename OtherDerived>
532 template<
typename OtherDerived>
535 template<
typename OtherDerived>
538 template<
typename RotationType>
541 template<
typename RotationType>
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
556 res.scale(s.factor());
560 inline Transform& operator*=(
const DiagonalMatrix<Scalar,Dim>& s) { linearExt() *= s;
return *
this; }
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>
570 template<
typename RotationMatrixType,
typename ScalingMatrixType>
572 template<
typename ScalingMatrixType,
typename RotationMatrixType>
575 template<
typename PositionDerived,
typename OrientationType,
typename ScaleDerived>
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); }
596 template<
typename OtherScalarType>
599 check_template_params();
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); }
614 internal::transform_make_affine<int(Mode)>::run(m_matrix);
622 {
return m_matrix.template block<int(Mode)==int(Projective)?HDim:Dim,Dim>(0,0); }
628 {
return m_matrix.template block<int(Mode)==int(Projective)?HDim:Dim,Dim>(0,0); }
635 {
return m_matrix.template block<int(Mode)==int(Projective)?HDim:Dim,1>(0,Dim); }
641 {
return m_matrix.template block<int(Mode)==int(Projective)?HDim:Dim,1>(0,Dim); }
644 #ifdef EIGEN_TRANSFORM_PLUGIN
645 #include EIGEN_TRANSFORM_PLUGIN
649 #ifndef EIGEN_PARSED_BY_DOXYGEN
650 static EIGEN_STRONG_INLINE
void check_template_params()
652 EIGEN_STATIC_ASSERT((Options & (
DontAlign|
RowMajor)) == Options, INVALID_MATRIX_TEMPLATE_PARAMETERS)
698#ifdef EIGEN_QT_SUPPORT
703template<
typename Scalar,
int Dim,
int Mode,
int Options>
706 check_template_params();
714template<
typename Scalar,
int Dim,
int Mode,
int Options>
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(),
730template<
typename Scalar,
int Dim,
int Mode,
int Options>
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));
744template<
typename Scalar,
int Dim,
int Mode,
int Options>
747 check_template_params();
755template<
typename Scalar,
int Dim,
int Mode,
int Options>
758 check_template_params();
759 EIGEN_STATIC_ASSERT(Dim==2, YOU_MADE_A_PROGRAMMING_MISTAKE)
761 m_matrix << other.m11(), other.m21(), other.dx(),
762 other.m12(), other.m22(), other.dy();
764 m_matrix << other.m11(), other.m21(), other.dx(),
765 other.m12(), other.m22(), other.dy(),
766 other.m13(), other.m23(), other.m33();
774template<
typename Scalar,
int Dim,
int Mode,
int Options>
777 EIGEN_STATIC_ASSERT(Dim==2, YOU_MADE_A_PROGRAMMING_MISTAKE)
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));
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));
797template<
typename Scalar,
int Dim,
int Mode,
int Options>
798template<
typename OtherDerived>
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());
812template<
typename Scalar,
int Dim,
int Mode,
int Options>
815 EIGEN_STATIC_ASSERT(Mode!=
int(
Isometry), THIS_METHOD_IS_ONLY_FOR_SPECIFIC_TRANSFORMATIONS)
824template<
typename Scalar,
int Dim,
int Mode,
int Options>
825template<
typename OtherDerived>
829 EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(OtherDerived,
int(Dim))
830 EIGEN_STATIC_ASSERT(Mode!=
int(
Isometry), THIS_METHOD_IS_ONLY_FOR_SPECIFIC_TRANSFORMATIONS)
839template<
typename Scalar,
int Dim,
int Mode,
int Options>
842 EIGEN_STATIC_ASSERT(Mode!=
int(
Isometry), THIS_METHOD_IS_ONLY_FOR_SPECIFIC_TRANSFORMATIONS)
843 m_matrix.template topRows<Dim>() *= s;
851template<
typename Scalar,
int Dim,
int Mode,
int Options>
852template<
typename OtherDerived>
856 EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(OtherDerived,
int(Dim))
857 translationExt() += linearExt() * other;
865template<
typename Scalar,
int Dim,
int Mode,
int Options>
866template<
typename OtherDerived>
870 EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(OtherDerived,
int(Dim))
895template<
typename Scalar,
int Dim,
int Mode,
int Options>
896template<
typename RotationType>
898Transform<Scalar,Dim,Mode,Options>::rotate(
const RotationType&
rotation)
900 linearExt() *= internal::toRotationMatrix<Scalar,Dim>(
rotation);
911template<
typename Scalar,
int Dim,
int Mode,
int Options>
912template<
typename RotationType>
914Transform<Scalar,Dim,Mode,Options>::prerotate(
const RotationType&
rotation)
916 m_matrix.template block<Dim,HDim>(0,0) = internal::toRotationMatrix<Scalar,Dim>(
rotation)
917 * m_matrix.template block<Dim,HDim>(0,0);
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)
942template<
typename Scalar,
int Dim,
int Mode,
int Options>
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);
956template<
typename Scalar,
int Dim,
int Mode,
int Options>
960 translation() = t.vector();
965template<
typename Scalar,
int Dim,
int Mode,
int Options>
968 Transform res = *
this;
969 res.translate(t.vector());
973template<
typename Scalar,
int Dim,
int Mode,
int Options>
977 linear().diagonal().fill(s.factor());
982template<
typename Scalar,
int Dim,
int Mode,
int Options>
983template<
typename Derived>
986 linear() = internal::toRotationMatrix<Scalar,Dim>(r);
987 translation().setZero();
992template<
typename Scalar,
int Dim,
int Mode,
int Options>
993template<
typename Derived>
997 res.rotate(r.derived());
1012template<
typename Scalar,
int Dim,
int Mode,
int Options>
1033template<
typename Scalar,
int Dim,
int Mode,
int Options>
1034template<
typename RotationMatrixType,
typename ScalingMatrixType>
1041 sv.coeffRef(0) *= x;
1062template<
typename Scalar,
int Dim,
int Mode,
int Options>
1063template<
typename ScalingMatrixType,
typename RotationMatrixType>
1070 sv.coeffRef(0) *= x;
1083template<
typename Scalar,
int Dim,
int Mode,
int Options>
1084template<
typename PositionDerived,
typename OrientationType,
typename ScaleDerived>
1089 linear() = internal::toRotationMatrix<Scalar,Dim>(orientation);
1090 linear() *= scale.asDiagonal();
1099struct transform_make_affine
1101 template<
typename MatrixType>
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);
1113 template<
typename MatrixType>
static void run(MatrixType &) { }
1117template<
typename TransformType,
int Mode=TransformType::Mode>
1118struct projective_transform_inverse
1120 static inline void run(
const TransformType&, TransformType&)
1124template<
typename TransformType>
1125struct projective_transform_inverse<TransformType,
Projective>
1127 static inline void run(
const TransformType& m, TransformType& res)
1129 res.matrix() = m.matrix().inverse();
1156template<
typename Scalar,
int Dim,
int Mode,
int Options>
1163 internal::projective_transform_inverse<Transform>::run(*
this, res);
1169 res.
matrix().template topLeftCorner<Dim,Dim>() =
linear().transpose();
1173 res.
matrix().template topLeftCorner<Dim,Dim>() =
linear().inverse();
1177 eigen_assert(
false &&
"Invalid transform traits in Transform::Inverse");
1180 res.
matrix().template topRightCorner<Dim,1>()
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;
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); }
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; }
1214template<
typename Other,
int Mode,
int Options,
int Dim,
int HDim>
1215struct transform_construct_from_matrix<Other, Mode,Options,Dim,HDim, Dim,Dim>
1217 static inline void run(Transform<typename Other::Scalar,Dim,Mode,Options> *transform,
const Other& other)
1219 transform->linear() = other;
1220 transform->translation().setZero();
1221 transform->makeAffine();
1225template<
typename Other,
int Mode,
int Options,
int Dim,
int HDim>
1226struct transform_construct_from_matrix<Other, Mode,Options,Dim,HDim, Dim,HDim>
1228 static inline void run(Transform<typename Other::Scalar,Dim,Mode,Options> *transform,
const Other& other)
1230 transform->affine() = other;
1231 transform->makeAffine();
1235template<
typename Other,
int Mode,
int Options,
int Dim,
int HDim>
1236struct transform_construct_from_matrix<Other, Mode,Options,Dim,HDim, HDim,HDim>
1238 static inline void run(Transform<typename Other::Scalar,Dim,Mode,Options> *transform,
const Other& other)
1239 { transform->matrix() = other; }
1242template<
typename Other,
int Options,
int Dim,
int HDim>
1243struct transform_construct_from_matrix<Other,
AffineCompact,Options,Dim,HDim, HDim,HDim>
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); }
1253template<
int LhsMode,
int RhsMode>
1254struct transform_product_result
1266template<
typename TransformType,
typename MatrixType >
1267struct transform_right_product_impl< TransformType, MatrixType, 0 >
1269 typedef typename MatrixType::PlainObject ResultType;
1271 static EIGEN_STRONG_INLINE ResultType run(
const TransformType& T,
const MatrixType& other)
1273 return T.matrix() * other;
1277template<
typename TransformType,
typename MatrixType >
1278struct transform_right_product_impl< TransformType, MatrixType, 1 >
1281 Dim = TransformType::Dim,
1282 HDim = TransformType::HDim,
1283 OtherRows = MatrixType::RowsAtCompileTime,
1284 OtherCols = MatrixType::ColsAtCompileTime
1287 typedef typename MatrixType::PlainObject ResultType;
1289 static EIGEN_STRONG_INLINE ResultType run(
const TransformType& T,
const MatrixType& other)
1291 EIGEN_STATIC_ASSERT(OtherRows==HDim, YOU_MIXED_MATRICES_OF_DIFFERENT_SIZES);
1293 typedef Block<ResultType, Dim, OtherCols, int(MatrixType::RowsAtCompileTime)==Dim> TopLeftLhs;
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);
1303template<
typename TransformType,
typename MatrixType >
1304struct transform_right_product_impl< TransformType, MatrixType, 2 >
1307 Dim = TransformType::Dim,
1308 HDim = TransformType::HDim,
1309 OtherRows = MatrixType::RowsAtCompileTime,
1310 OtherCols = MatrixType::ColsAtCompileTime
1313 typedef typename MatrixType::PlainObject ResultType;
1315 static EIGEN_STRONG_INLINE ResultType run(
const TransformType& T,
const MatrixType& other)
1317 EIGEN_STATIC_ASSERT(OtherRows==Dim, YOU_MIXED_MATRICES_OF_DIFFERENT_SIZES);
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;
1332template<
typename Other,
int Mode,
int Options,
int Dim,
int HDim>
1333struct transform_left_product_impl<Other,Mode,Options,Dim,HDim, HDim,HDim>
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()); }
1343template<
typename Other,
int Options,
int Dim,
int HDim>
1344struct transform_left_product_impl<Other,
AffineCompact,Options,Dim,HDim, HDim,HDim>
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)
1352 res.matrix().noalias() = other.template block<HDim,Dim>(0,0) * tr.matrix();
1353 res.matrix().col(Dim) += other.col(Dim);
1359template<
typename Other,
int Mode,
int Options,
int Dim,
int HDim>
1360struct transform_left_product_impl<Other,Mode,Options,Dim,HDim, Dim,HDim>
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)
1368 res.affine().noalias() = other * tr.matrix();
1369 res.matrix().row(Dim) = tr.matrix().row(Dim);
1375template<
typename Other,
int Options,
int Dim,
int HDim>
1376struct transform_left_product_impl<Other,
AffineCompact,Options,Dim,HDim, Dim,HDim>
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)
1384 res.matrix().noalias() = other.template block<Dim,Dim>(0,0) * tr.matrix();
1385 res.translation() += other.col(Dim);
1391template<
typename Other,
int Mode,
int Options,
int Dim,
int HDim>
1392struct transform_left_product_impl<Other,Mode,Options,Dim,HDim, Dim,Dim>
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)
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>();
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 >
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)
1422 res.linear() = lhs.linear() * rhs.linear();
1423 res.translation() = lhs.linear() * rhs.translation() + lhs.translation();
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 >
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)
1437 return ResultType( lhs.matrix() * rhs.matrix() );
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 >
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)
1450 res.matrix().template topRows<Dim>() = lhs.matrix() * rhs.matrix();
1451 res.matrix().row(Dim) = rhs.matrix().row(Dim);
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 >
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)
1464 ResultType res(lhs.matrix().template leftCols<Dim>() * rhs.matrix());
1465 res.matrix().col(Dim) += lhs.matrix().col(Dim);
Expression of a fixed-size or dynamic-size block.
Definition Block.h:104
ColXpr col(Index i)
Definition DenseBase.h:733
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 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 EigenBase.h:27
Derived & derived()
Definition EigenBase.h:34