Skip to main content
Question

Finding X nearest neighbors in a pointcloud

  • September 26, 2022
  • 2 replies
  • 62 views

markvv
Contributor
Forum|alt.badge.img+1

Hi,

I'm curious if anyone has found an efficient way to calculate the X nearest neighbors in a pointcloud or a set of 3D points from a single 3D point.

 

My current method is mathematically calculating the distance from point 1 to every point in my pointcloud with the following formula and then sorting by distance.

d (P1, P2)= ((x2 - x1)^2 + (y2 - y1)^2 + (z2 - z1)^2)^1/2  

 

It works but it's not efficient at all.

I'm curious if anybody has a more efficient idea.

 

Thanks,

Mark

 

 

 

2 replies

markvv
Contributor
Forum|alt.badge.img+1
  • Author
  • Contributor
  • 6 replies
  • September 30, 2022

A NeighborFinder that can work with 3D points would probably do the trick.

Is this on the roadmap?


geomancer
Evangelist
Forum|alt.badge.img+58
  • Evangelist
  • 932 replies
  • September 30, 2022

Maybe buffer the single 3D point with an appropriate amount, and only consider the points (or the part of the pointcloud) within the buffer.