returned closest point was wrong.

This commit is contained in:
Federico Ponchio 2010-07-15 19:37:59 +00:00
parent ce779c0082
commit 1017656a61
1 changed files with 3 additions and 3 deletions

View File

@ -128,12 +128,15 @@ public:
ScalarType closestDist = math::Sqrt(minMaxDist) + std::numeric_limits<ScalarType>::epsilon();
ScalarType closestDistSq = closestDist * closestDist;
for (NodePtrVector_ci ci=leaves.begin(); ci!=leaves.end(); ++ci) {
if ((*ci)->ScalarValue() < closestDistSq) {
for (typename TreeType::ObjPtrVectorConstIterator si=(*ci)->oBegin; si!=(*ci)->oEnd; ++si) {
if (getPointDistance(*(*si), p, closestDist, closestPoint)) {
closestDistSq = closestDist * closestDist;
closestObject = (*si);
q = closestPoint;
minDist = closestDist;
}
}
}
@ -141,9 +144,6 @@ public:
leaves.clear();
q = closestPoint;
minDist = closestDist;
return (closestObject);
}