Small bug in the computation of the intersection between the todo box and the grid bbox that failed for extrema points.

This commit is contained in:
Paolo Cignoni 2005-10-02 23:18:06 +00:00
parent 010877c2b8
commit 1422c01d7a
1 changed files with 12 additions and 3 deletions

View File

@ -24,6 +24,14 @@
History History
$Log: not supported by cvs2svn $ $Log: not supported by cvs2svn $
Revision 1.4 2005/09/30 15:12:16 cignoni
Completely rewrote the GridClosest, now it:
- works for point out of the grid
- expands the box in a distance coherent way
- does not re-visit already visited cells
- shorter code!!
( still to be tested :) )
Revision 1.3 2005/09/30 13:15:48 pietroni Revision 1.3 2005/09/30 13:15:48 pietroni
added functions: added functions:
- GetKClosest - GetKClosest
@ -83,7 +91,7 @@ namespace vcg{
Box3i iboxdone,iboxtodo; Box3i iboxdone,iboxtodo;
CoordType t_res; CoordType t_res;
SPATIAL_INDEX::CellIterator first,last,l; SPATIAL_INDEX::CellIterator first,last,l;
if(Si.bbox.IsIn(_p)) if(Si.bbox.IsInEx(_p))
{ {
Point3i _ip; Point3i _ip;
Si.PToIP(_p,_ip); Si.PToIP(_p,_ip);
@ -103,13 +111,14 @@ namespace vcg{
} }
int ix,iy,iz; int ix,iy,iz;
Box3i ibox(Point3i(0,0,0),Si.siz-Point3i(1,1,1));
do do
{ {
radius=newradius; radius=newradius;
Box3x boxtodo=Box3x(_p,radius); Box3x boxtodo=Box3x(_p,radius);
boxtodo.Intersect(Si.bbox); //boxtodo.Intersect(Si.bbox);
Si.BoxToIBox(boxtodo, iboxtodo); Si.BoxToIBox(boxtodo, iboxtodo);
iboxtodo.Intersect(ibox);
if(!boxtodo.IsNull()) if(!boxtodo.IsNull())
{ {
for (ix=iboxtodo.min[0]; ix<=iboxtodo.max[0]; ix++) for (ix=iboxtodo.min[0]; ix<=iboxtodo.max[0]; ix++)