Finding the single nearest point between target and PCloud

   5296   7   2
User Avatar
Member
50 posts
Joined: July 2013
Offline
Hi, I'm trying to learn point clouds on my own, but I am kinda stuck with the execution…
In theory, point clouds do a radial look up and return the number of points specified within the radius. So, I've seen some setups where people just itterate on PCs to average and distribute some attributes, but what about:

Finding the nearest point in a point cloud and setting an attribute only to it ? It seems like if I set the max points in the pcopen() function or VOP, I get returned ALL the points the pointcloud, so the attribute I am assigning is applied to all of them. I want to have a loop like behavior with BREAK, where the assigning of attributes stops at the first point found (sorted by distance) between a target and the PC…

Any feedback and directions are welcome, I'm feeling like my head can't handle all of this PC querrying :x
User Avatar
Member
443 posts
Joined: Sept. 2012
Offline
You can't assign attribute to certain points of a geometry. But you can set different value for them. If you assign value to selected points it will automatically assign 0 to rest of points. That's why you have to initialize attribute before assigning.
For example:
You have a geometry which contains 100 points and you assign myAttribute to 0-25 with some value then Houdini automatically assign 0 to other points.
User Avatar
Member
443 posts
Joined: Sept. 2012
Offline
You can set Number of Points to 1 to get first nearest point in defined radius.
User Avatar
Member
50 posts
Joined: July 2013
Offline
PradeepBarua
You can set Number of Points to 1 to get first nearest point in defined radius.

Yeah, this is the behaviour I want… but it doesn't seem to find only 1 point, if I set max points to 1 If you can check my HIP, would be great!

Attachments:
pcopenTests2.hipnc (102.0 KB)

User Avatar
Member
8554 posts
Joined: July 2007
Offline
here is an example of how to set an attribute value on first point found by pointcloud query (or easier by using Near Point VOP)

Attachments:
set_attrib_on_closest_point.hipnc (110.9 KB)

Tomas Slancik
FX Supervisor
Method Studios, NY
User Avatar
Member
50 posts
Joined: July 2013
Offline
Ah, nice You are great tamte!
User Avatar
Member
443 posts
Joined: Sept. 2012
Offline
Here is some methods (VOPs and VEX) to get nearest point.

Attachments:
find_nearest_point.hip (126.1 KB)

User Avatar
Member
50 posts
Joined: July 2013
Offline
PradeepBarua
Here is some methods (VOPs and VEX) to get nearest point.

this also functions like a charm, thank you!
  • Quick Links