From c932c5d60a1d7e490d085eee42eb69f164dd1039 Mon Sep 17 00:00:00 2001 From: cignoni Date: Mon, 22 Oct 2012 18:34:08 +0000 Subject: [PATCH] Removed Covariance computing function from Matrix Class, moved into fitting --- vcg/math/matrix33.h | 27 +-------------------------- 1 file changed, 1 insertion(+), 26 deletions(-) diff --git a/vcg/math/matrix33.h b/vcg/math/matrix33.h index 62ae5326..be2efcd8 100644 --- a/vcg/math/matrix33.h +++ b/vcg/math/matrix33.h @@ -119,36 +119,11 @@ public: /** Compute the Frobenius Norm of the Matrix */ Scalar Norm() { return Base::cwise().abs2().sum(); } -// { -// // FIXME looks like there was a bug: j is not used !!! -// Scalar SQsum=0; -// for(int i=0;i<3;++i) -// for(int j=0;j<3;++j) -// SQsum += a[i]*a[i]; -// return (math::Sqrt(SQsum)); -// } - /** Computes the covariance matrix of a set of 3d points. Returns the barycenter. */ // FIXME should be outside Matrix - template - void Covariance(const STLPOINTCONTAINER &points, Point3 &bp) { - assert(!points.empty()); - typedef typename STLPOINTCONTAINER::const_iterator PointIte; - // first cycle: compute the barycenter - bp.setZero(); - for( PointIte pi = points.begin(); pi != points.end(); ++pi) bp+= (*pi); - bp/=points.size(); - // second cycle: compute the covariance matrix - this->setZero(); - vcg::Matrix33 A; - for( PointIte pi = points.begin(); pi != points.end(); ++pi) { - Point3 p = (*pi)-bp; - A.OuterProduct(p,p); - (*this)+= A; - } - } + /** It computes the cross covariance matrix of two set of 3d points P and X;