added ComputePerVertQualityAvg function

This commit is contained in:
nico 2017-03-30 13:06:33 +02:00
parent f81d5c7ed5
commit 872448ecba
1 changed files with 17 additions and 0 deletions

View File

@ -43,6 +43,7 @@ public:
typedef typename MeshType::VertexType VertexType;
typedef typename MeshType::VertexPointer VertexPointer;
typedef typename MeshType::VertexIterator VertexIterator;
typedef typename MeshType::ConstVertexIterator ConstVertexIterator;
typedef typename MeshType::ScalarType ScalarType;
typedef typename MeshType::FaceType FaceType;
typedef typename MeshType::FacePointer FacePointer;
@ -113,6 +114,22 @@ public:
return (AvgQ/(ScalarType)num);
}
static ScalarType ComputePerVertQualityAvg(const MeshType & m)
{
tri::RequirePerVertexQuality(m);
ScalarType AvgQ = 0;
ConstVertexIterator vi;
size_t num=0;
for(vi = m.vert.begin(); vi != m.vert.end(); ++vi)
{
if((*vi).IsD())continue;
AvgQ+= (*vi).cQ();
num++;
}
return (AvgQ/(ScalarType)num);
}
static std::pair<ScalarType,ScalarType> ComputePerEdgeQualityMinMax( MeshType & m)
{
tri::RequirePerEdgeQuality(m);