added the possibility of customizing the histogram bucket size

This commit is contained in:
Paolo Cignoni 2010-09-13 09:47:23 +00:00
parent d263446d0e
commit 7977e270c5
1 changed files with 4 additions and 7 deletions

View File

@ -129,25 +129,22 @@ class Stat
} }
} }
static void ComputePerFaceQualityHistogram( MeshType & m, Histogramf &h, bool selectionOnly=false ) static void ComputePerFaceQualityHistogram( MeshType & m, Histogramf &h, bool selectionOnly=false,int HistSize=10000 )
{ {
FaceIterator fi;
int HistSize=10000;
std::pair<float,float> minmax = tri::Stat<MeshType>::ComputePerFaceQualityMinMax(m); std::pair<float,float> minmax = tri::Stat<MeshType>::ComputePerFaceQualityMinMax(m);
h.Clear(); h.Clear();
h.SetRange( minmax.first,minmax.second, HistSize ); h.SetRange( minmax.first,minmax.second, HistSize );
for(fi = m.face.begin(); fi != m.face.end(); ++fi) for(FaceIterator fi = m.face.begin(); fi != m.face.end(); ++fi)
if(!(*fi).IsD() && ((!selectionOnly) || (*fi).IsS()) ){ if(!(*fi).IsD() && ((!selectionOnly) || (*fi).IsS()) ){
assert(!math::IsNAN((*fi).Q()) && "You should never try to compute Histogram with Invalid Floating points numbers (NaN)"); assert(!math::IsNAN((*fi).Q()) && "You should never try to compute Histogram with Invalid Floating points numbers (NaN)");
h.Add((*fi).Q()); h.Add((*fi).Q());
} }
} }
static void ComputePerVertexQualityHistogram( MeshType & m, Histogramf &h, bool selectionOnly = false) // V1.0 static void ComputePerVertexQualityHistogram( MeshType & m, Histogramf &h, bool selectionOnly = false, int HistSize=10000 ) // V1.0
{ {
VertexIterator vi; VertexIterator vi;
int HistSize=10000; std::pair<float,float> minmax = ComputePerVertexQualityMinMax(m);
std::pair<float,float> minmax = ComputePerVertexQualityMinMax(m);
h.Clear(); h.Clear();
h.SetRange( minmax.first,minmax.second, HistSize); h.SetRange( minmax.first,minmax.second, HistSize);