From e340e6d1c022e4563a7153d1d3810d21436353f6 Mon Sep 17 00:00:00 2001 From: cignoni Date: Mon, 21 Nov 2011 09:09:58 +0000 Subject: [PATCH] removed old lib svd and substituted with eigen. Anyway is someone really using this file? --- vcg/math/polar_decomposition.h | 32 ++++++++++---------------------- 1 file changed, 10 insertions(+), 22 deletions(-) diff --git a/vcg/math/polar_decomposition.h b/vcg/math/polar_decomposition.h index beea1453..88c11aac 100644 --- a/vcg/math/polar_decomposition.h +++ b/vcg/math/polar_decomposition.h @@ -19,13 +19,6 @@ * GNU General Public License (http://www.gnu.org/licenses/gpl.txt) * * for more details. * * * -****************************************************************************/ -/**************************************************************************** - History - -$Log: not supported by cvs2svn $ - - ****************************************************************************/ #ifndef POLAR_DECOMPOSITION_VCG #define POLAR_DECOMPOSITION_VCG @@ -33,7 +26,8 @@ $Log: not supported by cvs2svn $ #include #include -#include +#include +#include namespace vcg{ @@ -44,38 +38,32 @@ namespace vcg{ template void RotationalPartByPolarDecomposition( const vcg::Matrix33 & m, vcg::Matrix33 &r ){ - vcg::Matrix33 tmp,s; + Eigen::Matrix tmp,s; - r.SetZero(); - s.SetZero(); + r.setZero(); + s.setZero(); tmp = m*m.transpose(); - Matrix33 res; - Point3 e; + Eigen::Matrix res; + Eigen::Matrix e; bool ss = SingularValueDecomposition >(tmp,&e[0],res); + Eigen::JacobiSVD svd(A); + sol=svd.solve(b); + e[0]=math::Sqrt(e[0]); e[1]=math::Sqrt(e[1]); e[2]=math::Sqrt(e[2]); - #ifdef VCG_USE_EIGEN tmp = tmp*e.asDiagonal()*res.transpose(); - #else - tmp = tmp*Matrix33Diag(e)*res.transpose(); - #endif bool s1 = SingularValueDecomposition >(tmp,&e[0],res.transpose()); e[0]=1/e[0]; e[1]=1/e[1]; e[2]=1/e[2]; - #ifdef VCG_USE_EIGEN tmp = res*e.asDiagonal()*tmp.transpose(); - #else - tmp = res*Matrix33Diag(e)*tmp.transpose(); - #endif - r = m*tmp; }