diff --git a/vcg/math/histogram.h b/vcg/math/histogram.h index f98fee45..9999a041 100644 --- a/vcg/math/histogram.h +++ b/vcg/math/histogram.h @@ -370,14 +370,11 @@ void Histogram::Add(ScalarType v, ScalarType increment) int pos=BinIndex(v); if(vmaxElem) maxElem=v; - if(pos>=0 && pos<=n) - { - - H[pos]+=increment; - cnt+=increment; - avg+=v*increment; - rms += (v*v)*increment; - } + assert((pos>=0)&&(pos<=n+1)); + H[pos]+=increment; + cnt+=increment; + avg+=v*increment; + rms += (v*v)*increment; } template