added assert for avoiding to put trash into a histogram

This commit is contained in:
Paolo Cignoni 2008-12-12 15:06:27 +00:00
parent 46cc8c7327
commit 4e2808a64e
1 changed files with 5 additions and 2 deletions

View File

@ -117,8 +117,11 @@ class Stat
h.Clear();
h.SetRange( minmax.first,minmax.second, HistSize);
for(vi = m.vert.begin(); vi != m.vert.end(); ++vi)
if(!(*vi).IsD()) h.Add((*vi).Q());
if(!(*vi).IsD())
{
assert(!math::IsNAN((*vi).Q()));
h.Add((*vi).Q());
}
// Sanity check; If some very wrong value has happened in the Q value,
// the histogram is messed. If a significant percentage (20% )of the values are all in a single bin
// we should try to solve the problem. No easy solution here.