Added Option to compute average edge length only on selected faces

This commit is contained in:
Paolo Cignoni 2017-04-11 19:10:13 +02:00
parent 5c2843b6a9
commit 37f8ea9643
1 changed files with 6 additions and 5 deletions

View File

@ -317,15 +317,16 @@ public:
h.Add(Distance(edgeVec[i].v[0]->P(),edgeVec[i].v[1]->P()));
}
static ScalarType ComputeFaceEdgeLengthAverage(MeshType & m)
static ScalarType ComputeFaceEdgeLengthAverage(MeshType & m, bool selected=false)
{
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)));
}
if(!selected || fi->IsS())
{
for(int i=0;i<3;++i)
sum+=double(Distance(fi->P0(i),fi->P1(i)));
}
return sum/(m.fn*3.0);
}