diff --git a/vcg/complex/algorithms/stat.h b/vcg/complex/algorithms/stat.h index d4b8dd81..f7013d40 100644 --- a/vcg/complex/algorithms/stat.h +++ b/vcg/complex/algorithms/stat.h @@ -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 ComputePerEdgeQualityMinMax( MeshType & m) { tri::RequirePerEdgeQuality(m);