From 87d01da58fa5e65198e61a1bdf9c930b5d238259 Mon Sep 17 00:00:00 2001 From: cignoni Date: Fri, 6 Jul 2012 09:06:43 +0000 Subject: [PATCH] Yet some other changes to the stat collecting functions for computing the average edge lenght on a mesh. --- vcg/complex/algorithms/stat.h | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/vcg/complex/algorithms/stat.h b/vcg/complex/algorithms/stat.h index 2341a50a..7e866866 100644 --- a/vcg/complex/algorithms/stat.h +++ b/vcg/complex/algorithms/stat.h @@ -251,12 +251,18 @@ class Stat } } } - } + } + static ScalarType ComputeFaceEdgeAverage(MeshType & m) { - Distribution h; - ComputeFaceEdgeDistribution(m,h); - return h.Avg(); + double sum=0; + for(FaceIterator fi = m.face.begin(); fi != m.face.end(); ++fi) + if(!(*fi).IsD()) + { + for(int i=0;i<3;++i) + sum+=double(Distance(fi->P0(i),fi->P1(i))); + } + return sum/(m.fn*3.0); } }; // end class