From 7473b2177a6e54d2622914028bf98ae6a00b9108 Mon Sep 17 00:00:00 2001 From: cignoni Date: Wed, 5 May 2010 12:30:58 +0000 Subject: [PATCH] Added ComputePerFaceQualityHistogram (provided by Andrea Tagliasacchi) --- vcg/complex/trimesh/stat.h | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/vcg/complex/trimesh/stat.h b/vcg/complex/trimesh/stat.h index a065100d..7abee649 100644 --- a/vcg/complex/trimesh/stat.h +++ b/vcg/complex/trimesh/stat.h @@ -128,6 +128,21 @@ class Stat h.Add((*fi).Q()); } } + + static void ComputePerFaceQualityHistogram( MeshType & m, Histogramf &h, bool selectionOnly=false ) + { + FaceIterator fi; + int HistSize=10000; + std::pair minmax = tri::Stat::ComputePerFaceQualityMinMax(m); + h.Clear(); + h.SetRange( minmax.first,minmax.second, HistSize ); + for(fi = m.face.begin(); fi != m.face.end(); ++fi) + if(!(*fi).IsD() && ((!selectionOnly) || (*fi).IsS()) ){ + assert(!math::IsNAN((*fi).Q()) && "You should never try to compute Histogram with Invalid Floating points numbers (NaN)"); + h.Add((*fi).Q()); + } + } + static void ComputePerVertexQualityHistogram( MeshType & m, Histogramf &h, bool selectionOnly = false) // V1.0 { VertexIterator vi;