From 47b654861ceda9cbd1dafa71792a923cc847e39e Mon Sep 17 00:00:00 2001 From: nicopietroni Date: Fri, 10 Jun 2005 11:46:49 +0000 Subject: [PATCH] Added Norm Function --- vcg/math/matrix33.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/vcg/math/matrix33.h b/vcg/math/matrix33.h index a1620f37..1463dd30 100644 --- a/vcg/math/matrix33.h +++ b/vcg/math/matrix33.h @@ -24,6 +24,9 @@ History $Log: not supported by cvs2svn $ +Revision 1.6 2005/06/07 14:29:56 ganovelli +changed from Matrix33Ide to MatrixeeDiag + Revision 1.5 2005/05/23 15:05:26 ganovelli Matrix33Diag Added: it implements diagonal matrix. Added only operator += in Matrix33 @@ -375,6 +378,17 @@ void ExternalProduct(const Point3 &a, const Point3 &b) (*this)[i][j] = a[i]*b[j]; } +/* Compute the Frobenius Norm of the Matrix +*/ +ScalarType Norm() +{ + ScalarType 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)); +} + /* It compute the cross covariance matrix of two set of 3d points P and X; it returns also the barycenters of P and X.