added InitEmpty Function

This commit is contained in:
Nico Pietroni 2006-07-26 08:12:56 +00:00
parent 184edbcc3f
commit b2c789ae43
1 changed files with 23 additions and 20 deletions

View File

@ -24,6 +24,9 @@
History History
$Log: not supported by cvs2svn $ $Log: not supported by cvs2svn $
Revision 1.19 2006/07/10 12:43:13 turini
explicit cast in _IsInHtable() to resolve a warning
Revision 1.18 2006/04/20 08:30:27 cignoni Revision 1.18 2006/04/20 08:30:27 cignoni
small GCC compiling issues small GCC compiling issues
@ -319,6 +322,26 @@ namespace vcg{
} }
/// set an empty spatial hash table
void InitEmpty(const Box3x &_bbox, vcg::Point3i grid_size)
{
Box3x b;
Box3x &bbox = this->bbox;
CoordType &dim = this->dim;
Point3i &siz = this->siz;
CoordType &voxel = this->voxel;
assert(!_bbox.IsNull());
bbox=_bbox;
dim = bbox.max - bbox.min;
assert((grid_size.V(0)>0)&&(grid_size.V(1)>0)&&(grid_size.V(2)>0));
siz=grid_size;
voxel[0] = dim[0]/siz[0];
voxel[1] = dim[1]/siz[1];
voxel[2] = dim[2]/siz[2];
}
/// Insert a mesh in the grid. /// Insert a mesh in the grid.
template <class OBJITER> template <class OBJITER>
void Set(const OBJITER & _oBegin, const OBJITER & _oEnd,const Box3x &_bbox=Box3x() ) void Set(const OBJITER & _oBegin, const OBJITER & _oEnd,const Box3x &_bbox=Box3x() )
@ -483,26 +506,6 @@ namespace vcg{
void _UpdateHMark(ObjType* s){ s->HMark() = this->tempMark;} void _UpdateHMark(ObjType* s){ s->HMark() = this->tempMark;}
/// create an empty spatial hash table
void InitEmpty(const Box3x &_bbox, vcg::Point3i grid_size)
{
Box3x b;
Box3x &bbox = this->bbox;
CoordType &dim = this->dim;
Point3i &siz = this->size;
CoordType &voxel = this->voxel;
assert(!_bbox.IsNull());
bbox=_bbox;
dim = bbox.max - bbox.min;
assert((grid_size.V(0)>0)&&(grid_size.V(1)>0)&&(grid_size.V(2)>0));
siz=grid_size;
voxel[0] = dim[0]/siz[0];
voxel[1] = dim[1]/siz[1];
voxel[2] = dim[2]/siz[2];
}
void getInCellUpdated(vcg::Point3i cell,std::vector<ObjPtr> &elems) void getInCellUpdated(vcg::Point3i cell,std::vector<ObjPtr> &elems)
{ {
CellIterator first,last,l; CellIterator first,last,l;