vanruesc / sparse-octree

A sparse octree data structure.
zlib License
117 stars 20 forks source link

Bug in findNearestPoint function #32

Closed IovlevYuliy closed 5 years ago

IovlevYuliy commented 5 years ago

I faced this issue when I try to find the nearest point in the point cloud. I used findNearestPoint method to do it but I have got an incorrect result. I investigated this problem. There is the following code in PointOctree.js.

child = sortedChildren[i].octant;
if(child.contains(point, bestDist))
      childResult = findNearestPoint(point, bestDist, skipSelf, child);

You use contains from PointOctant.js and pass bestDist as a parameter where bestDist is squared distance. But this function expects a linear value of bias.

vanruesc commented 5 years ago

Hi,

thanks for reporting this bug! A fix is on the way.

vanruesc commented 5 years ago

This issue should be fixed in sparse-octree@5.2.0.

When you get a chance, please check if this update fixes the issue.

IovlevYuliy commented 5 years ago

That works fine! Thanks a lot!