From 51e1718626d019a3313f1f15c642f424ec4e0701 Mon Sep 17 00:00:00 2001 From: cignoni Date: Thu, 8 Jan 2009 11:29:24 +0000 Subject: [PATCH] added the possibility to decide the size of the grid with an optional parameter of the Set --- vcg/space/index/grid_static_ptr.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/vcg/space/index/grid_static_ptr.h b/vcg/space/index/grid_static_ptr.h index 1b1518a7..4443c0d1 100644 --- a/vcg/space/index/grid_static_ptr.h +++ b/vcg/space/index/grid_static_ptr.h @@ -371,7 +371,7 @@ namespace vcg { } template - inline void Set(const OBJITER & _oBegin, const OBJITER & _oEnd) + inline void Set(const OBJITER & _oBegin, const OBJITER & _oEnd, int _size=0) { Box3 _bbox; Box3 b; @@ -382,7 +382,9 @@ namespace vcg { _bbox.Add(b); } ///inflate the bb calculated - int _size=(int)std::distance(_oBegin,_oEnd); + if(_size ==0) + _size=(int)std::distance(_oBegin,_oEnd); + ScalarType infl=_bbox.Diag()/_size; _bbox.min-=vcg::Point3(infl,infl,infl); _bbox.max+=vcg::Point3(infl,infl,infl);