Re: How to find closest point(s) around a specific point in point cloud?



On 2008-03-30, robert <robert.kj.karlsson@xxxxxxxxx> wrote:
I can't find any site with information about the simplest way to
locate the n number of closest points adjacent to a point in a 3d
point cloud with scattered data.

Basically, I've got an array, call it V, with a couple of hundred
positions [x,y,z] and a value (eg [0-100).

Let's say I wanted to pick the 5 closest points around a specific
point, call it P, with a value like [x,y,z] = [10,20,30]

I'm going to have to write functions in different languages, so some
generic pseudo code would be great.

Just find the distance-squared from every point to P, sort the result,
and pick the 5 closest.

Pseudo code (well Python actually)

distances = []
for point in cloud:
s = point - P # (vector subtract)
distances.append((dot(s, s), point))

distances.sort()
return [d[1] for d in distances[0:5]]
.



Relevant Pages

  • Re: How to find closest point(s) around a specific point in point cloud?
    ... Let's say I wanted to pick the 5 closest points around a specific ... one scans the cloud, calculating the distance to each point, and keeping track of the closest matches. ... this may infact be the best approach if one is doing a "one-off" query. ... a spherical query is also possible, but is problematic (the size of the sphere is very important, but may not be known prior to the query, which would require iteration). ...
    (comp.programming)
  • Re: How to find closest point(s) around a specific point in point cloud?
    ... point cloud with scattered data. ... Let's say I wanted to pick the 5 closest points around a specific ... The best thing I can think of is to use a voxel bounding box ... Interesting, for a random cloud of points, would this be more efficient ...
    (comp.programming)
  • finding de closest points
    ... i have to find the closest points of two sets of points... ... two sets of 128 points one describing a line segment and another ... but that forces me to compute 128*128 distances... ... Prev by Date: ...
    (comp.soft-sys.matlab)
  • Problem with SMALL function and multiple same values
    ... I have a column with about 1000 distances in miles to a point and I am ... trying to use the SMALL function to give me the closest, 2nd closest, ... cell that the SMALL function is returning I get the same cell address ...
    (microsoft.public.excel)