Re: How to find closest point(s) around a specific point in point cloud?
- From: Ben C <spamspam@xxxxxxxxx>
- Date: Sun, 30 Mar 2008 16:29:59 -0500
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]]
.
- References:
- Prev by Date: Re: spinoza programming language status report
- Next by Date: Re: How to find closest point(s) around a specific point in point cloud?
- Previous by thread: How to find closest point(s) around a specific point in point cloud?
- Next by thread: Re: How to find closest point(s) around a specific point in point cloud?
- Index(es):
Relevant Pages
|