#include "polar_dec.h" #include #include "polar_svd.h" #ifdef _WIN32 #else # include #endif // You will need the development version of Eigen which is > 3.0.3 // You can determine if you have computeDirect by issuing // grep -r computeDirect path/to/eigen/* #define EIGEN_HAS_COMPUTE_DIRECT // From Olga's CGAL mentee's ARAP code template IGL_INLINE void igl::polar_dec(const Mat& A, Mat& R, Mat& T) { #ifdef EIGEN_HAS_COMPUTE_DIRECT typedef typename Mat::Scalar Scalar; typedef Eigen::Matrix Vec; const Scalar th = std::sqrt(Eigen::NumTraits::dummy_precision()); Eigen::SelfAdjointEigenSolver eig; feclearexcept(FE_UNDERFLOW); eig.computeDirect(A.transpose()*A); if(fetestexcept(FE_UNDERFLOW) || eig.eigenvalues()(0)/eig.eigenvalues()(2) th) return polar_svd(A,R,T); #else return polar_svd(A,R,T); #endif } #ifndef IGL_HEADER_ONLY // Explicit template instanciation template void igl::polar_dec >(Eigen::Matrix const&, Eigen::Matrix&, Eigen::Matrix&); #endif