diff --git a/vcg/complex/trimesh/closest.h b/vcg/complex/trimesh/closest.h index 0260c89b..f1056f73 100644 --- a/vcg/complex/trimesh/closest.h +++ b/vcg/complex/trimesh/closest.h @@ -24,6 +24,9 @@ History $Log: not supported by cvs2svn $ +Revision 1.7 2005/09/14 12:56:47 pietroni +used closest function from grid + Revision 1.6 2005/08/26 09:12:48 cignoni changed typedef A2UGridLink da 'GridStaticPtr::Link' a typedef 'GRID::Link' @@ -201,11 +204,11 @@ void Closest( MESH & mesh, const Point3 & p, GRID & gr, SCALAR & mdist, // break; // vdist += vstep; //} - - scalar error = gr.bbox.Diag(); + + scalar error = mdist; typedef Tmark Marker; Marker t=Marker(mesh); - MESH::FaceType* bestf= gr.GetClosest(p,mdist,bestq,t); + MESH::FaceType* bestf= gr.GetClosest(p,error,bestq,t); if(mdist > scalar(fabs(error))) { diff --git a/vcg/space/index/grid_static_ptr.h b/vcg/space/index/grid_static_ptr.h index 8cd25d9c..a3f736dd 100644 --- a/vcg/space/index/grid_static_ptr.h +++ b/vcg/space/index/grid_static_ptr.h @@ -24,6 +24,9 @@ History $Log: not supported by cvs2svn $ +Revision 1.21 2005/09/14 13:27:38 spinelli +minor changes + Revision 1.20 2005/09/14 12:57:52 pietroni canged template parameters for Closest Function (use of TempMark class) @@ -342,6 +345,9 @@ namespace vcg { int iy = int( dy ); int iz = int( dz ); + if (!bbox.IsIn(p)) + assert (0);///the grid has to be extended until the point + double voxel_min=voxel[0]; if (voxel_min