Corrected a bug in GridStaticPointer: The hint about the number of cell to be used was ignored and used only to compute the expansion offset.

This commit is contained in:
Paolo Cignoni 2012-07-06 06:58:17 +00:00
parent 81a4cd4765
commit 38b8ab1f15
1 changed files with 12 additions and 11 deletions

View File

@ -260,7 +260,7 @@ namespace vcg {
_bbox.min-=vcg::Point3<FLT>(infl,infl,infl); _bbox.min-=vcg::Point3<FLT>(infl,infl,infl);
_bbox.max+=vcg::Point3<FLT>(infl,infl,infl); _bbox.max+=vcg::Point3<FLT>(infl,infl,infl);
Set(_oBegin,_oEnd,_bbox); Set(_oBegin,_oEnd,_bbox,_size);
} }
@ -301,15 +301,16 @@ namespace vcg {
// Note that the bbox must be already 'inflated' so to be sure that no object will fall on the border of the grid. // Note that the bbox must be already 'inflated' so to be sure that no object will fall on the border of the grid.
template <class OBJITER> template <class OBJITER>
inline void Set(const OBJITER & _oBegin, const OBJITER & _oEnd, const Box3x &_bbox) inline void Set(const OBJITER & _oBegin, const OBJITER & _oEnd, const Box3x &_bbox, int _size=0)
{ {
int _size=(int)std::distance<OBJITER>(_oBegin,_oEnd); if(_size==0)
Point3<FLT> _dim = _bbox.max - _bbox.min; _size=(int)std::distance<OBJITER>(_oBegin,_oEnd);
Point3i _siz; Point3<FLT> _dim = _bbox.max - _bbox.min;
BestDim( _size, _dim, _siz ); Point3i _siz;
BestDim( _size, _dim, _siz );
Set(_oBegin,_oEnd,_bbox,_siz); Set(_oBegin,_oEnd,_bbox,_siz);
} }
template <class OBJITER> template <class OBJITER>