10 #ifndef EIGEN_UMEYAMA_H    11 #define EIGEN_UMEYAMA_H    21 #ifndef EIGEN_PARSED_BY_DOXYGEN    31 template<
typename MatrixType, 
typename OtherMatrixType>
    93 template <
typename Derived, 
typename OtherDerived>
   100   typedef typename Derived::Index Index;
   104     YOU_MIXED_DIFFERENT_NUMERIC_TYPES__YOU_NEED_TO_USE_THE_CAST_METHOD_OF_MATRIXBASE_TO_CAST_NUMERIC_TYPES_EXPLICITLY)
   112   const Index m = src.rows(); 
   113   const Index n = src.cols(); 
   116   const RealScalar one_over_n = 1 / 
static_cast<RealScalar
>(n);
   119   const VectorType src_mean = src.
rowwise().sum() * one_over_n;
   120   const VectorType dst_mean = dst.
rowwise().sum() * one_over_n;
   123   const RowMajorMatrixType src_demean = src.
colwise() - src_mean;
   124   const RowMajorMatrixType dst_demean = dst.
colwise() - dst_mean;
   127   const Scalar src_var = src_demean.rowwise().squaredNorm().sum() * one_over_n;
   130   const MatrixType sigma = one_over_n * dst_demean * src_demean.transpose();
   135   TransformationMatrixType Rt = TransformationMatrixType::Identity(m+1,m+1);
   138   VectorType S = VectorType::Ones(m);
   139   if (sigma.determinant()<0) S(m-1) = -1;
   145     if ( svd.
matrixU().determinant() * svd.
matrixV().determinant() > 0 ) {
   146       Rt.block(0,0,m,m).noalias() = svd.
matrixU()*svd.
matrixV().transpose();
   148       const Scalar 
s = S(m-1); S(m-1) = -1;
   149       Rt.block(0,0,m,m).noalias() = svd.
matrixU() * S.asDiagonal() * svd.
matrixV().transpose();
   153     Rt.block(0,0,m,m).noalias() = svd.
matrixU() * S.asDiagonal() * svd.
matrixV().transpose();
   162     Rt.col(m).head(m) = dst_mean;
   163     Rt.col(m).head(m).noalias() -= c*Rt.topLeftCorner(m,m)*src_mean;
   164     Rt.block(0,0,m,m) *= c;
   168     Rt.col(m).head(m) = dst_mean;
   169     Rt.col(m).head(m).noalias() -= Rt.topLeftCorner(m,m)*src_mean;
   177 #endif // EIGEN_UMEYAMA_H 
Holds information about the various numeric (i.e. scalar) types allowed by Eigen. ...
#define EIGEN_STATIC_ASSERT(CONDITION, MSG)
const SingularValuesType & singularValues() const 
bool isMuchSmallerThan(const Scalar &x, const OtherScalar &y, typename NumTraits< Scalar >::Real precision=NumTraits< Scalar >::dummy_precision())
const unsigned int RowMajorBit
ConstColwiseReturnType colwise() const 
internal::umeyama_transform_matrix_type< Derived, OtherDerived >::type umeyama(const MatrixBase< Derived > &src, const MatrixBase< OtherDerived > &dst, bool with_scaling=true)
Returns the transformation between two point sets. 
#define EIGEN_SIZE_MIN_PREFER_DYNAMIC(a, b)
Two-sided Jacobi SVD decomposition of a rectangular matrix. 
const MatrixUType & matrixU() const 
ConstRowwiseReturnType rowwise() const 
The matrix class, also used for vectors and row-vectors. 
Base class for all dense matrices, vectors, and expressions. 
const MatrixVType & matrixV() const