Yet some other changes to the stat collecting functions for computing the average edge lenght on a mesh.

This commit is contained in:
Paolo Cignoni 2012-07-06 09:06:43 +00:00
parent 3d956d8b48
commit 87d01da58f
1 changed files with 10 additions and 4 deletions

View File

@ -252,11 +252,17 @@ class Stat
}
}
}
static ScalarType ComputeFaceEdgeAverage(MeshType & m)
{
Distribution<float> 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<float>(fi->P0(i),fi->P1(i)));
}
return sum/(m.fn*3.0);
}
}; // end class