From 4e2808a64ed5b64fe00ab445ec35a5826e70dda4 Mon Sep 17 00:00:00 2001 From: cignoni Date: Fri, 12 Dec 2008 15:06:27 +0000 Subject: [PATCH] added assert for avoiding to put trash into a histogram --- vcg/complex/trimesh/stat.h | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/vcg/complex/trimesh/stat.h b/vcg/complex/trimesh/stat.h index 2d12d3c9..35bff192 100644 --- a/vcg/complex/trimesh/stat.h +++ b/vcg/complex/trimesh/stat.h @@ -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.