Hi,
I'm looking for a way to find the nearest neighbour to a point in a point cloud. As far as I understand the getneighbour() VEX function only works for points in geometry?
Thanks,
Fredrik
Finding nearest neighbour in point cloud?
24165 8 0- Fr3drik
- Member
- 36 posts
- Joined: Oct. 2007
- Offline
- brianBurke
- Member
- 192 posts
- Joined: Nov. 2008
- Offline
- mark
- Staff
- 2638 posts
- Joined: July 2005
- Offline
brianBurke
Hi Fredrik. If you set the number of points to open to be 1 and the search radius to a really huge number (to ensure you'll always open one point) you'll return a handle containing only the nearest neighbor to the point position you're searching from.
Brian is talking of the pcopen() function.
- Fr3drik
- Member
- 36 posts
- Joined: Oct. 2007
- Offline
- brianBurke
- Member
- 192 posts
- Joined: Nov. 2008
- Offline
Yo dude. Here's two examples of finding nearest neighbors with VOPs. The first uses pcfilter() to filter the position of the nearest point in an external point cloud. The second uses pciterate(), a function which loops over the points in the handle, to return whatever neighbor you specify within the same point cloud you're in.
Be sure to check out the docs on these functions, the documentation is very good.
Be sure to check out the docs on these functions, the documentation is very good.
- laiwayne
- Member
- 58 posts
- Joined: Sept. 2009
- Offline
- Fr3drik
- Member
- 36 posts
- Joined: Oct. 2007
- Offline
brianBurke
The first uses pcfilter() to filter the position of the nearest point in an external point cloud. The second uses pciterate(), a function which loops over the points in the handle, to return whatever neighbor you specify within the same point cloud you're in.
Thanks a lot for the examples. I must admit though that I'm not sure exactly how to use it, either… Say I wanted to, as a basic example, draw a line between a point in a pointcloud and its nearest neighbour, how would I make use of those Vop Sops of yours?
Sorry if this is super basic questions, but Vop is a bit tricky to get in to (just when I thought I started to get my head around those SOP nodes…)
Thanks,
F
- nemsi
- Member
- 2 posts
- Joined: Nov. 2016
- Offline
- Aizatulin
- Member
- 495 posts
- Joined: July 2005
- Offline
-
- Quick Links