changes to comply the templatization of distance functor on the query type

This commit is contained in:
ganovelli 2008-09-24 08:45:31 +00:00
parent a952bb1801
commit 6a649ee257
1 changed files with 5 additions and 4 deletions

View File

@ -95,7 +95,7 @@ namespace vcg{
typename SPATIAL_INDEX::ObjPtr GridClosest(SPATIAL_INDEX &Si, typename SPATIAL_INDEX::ObjPtr GridClosest(SPATIAL_INDEX &Si,
OBJPOINTDISTFUNCTOR _getPointDistance, OBJPOINTDISTFUNCTOR _getPointDistance,
OBJMARKER & _marker, OBJMARKER & _marker,
const typename SPATIAL_INDEX::CoordType & _p, const typename OBJPOINTDISTFUNCTOR::QueryType & _p_obj,
const typename SPATIAL_INDEX::ScalarType & _maxDist, const typename SPATIAL_INDEX::ScalarType & _maxDist,
typename SPATIAL_INDEX::ScalarType & _minDist, typename SPATIAL_INDEX::ScalarType & _minDist,
typename SPATIAL_INDEX:: CoordType &_closestPt) typename SPATIAL_INDEX:: CoordType &_closestPt)
@ -106,6 +106,7 @@ namespace vcg{
typedef typename SPATIAL_INDEX::ScalarType ScalarType; typedef typename SPATIAL_INDEX::ScalarType ScalarType;
typedef typename SPATIAL_INDEX::Box3x Box3x; typedef typename SPATIAL_INDEX::Box3x Box3x;
Point3<ScalarType> _p = typename OBJPOINTDISTFUNCTOR::Pos(_p_obj);
// Initialize min_dist with _maxDist to exploit early rejection test. // Initialize min_dist with _maxDist to exploit early rejection test.
_minDist = _maxDist; _minDist = _maxDist;
@ -126,7 +127,7 @@ namespace vcg{
ObjPtr elem=&(**l); ObjPtr elem=&(**l);
if (!elem->IsD()) if (!elem->IsD())
{ {
if (_getPointDistance((**l), _p,_minDist, t_res)) // <-- NEW: use of distance functor if (_getPointDistance((**l), _p_obj,_minDist, t_res)) // <-- NEW: use of distance functor
{ {
winner=elem; winner=elem;
_closestPt=t_res; _closestPt=t_res;
@ -164,7 +165,7 @@ namespace vcg{
{ {
if( ! _marker.IsMarked(elem)) if( ! _marker.IsMarked(elem))
{ {
if (_getPointDistance((**l), _p, _minDist, t_res)) if (_getPointDistance((**l), _p_obj, _minDist, t_res))
{ {
winner=elem; winner=elem;
_closestPt=t_res; _closestPt=t_res;