returned closest point was wrong.
This commit is contained in:
parent
ce779c0082
commit
1017656a61
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue