corrected bug on Set Function .... bbox must be exetended in order to have'nt any object on his borde
This commit is contained in:
parent
f0724dd9e9
commit
a3d7b98a34
|
@ -24,6 +24,9 @@
|
||||||
History
|
History
|
||||||
|
|
||||||
$Log: not supported by cvs2svn $
|
$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
|
Revision 1.28 2005/10/02 23:15:26 cignoni
|
||||||
Inveted the boolean sign of an assert in Grid()
|
Inveted the boolean sign of an assert in Grid()
|
||||||
|
|
||||||
|
@ -346,15 +349,23 @@ namespace vcg {
|
||||||
{
|
{
|
||||||
OBJITER i;
|
OBJITER i;
|
||||||
Box3<FLT> b;
|
Box3<FLT> b;
|
||||||
|
int _size=std::distance<OBJITER>(_oBegin,_oEnd);
|
||||||
if(!_bbox.IsNull()) bbox=_bbox;
|
if(!_bbox.IsNull())
|
||||||
|
bbox=_bbox;
|
||||||
else
|
else
|
||||||
|
{
|
||||||
for(i = _oBegin; i!= _oEnd; ++i)
|
for(i = _oBegin; i!= _oEnd; ++i)
|
||||||
{
|
{
|
||||||
(*i).GetBBox(b);
|
(*i).GetBBox(b);
|
||||||
bbox.Add(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;
|
dim = bbox.max - bbox.min;
|
||||||
BestDim( _size, dim, siz );
|
BestDim( _size, dim, siz );
|
||||||
// find voxel size
|
// find voxel size
|
||||||
|
@ -456,7 +467,7 @@ namespace vcg {
|
||||||
{
|
{
|
||||||
return(vcg::GridGetInSphere<GridPtrType,
|
return(vcg::GridGetInSphere<GridPtrType,
|
||||||
OBJPOINTDISTFUNCTOR,OBJMARKER,OBJPTRCONTAINER,DISTCONTAINER,POINTCONTAINER>
|
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>
|
template <class OBJMARKER, class OBJPTRCONTAINER>
|
||||||
|
|
|
@ -24,6 +24,9 @@
|
||||||
History
|
History
|
||||||
|
|
||||||
$Log: not supported by cvs2svn $
|
$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
|
Revision 1.11 2005/10/03 10:05:26 pietroni
|
||||||
changed Set functions, added possibility to pass the bbox as parameter
|
changed Set functions, added possibility to pass the bbox as parameter
|
||||||
|
|
||||||
|
@ -347,15 +350,21 @@ namespace vcg{
|
||||||
{
|
{
|
||||||
OBJITER i;
|
OBJITER i;
|
||||||
Box3<FLT> b;
|
Box3<FLT> b;
|
||||||
|
int _size=std::distance<OBJITER>(_oBegin,_oEnd);
|
||||||
if(!_bbox.IsNull()) bbox=_bbox;
|
if(!_bbox.IsNull()) bbox=_bbox;
|
||||||
else
|
else
|
||||||
|
{
|
||||||
for(i = _oBegin; i!= _oEnd; ++i)
|
for(i = _oBegin; i!= _oEnd; ++i)
|
||||||
{
|
{
|
||||||
(*i).GetBBox(b);
|
(*i).GetBBox(b);
|
||||||
bbox.Add(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;
|
dim = bbox.max - bbox.min;
|
||||||
BestDim( _size, dim, siz );
|
BestDim( _size, dim, siz );
|
||||||
// find voxel size
|
// find voxel size
|
||||||
|
|
Loading…
Reference in New Issue