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,
   200 template<
typename _Scalar, 
int _Dim, 
int _Mode, 
int _Options>
   258     check_template_params();
   264     check_template_params();
   268   EIGEN_DEVICE_FUNC 
inline explicit Transform(
const TranslationType& t)
   270     check_template_params();
   275     check_template_params();
   278   template<
typename Derived>
   281     check_template_params();
   286   { m_matrix = other.
m_matrix; 
return *
this; }
   291   template<
typename OtherDerived>
   295       YOU_MIXED_DIFFERENT_NUMERIC_TYPES__YOU_NEED_TO_USE_THE_CAST_METHOD_OF_MATRIXBASE_TO_CAST_NUMERIC_TYPES_EXPLICITLY);
   297     check_template_params();
   302   template<
typename OtherDerived>
   306       YOU_MIXED_DIFFERENT_NUMERIC_TYPES__YOU_NEED_TO_USE_THE_CAST_METHOD_OF_MATRIXBASE_TO_CAST_NUMERIC_TYPES_EXPLICITLY);
   312   template<
int OtherOptions>
   315     check_template_params();
   317     m_matrix = other.
matrix();
   320   template<
int OtherMode,
int OtherOptions>
   323     check_template_params();
   327                         YOU_PERFORMED_AN_INVALID_TRANSFORMATION_CONVERSION)
   332                         YOU_PERFORMED_AN_INVALID_TRANSFORMATION_CONVERSION)
   338     if(ModeIsAffineCompact == OtherModeIsAffineCompact)
   343       m_matrix.template block<Dim,Dim+1>(0,0) = other.
matrix().template block<Dim,Dim+1>(0,0);
   346     else if(OtherModeIsAffineCompact)
   356       linear() = other.
linear();
   361   template<
typename OtherDerived>
   364     check_template_params();
   368   template<
typename OtherDerived>
   375   #ifdef EIGEN_QT_SUPPORT   377   inline Transform& operator=(
const QMatrix& other);
   378   inline QMatrix toQMatrix(
void) 
const;
   379   inline Transform(
const QTransform& other);
   380   inline Transform& operator=(
const QTransform& other);
   381   inline QTransform toQTransform(
void) 
const;
   385   EIGEN_DEVICE_FUNC Index 
cols()
 const { 
return m_matrix.
cols(); }
   389   EIGEN_DEVICE_FUNC 
inline Scalar operator() (Index 
row, Index 
col)
 const { 
return m_matrix(row,col); }
   392   EIGEN_DEVICE_FUNC 
inline Scalar& operator() (Index 
row, Index 
col) { 
return m_matrix(row,col); }
   395   EIGEN_DEVICE_FUNC 
inline const MatrixType& 
matrix()
 const { 
return m_matrix; }
   397   EIGEN_DEVICE_FUNC 
inline MatrixType& 
matrix() { 
return m_matrix; }
   400   EIGEN_DEVICE_FUNC 
inline ConstLinearPart 
linear()
 const { 
return ConstLinearPart(m_matrix,0,0); }
   402   EIGEN_DEVICE_FUNC 
inline LinearPart 
linear() { 
return LinearPart(m_matrix,0,0); }
   405   EIGEN_DEVICE_FUNC 
inline ConstAffinePart 
affine()
 const { 
return take_affine_part::run(m_matrix); }
   407   EIGEN_DEVICE_FUNC 
inline AffinePart 
affine() { 
return take_affine_part::run(m_matrix); }
   439   template<
typename OtherDerived>
   451   template<
typename OtherDerived> 
friend   462   template<
typename DiagonalDerived>
   463   EIGEN_DEVICE_FUNC 
inline const TransformTimeDiagonalReturnType
   466     TransformTimeDiagonalReturnType res(*
this);
   477   template<
typename DiagonalDerived>
   478   EIGEN_DEVICE_FUNC 
friend inline TransformTimeDiagonalReturnType
   481     TransformTimeDiagonalReturnType res;
   489   template<
typename OtherDerived>
   507   template<
int OtherMode,
int OtherOptions> 
struct icc_11_workaround
   510     typedef typename ProductType::ResultType ResultType;
   515   template<
int OtherMode,
int OtherOptions>
   516   inline typename icc_11_workaround<OtherMode,OtherOptions>::ResultType
   519     typedef typename icc_11_workaround<OtherMode,OtherOptions>::ProductType ProductType;
   520     return ProductType::run(*
this,other);
   524   template<
int OtherMode,
int OtherOptions>
   541     return Transform(MatrixType::Identity());
   544   template<
typename OtherDerived>
   548   template<
typename OtherDerived>
   552   EIGEN_DEVICE_FUNC 
inline Transform& scale(
const Scalar& 
s);
   553   EIGEN_DEVICE_FUNC 
inline Transform& prescale(
const Scalar& s);
   555   template<
typename OtherDerived>
   559   template<
typename OtherDerived>
   563   template<
typename RotationType>
   565   inline Transform& rotate(
const RotationType& rotation);
   567   template<
typename RotationType>
   569   inline Transform& prerotate(
const RotationType& rotation);
   571   EIGEN_DEVICE_FUNC 
Transform& shear(
const Scalar& sx, 
const Scalar& sy);
   572   EIGEN_DEVICE_FUNC 
Transform& preshear(
const Scalar& sx, 
const Scalar& sy);
   574   EIGEN_DEVICE_FUNC 
inline Transform& operator=(
const TranslationType& t);
   590     TransformTimeDiagonalReturnType res = *
this;
   598   template<
typename Derived>
   600   template<
typename Derived>
   602   template<
typename Derived>
   605   EIGEN_DEVICE_FUNC 
const LinearMatrixType rotation() 
const;
   606   template<
typename RotationMatrixType, 
typename ScalingMatrixType>
   608   void computeRotationScaling(RotationMatrixType *rotation, ScalingMatrixType *scaling) 
const;
   609   template<
typename ScalingMatrixType, 
typename RotationMatrixType>
   611   void computeScalingRotation(ScalingMatrixType *scaling, RotationMatrixType *rotation) 
const;
   613   template<
typename PositionDerived, 
typename OrientationType, 
typename ScaleDerived>
   622   EIGEN_DEVICE_FUNC 
const Scalar* 
data()
 const { 
return m_matrix.
data(); }
   624   EIGEN_DEVICE_FUNC Scalar* 
data() { 
return m_matrix.
data(); }
   631   template<
typename NewScalarType>
   636   template<
typename OtherScalarType>
   639     check_template_params();
   640     m_matrix = other.
matrix().template cast<Scalar>();
   648   { 
return m_matrix.isApprox(other.
m_matrix, prec); }
   662   { 
return m_matrix.template block<int(Mode)==int(Projective)?HDim:Dim,Dim>(0,0); }
   668   { 
return m_matrix.template block<int(Mode)==int(Projective)?HDim:Dim,Dim>(0,0); }
   675   { 
return m_matrix.template block<int(Mode)==int(Projective)?HDim:Dim,1>(0,
Dim); }
   681   { 
return m_matrix.template block<int(Mode)==int(Projective)?HDim:Dim,1>(0,
Dim); }
   684   #ifdef EIGEN_TRANSFORM_PLUGIN   685   #include EIGEN_TRANSFORM_PLUGIN   689   #ifndef EIGEN_PARSED_BY_DOXYGEN   738 #ifdef EIGEN_QT_SUPPORT   743 template<
typename Scalar, 
int Dim, 
int Mode,
int Options>
   746   check_template_params();
   754 template<
typename Scalar, 
int Dim, 
int Mode,
int Options>
   759     m_matrix << other.m11(), other.m21(), other.dx(),
   760                 other.m12(), other.m22(), other.dy();
   762     m_matrix << other.m11(), other.m21(), other.dx(),
   763                 other.m12(), other.m22(), other.dy(),
   774 template<
typename Scalar, 
int Dim, 
int Mode, 
int Options>
   777   check_template_params();
   779   return QMatrix(m_matrix.
coeff(0,0), m_matrix.
coeff(1,0),
   788 template<
typename Scalar, 
int Dim, 
int Mode,
int Options>
   791   check_template_params();
   799 template<
typename Scalar, 
int Dim, 
int Mode, 
int Options>
   802   check_template_params();
   805     m_matrix << other.m11(), other.m21(), other.dx(),
   806                 other.m12(), other.m22(), other.dy();
   808     m_matrix << other.m11(), other.m21(), other.dx(),
   809                 other.m12(), other.m22(), other.dy(),
   810                 other.m13(), other.m23(), other.m33();
   818 template<
typename Scalar, 
int Dim, 
int Mode, 
int Options>
   823     return QTransform(m_matrix.
coeff(0,0), m_matrix.
coeff(1,0),
   827     return QTransform(m_matrix.
coeff(0,0), m_matrix.
coeff(1,0), m_matrix.
coeff(2,0),
   841 template<
typename Scalar, 
int Dim, 
int Mode, 
int Options>
   842 template<
typename OtherDerived>
   848   linearExt().noalias() = (linearExt() * other.
asDiagonal());
   856 template<
typename Scalar, 
int Dim, 
int Mode, 
int Options>
   868 template<
typename Scalar, 
int Dim, 
int Mode, 
int Options>
   869 template<
typename OtherDerived>
   875   affine().noalias() = (other.
asDiagonal() * affine());
   883 template<
typename Scalar, 
int Dim, 
int Mode, 
int Options>
   887   m_matrix.template topRows<Dim>() *= s;
   895 template<
typename Scalar, 
int Dim, 
int Mode, 
int Options>
   896 template<
typename OtherDerived>
   901   translationExt() += linearExt() * other;
   909 template<
typename Scalar, 
int Dim, 
int Mode, 
int Options>
   910 template<
typename OtherDerived>
   916     affine() += other * m_matrix.row(
Dim);
   918     translation() += other;
   939 template<
typename Scalar, 
int Dim, 
int Mode, 
int Options>
   940 template<
typename RotationType>
   944   linearExt() *= internal::toRotationMatrix<Scalar,Dim>(rotation);
   955 template<
typename Scalar, 
int Dim, 
int Mode, 
int Options>
   956 template<
typename RotationType>
   960   m_matrix.template block<Dim,HDim>(0,0) = internal::toRotationMatrix<Scalar,Dim>(rotation)
   961                                          * m_matrix.template block<Dim,HDim>(0,0);
   970 template<
typename Scalar, 
int Dim, 
int Mode, 
int Options>
   976   VectorType tmp = linear().col(0)*sy + linear().col(1);
   977   linear() << linear().col(0) + linear().col(1)*sx, tmp;
   986 template<
typename Scalar, 
int Dim, 
int Mode, 
int Options>
   992   m_matrix.template block<Dim,HDim>(0,0) = LinearMatrixType(1, sx, sy, 1) * m_matrix.template block<Dim,HDim>(0,0);
  1000 template<
typename Scalar, 
int Dim, 
int Mode, 
int Options>
  1004   translation() = t.
vector();
  1009 template<
typename Scalar, 
int Dim, 
int Mode, 
int Options>
  1017 template<
typename Scalar, 
int Dim, 
int Mode, 
int Options>
  1021   linear().diagonal().fill(s.
factor());
  1026 template<
typename Scalar, 
int Dim, 
int Mode, 
int Options>
  1027 template<
typename Derived>
  1030   linear() = internal::toRotationMatrix<Scalar,Dim>(r);
  1031   translation().setZero();
  1036 template<
typename Scalar, 
int Dim, 
int Mode, 
int Options>
  1037 template<
typename Derived>
  1056 template<
typename Scalar, 
int Dim, 
int Mode, 
int Options>
  1060   LinearMatrixType result;
  1061   computeRotationScaling(&result, (LinearMatrixType*)0);
  1077 template<
typename Scalar, 
int Dim, 
int Mode, 
int Options>
  1078 template<
typename RotationMatrixType, 
typename ScalingMatrixType>
  1083   Scalar x = (svd.
matrixU() * svd.
matrixV().adjoint()).determinant(); 
  1085   sv.coeffRef(0) *= x;
  1086   if(scaling) scaling->lazyAssign(svd.
matrixV() * sv.asDiagonal() * svd.
matrixV().adjoint());
  1089     LinearMatrixType m(svd.
matrixU());
  1091     rotation->lazyAssign(m * svd.
matrixV().adjoint());
  1106 template<
typename Scalar, 
int Dim, 
int Mode, 
int Options>
  1107 template<
typename ScalingMatrixType, 
typename RotationMatrixType>
  1112   Scalar x = (svd.
matrixU() * svd.
matrixV().adjoint()).determinant(); 
  1114   sv.coeffRef(0) *= x;
  1115   if(scaling) scaling->lazyAssign(svd.
matrixU() * sv.asDiagonal() * svd.
matrixU().adjoint());
  1118     LinearMatrixType m(svd.
matrixU());
  1120     rotation->lazyAssign(m * svd.
matrixV().adjoint());
  1127 template<
typename Scalar, 
int Dim, 
int Mode, 
int Options>
  1128 template<
typename PositionDerived, 
typename OrientationType, 
typename ScaleDerived>
  1133   linear() = internal::toRotationMatrix<Scalar,Dim>(orientation);
  1135   translation() = position;
  1143 struct transform_make_affine
  1145   template<
typename MatrixType>
  1146   EIGEN_DEVICE_FUNC 
static void run(MatrixType &mat)
  1148     static const int Dim = MatrixType::ColsAtCompileTime-1;
  1149     mat.template block<1,Dim>(
Dim,0).setZero();
  1150     mat.coeffRef(Dim,Dim) = 
typename MatrixType::Scalar(1);
  1157   template<
typename MatrixType> EIGEN_DEVICE_FUNC 
static void run(MatrixType &) { }
  1161 template<
typename TransformType, 
int Mode=TransformType::Mode>
  1164   EIGEN_DEVICE_FUNC 
static inline void run(
const TransformType&, TransformType&)
  1168 template<
typename TransformType>
  1171   EIGEN_DEVICE_FUNC 
static inline void run(
const TransformType& m, TransformType& res)
  1173     res.matrix() = m.matrix().inverse();
  1200 template<
typename Scalar, 
int Dim, 
int Mode, 
int Options>
  1213       res.
matrix().template topLeftCorner<Dim,Dim>() = linear().transpose();
  1217       res.
matrix().template topLeftCorner<Dim,Dim>() = linear().inverse();
  1221       eigen_assert(
false && 
"Invalid transform traits in Transform::Inverse");
  1224     res.
matrix().template topRightCorner<Dim,1>()
  1225       = - res.
matrix().template topLeftCorner<Dim,Dim>() * translation();
  1237 template<
typename TransformType> 
struct transform_take_affine_part {
  1241   static inline AffinePart 
run(MatrixType& m)
  1242   { 
return m.template block<TransformType::Dim,TransformType::HDim>(0,0); }
  1243   static inline ConstAffinePart 
run(
const MatrixType& m)
  1244   { 
return m.template block<TransformType::Dim,TransformType::HDim>(0,0); }
  1247 template<
typename Scalar, 
int Dim, 
int Options>
  1250   static inline MatrixType& 
run(MatrixType& m) { 
return m; }
  1251   static inline const MatrixType& 
run(
const MatrixType& m) { 
return m; }
  1258 template<
typename Other, 
int Mode, 
int Options, 
int Dim, 
int HDim>
  1263     transform->
linear() = other;
  1269 template<
typename Other, 
int Mode, 
int Options, 
int Dim, 
int HDim>
  1274     transform->
affine() = other;
  1279 template<
typename Other, 
int Mode, 
int Options, 
int Dim, 
int HDim>
  1283   { transform->
matrix() = other; }
  1286 template<
typename Other, 
int Options, 
int Dim, 
int HDim>
  1290   { transform->
matrix() = other.template block<Dim,HDim>(0,0); }
  1297 template<
int LhsMode,
int RhsMode>
  1310 template< 
typename TransformType, 
typename MatrixType, 
int RhsCols>
  1317     return T.matrix() * other;
  1321 template< 
typename TransformType, 
typename MatrixType, 
int RhsCols>
  1327     OtherRows = MatrixType::RowsAtCompileTime,
  1328     OtherCols = MatrixType::ColsAtCompileTime
  1339     ResultType res(other.rows(),other.cols());
  1340     TopLeftLhs(res, 0, 0, 
Dim, other.cols()).noalias() = T.affine() * other;
  1341     res.row(OtherRows-1) = other.row(OtherRows-1);
  1347 template< 
typename TransformType, 
typename MatrixType, 
int RhsCols>
  1353     OtherRows = MatrixType::RowsAtCompileTime,
  1354     OtherCols = MatrixType::ColsAtCompileTime
  1365     TopLeftLhs(res, 0, 0, 
Dim, other.cols()).noalias() += T.linear() * other;
  1371 template< 
typename TransformType, 
typename MatrixType >
  1378     OtherRows = MatrixType::RowsAtCompileTime,
  1389     rhs.template head<Dim>() = other; rhs[
Dim] = 
typename ResultType::Scalar(1);
  1391     return res.template head<Dim>();
  1400 template<
typename Other,
int Mode, 
int Options, 
int Dim, 
int HDim>
  1406   static ResultType 
run(
const Other& other,
const TransformType& tr)
  1407   { 
return ResultType(other * tr.
matrix()); }
  1411 template<
typename Other, 
int Options, 
int Dim, 
int HDim>
  1417   static ResultType 
run(
const Other& other,
const TransformType& tr)
  1420     res.
matrix().noalias() = other.template block<HDim,Dim>(0,0) * tr.
matrix();
  1427 template<
typename Other,
int Mode, 
int Options, 
int Dim, 
int HDim>
  1433   static ResultType 
run(
const Other& other,
const TransformType& tr)
  1443 template<
typename Other, 
int Options, 
int Dim, 
int HDim>
  1449   static ResultType 
run(
const Other& other,
const TransformType& tr)
  1452     res.
matrix().noalias() = other.template block<Dim,Dim>(0,0) * tr.
matrix();
  1459 template<
typename Other,
int Mode, 
int Options, 
int Dim, 
int HDim>
  1465   static ResultType 
run(
const Other& other, 
const TransformType& tr)
  1470     res.
matrix().template topRows<Dim>().noalias()
  1471       = other * tr.
matrix().template topRows<Dim>();
  1480 template<
typename Scalar, 
int Dim, 
int LhsMode, 
int LhsOptions, 
int RhsMode, 
int RhsOptions>
  1487   static ResultType 
run(
const Lhs& lhs, 
const Rhs& rhs)
  1497 template<
typename Scalar, 
int Dim, 
int LhsMode, 
int LhsOptions, 
int RhsMode, 
int RhsOptions>
  1503   static ResultType 
run(
const Lhs& lhs, 
const Rhs& rhs)
  1509 template<
typename Scalar, 
int Dim, 
int LhsOptions, 
int RhsOptions>
  1515   static ResultType 
run(
const Lhs& lhs, 
const Rhs& rhs)
  1524 template<
typename Scalar, 
int Dim, 
int LhsOptions, 
int RhsOptions>
  1530   static ResultType 
run(
const Lhs& lhs, 
const Rhs& rhs)
  1532     ResultType res(lhs.
matrix().template leftCols<Dim>() * rhs.
matrix());
  1542 #endif // EIGEN_TRANSFORM_H 
#define EIGEN_STRONG_INLINE
Transform< float, 3, Affine > Affine3f
Transform< double, 2, AffineCompact > AffineCompact2d
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Scalar * data() const
const MatrixUType & matrixU() const
EIGEN_DEVICE_FUNC ColXpr col(Index i)
This is the const version of col(). */. 
Represents a diagonal matrix with its storage. 
Holds information about the various numeric (i.e. scalar) types allowed by Eigen. ...
#define EIGEN_STATIC_ASSERT(CONDITION, MSG)
const unsigned int RowMajorBit
#define EIGEN_IMPLIES(a, b)
EIGEN_DEVICE_FUNC const InverseReturnType inverse() const
Represents a translation transformation. 
Transform< double, 2, Projective > Projective2d
Transform< float, 2, AffineCompact > AffineCompact2f
EIGEN_DEVICE_FUNC const VectorType & vector() const
EIGEN_DEVICE_FUNC const Derived & derived() const
Transform< double, 3, Affine > Affine3d
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Scalar & coeff(Index rowId, Index colId) const
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
The Index type as used for the API. 
Expression of the multiple replication of a matrix or vector. 
Common base class for compact rotation representations. 
Transform< double, 3, Isometry > Isometry3d
EIGEN_DEVICE_FUNC void evalTo(Dest &dst) const
EIGEN_DEVICE_FUNC const DiagonalWrapper< const Derived > asDiagonal() const
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Index cols() const
Transform< float, 2, Projective > Projective2f
EIGEN_DEVICE_FUNC RotationMatrixType toRotationMatrix() const
EIGEN_DEVICE_FUNC const Product< MatrixDerived, PermutationDerived, AliasFreeProduct > operator*(const MatrixBase< MatrixDerived > &matrix, const PermutationBase< PermutationDerived > &permutation)
EIGEN_DEVICE_FUNC Derived & setZero(Index size)
Transform< float, 3, Projective > Projective3f
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. 
#define EIGEN_PLAIN_ENUM_MIN(a, b)
Transform< double, 2, Affine > Affine2d
Transform< double, 2, Isometry > Isometry2d
Two-sided Jacobi SVD decomposition of a rectangular matrix. 
EIGEN_DEVICE_FUNC RowXpr row(Index i)
This is the const version of row(). */. 
const SingularValuesType & singularValues() const
const MatrixVType & matrixV() const
The matrix class, also used for vectors and row-vectors. 
EIGEN_DEVICE_FUNC Derived & derived()
Base class for all dense matrices, vectors, and expressions. 
Transform< float, 2, Isometry > Isometry2f
Transform< double, 3, Projective > Projective3d
#define EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(TYPE, SIZE)