Jump to content

Extract average point


Recommended Posts

Hi everyone, after using rhino/grasshopper, and blender for a while, I just decided to getting into houdini, so that's my quest.

I would need to measure the distance between a curve and an object( the object is a pipe/tube, and a curve is an helix that goes along the tube), then copytopoints a cube with the origin on the curve going towards the tube.

In order to stay procedural, I would like to give to the cube, the exact or an avarage distance between the curve and the pipe, like so I can change the radius of the 2 components (tube and curve), and the distance of the cube will follow automatically that distance

Screenshot 2023-09-12 095619.png

Screenshot 2023-09-12 095847.png

Link to comment
Share on other sites

Non-VEX approach:
Use Ray set to Points, Minimum Distance to raycast your curve to the surface of the tube. You can merge the original curve with the raycast one, then Skin with Connectivity set to Columns. The length of each line can be computed using Measure and Attribute Promote and Transfer that value back to the points to get your distance. You can also get the average distance of all the points if you use Attribute Promote set to the Average Promotion Method, and the New Class set to Detail.

VEX approach:
Create a Point Wrangle, connect the curve to first input and tube to second input, then use the following snippet:

vector hit = minpos(1, @P);
f@dist = distance(hit, @P);

For average distance, again you can use Attribute Promote (Average) to Detail.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...