connecting points with smallest distance

   31919   15   2
User Avatar
Member
3 posts
Joined: Sept. 2010
Offline
I have a few points scatter on a plane. how can i connect each point with other points that closest to this point ? Thank you
User Avatar
Member
63 posts
Joined: Sept. 2009
Offline
Have you tried using the fuse sop?
User Avatar
Member
24 posts
Joined: Dec. 2008
Offline
Can you explain exactly what you are looking for?. You can use expressions and particle combined with “add” SOP to connect them.
User Avatar
Member
694 posts
Joined: March 2009
Offline
alternatively you can try to use the Point Cloud tools, I think…
Toronto - ON
My Houdini playground [renderfarm.tumblr.com]
“As technology advances, the rendering time remains constant.”
User Avatar
Member
257 posts
Joined: Nov. 2007
Offline
Or you use the best of both worlds, you use pointclouds to detect the pointnumber of the closest point. And then you use a python sop to loop over the points and create a polygon (line) between those two points.
Cg Supervisor | Effects Supervisor | Expert Technical Artist at Infinity Ward
https://www.linkedin.com/in/peter-claes-10a4854/ [www.linkedin.com]
User Avatar
Member
694 posts
Joined: March 2009
Offline
pclaes
Or you use the best of both worlds, you use pointclouds to detect the pointnumber of the closest point. And then you use a python sop to loop over the points and create a polygon (line) between those two points.

how would you store the closest point info for later recovery from python node? can we create array-like attributes for points?!
Toronto - ON
My Houdini playground [renderfarm.tumblr.com]
“As technology advances, the rendering time remains constant.”
User Avatar
Member
694 posts
Joined: March 2009
Offline
nevermind… I figured you can just create a comma separated string and then convert it to a list using python…
Toronto - ON
My Houdini playground [renderfarm.tumblr.com]
“As technology advances, the rendering time remains constant.”
User Avatar
Member
22 posts
Joined: Nov. 2010
Offline
pclaes
Or you use the best of both worlds, you use pointclouds to detect the pointnumber of the closest point. And then you use a python sop to loop over the points and create a polygon (line) between those two points.

Hi Peter,

I'm trying to figure out how to make work something similar to what you suggested, but I'm quite lost..

Of course the issues that I'm facing could be more because of my lack of knowledge about VOP's, so may I ask you any example of what you mentioned? Any links or papers?

Thank you for any help
User Avatar
Member
1799 posts
Joined: Oct. 2010
Offline
I believe triangulate2D will do what you want (ie connect the dots). It does a Delaunay triangulation of a point cloud. It especially works great on flat surfaces

Note that if your geo has ondulation (ie a terrain) you can get your height back using a point SOP
-G
User Avatar
Member
22 posts
Joined: Nov. 2010
Offline
Hi Gray,

thank you for your replay. Actually triangulate2D is exactly what I'm using now (I'm trying also ClothRefine..) and it does a good job by connecting each point multiple times with the nearest ones.

But because for the final aesthetic I will use the wireframe of the topology, I was wondering if there could be a way to get a less uniform triangulation by connecting the points similarly to triangulate2D but say a little more randomly.

Basically like it happens in cobweb

Attachments:
cobweb.jpg (63.6 KB)

User Avatar
Member
1799 posts
Joined: Oct. 2010
Offline
A few things you may try:

-put a pointJitter SOP in your points before you add geo to it
-you could generate something like a cobweb using a voronoi fracture on a mesh. Then you can create a cobweb geo using a polywire or wireframe SOP
-after your triangulate2D, try adding a divide, turn off convex polygons and turn on compute dual.

I think one or a combination of these may do the trick
-G
User Avatar
Member
257 posts
Joined: Nov. 2007
Offline
Enmi
Hi Peter,

I'm trying to figure out how to make work something similar to what you suggested, but I'm quite lost..

Of course the issues that I'm facing could be more because of my lack of knowledge about VOP's, so may I ask you any example of what you mentioned? Any links or papers?

Thank you for any help


Hey,

Use a pointcloud to get the closest point (if you do not know how to use pointclouds, then do a search here or on odforce for pointclouds - and you can put my username: pclaes in there as well as I've shared some examples on pointclouds in the past), add that to an attribute called “closest_point”.

In regards to the python, it will be a python sop that reads that closest point attribute and creates a new polygon between the current point and the closest point. There is a cookbook example that can show you how to generate some of that geometry.
http://www.sidefx.com/docs/houdini11.1/hom/cookbook/surface_wires/ [sidefx.com]

I have done this in the past and made interesting spiderweb like shapes. The tricky bit is not so much straight wires, but curved wires. What starts out in a spiderweb as a straight wire can become a curved wire after it is pulled in different directions due to the tension in the web. Each segment is still straight though.

The cool bit is when you then use that “triangulate 3d” tool in a loop. As a little extra you can resample the newly generated polygons, potentially apply some noise and retriangulate using a shorter lookup distance. You then start to get a fractal nature into your patterns which is what makes it look cool.
Cg Supervisor | Effects Supervisor | Expert Technical Artist at Infinity Ward
https://www.linkedin.com/in/peter-claes-10a4854/ [www.linkedin.com]
User Avatar
Member
22 posts
Joined: Nov. 2010
Offline
Thanks a lot Gray and Peter for your replies,

I definitively have a lot to play with and to look into. I really wanna see what I can achieve and then get back to the post.
User Avatar
Member
15 posts
Joined: Sept. 2009
Offline
I've just had to do something similar to this as I needed to create a neural network of sorts.

I created a python SOP that iterates through each point and evaluates the distance to other points in the group. If the distance falls below a threshold it creates geometry between both points - subdivisions of the line are also possible.

Not very fast, you wouldn't want to use it on more than 1000 points

Thought i would include it here as it might be of use to someone… somewhere. Hope the file works.

Attachments:
point_connect_Exchange.hip (66.1 KB)

User Avatar
Member
483 posts
Joined: Dec. 2006
Offline
modified version

Attachments:
point_connect_exchange_v13.hip (127.1 KB)

English is not my native language, sorry in advance for any misunderstanding :-)
User Avatar
Member
193 posts
Joined: Aug. 2011
Offline
that's cool, thanks!
  • Quick Links