build a line to the nearest point

   6512   5   1
User Avatar
Member
217 posts
Joined: Sept. 2009
Offline
Hi there,

I have grid and a single point, and want to build a line between the single point and the nearest point on the grid.

Tried it with Attributes and the Vop sop. But i cant figur out how.

Any help or suggestion would be very nice.

(I includ the hip file)

Thanks

Attachments:
createLine.hipnc (64.2 KB)

User Avatar
Member
192 posts
Joined: Nov. 2008
Offline
howdy. point cloud lookups and attribute transfer are both good ways to figure out the nearest neighbor. here's an example that shows both ways.

with attribute transfer: set the kernel radius small, use one sample, and disable distance threshold

with point clouds: set the radius super high and the number of points to one

using either of these methods, you can grab the point number of the nearest neighbor

good luck dude

Attachments:
nearestpt_line.hip (128.6 KB)

User Avatar
Member
9380 posts
Joined: July 2007
Offline
brian was faster, but here is another example file with 3 methods

one of them is pointcloud

one is just creating distance attribute to point for all points then sort by this attribute then keep first and connect to point

and the last is by using nearpoint() expression

Attachments:
createline_example.hipnc (86.7 KB)

Tomas Slancik
CG Supervisor
Framestore, NY
User Avatar
Member
217 posts
Joined: Sept. 2009
Offline
Thanks a lot guys!!!!!!
User Avatar
Member
6 posts
Joined: Dec. 2013
Offline
This is a great thread and example @tamte but the example file I'm unable to replicate in H19 as this is using nodes that are outdated by many years. Anyone keen to take a shot at creating a new demo file to solve this?
User Avatar
Member
9380 posts
Joined: July 2007
Offline
RepubliCommando
This is a great thread and example @tamte but the example file I'm unable to replicate in H19 as this is using nodes that are outdated by many years. Anyone keen to take a shot at creating a new demo file to solve this?
I'm surprised all of those still work, but also I have no recollection creating that file, so strange
here is another file with more methods, all use the same principle though

Attachments:
createline_example_more_methods.hipnc (141.4 KB)

Tomas Slancik
CG Supervisor
Framestore, NY
  • Quick Links