corrected bug on Set Function .... bbox must be exetended in order to have'nt any object on his borde

This commit is contained in:
Nico Pietroni 2005-10-05 17:05:08 +00:00
parent f0724dd9e9
commit a3d7b98a34
2 changed files with 123 additions and 103 deletions

View File

@ -24,6 +24,9 @@
History
$Log: not supported by cvs2svn $
Revision 1.29 2005/10/03 13:57:56 pietroni
added GetInSphere and GetInBox functions
Revision 1.28 2005/10/02 23:15:26 cignoni
Inveted the boolean sign of an assert in Grid()
@ -346,15 +349,23 @@ namespace vcg {
{
OBJITER i;
Box3<FLT> b;
if(!_bbox.IsNull()) bbox=_bbox;
int _size=std::distance<OBJITER>(_oBegin,_oEnd);
if(!_bbox.IsNull())
bbox=_bbox;
else
{
for(i = _oBegin; i!= _oEnd; ++i)
{
(*i).GetBBox(b);
bbox.Add(b);
}
int _size=std::distance<OBJITER>(_oBegin,_oEnd);
///inflate the bb calculated
ScalarType infl=bbox.Diag()/_size;
bbox.min-=vcg::Point3d(infl,infl,infl);
bbox.max+=vcg::Point3d(infl,infl,infl);
}
dim = bbox.max - bbox.min;
BestDim( _size, dim, siz );
// find voxel size
@ -456,7 +467,7 @@ namespace vcg {
{
return(vcg::GridGetInSphere<GridPtrType,
OBJPOINTDISTFUNCTOR,OBJMARKER,OBJPTRCONTAINER,DISTCONTAINER,POINTCONTAINER>
(*this,_getPointDistance,_marker,_p,_r,_maxDist,_objectPtrs,_distances,_points));
(*this,_getPointDistance,_marker,_p,_r,_objectPtrs,_distances,_points));
}
template <class OBJMARKER, class OBJPTRCONTAINER>

View File

@ -24,6 +24,9 @@
History
$Log: not supported by cvs2svn $
Revision 1.12 2005/10/03 13:58:21 pietroni
added GetInSphere and GetInBox functions
Revision 1.11 2005/10/03 10:05:26 pietroni
changed Set functions, added possibility to pass the bbox as parameter
@ -347,15 +350,21 @@ namespace vcg{
{
OBJITER i;
Box3<FLT> b;
int _size=std::distance<OBJITER>(_oBegin,_oEnd);
if(!_bbox.IsNull()) bbox=_bbox;
else
{
for(i = _oBegin; i!= _oEnd; ++i)
{
(*i).GetBBox(b);
bbox.Add(b);
}
///inflate the bb calculated
ScalarType infl=bbox.Diag()/_size;
bbox.min-=vcg::Point3d(infl,infl,infl);
bbox.max+=vcg::Point3d(infl,infl,infl);
}
int _size=std::distance<OBJITER>(_oBegin,_oEnd);
dim = bbox.max - bbox.min;
BestDim( _size, dim, siz );
// find voxel size