Jump to content
Developer Wiki and Function Reference Links Read more... ×
Mark Ernst

Position of point on curve

Recommended Posts

Hi there, 

 

Is there a possibility to find the position on a nurbs-curve of a point in marionette? I have the XYZ coordinates of the point, and I know the nurbs curve is going through the point. but now I need to know the points position relative to the length of the curve (so between 0 and 1). 

The ' Points on curve' node is doing the exact opposite of what I need, it gives the XYZ coordinates of a point at the given position on the curve.

The only node I can find that does something similar is the 'Get Parameter'  node, but this only gives me the parameter, not the position. Since it's a 3D curved nurbs, the parameter is not the same as the position.
 

Thank you for your help!

Share this post


Link to post

This isn't the most elegant solution, but it works. You may need to play with your iCount value in the Range node, or the epsilon value in the Equal node to dial things in.

(Also, note that the Points on Curve node here is modified, I found some bugs in the shipped one)

 

The network above the curve shows the simplest way to use this. The problem here is that if you have too many numbers coming out of your range node, the network will hang and the application will become unresponsive. This can be remedied by using modified versions of the bottom network which will allow you to dial in on the subsection that is closer to the value. So in that network, I find out what the 5 closest values to the position are and then subdivide those again to dial in closer to the actual value. It's very unlikely that you will ever reach the EXACT position where the point is, but you can get very, very close (the closeness is defined by the epsilon value in your equals node)

 

I hope this helps, and I can answer any other questions you may have.

PtPosOnCurve_MFarrell.vwx

Share this post


Link to post

I am now looking to adapt the script so that I can find the position of multiple points on the curve (input as a list, with the amount of points variable). I have managed to do this with the simple version of the script, using Mix2 - Cross reference. However, when I try this on the more accurate script, I get a problem at dialing in closer to the values, because the min item and max item are taken from 1 list with all input points together, not per individual input point.

 

Is there a way to split these list and apply the min and max item per part of the list, keeping in mind that the amount of splits is variable ? Or should I approach the problem different? ' Grafting'  the list would work I think, but it doesn't seem possible within VW?

Edited by Mark Ernst

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

 

7150 Riverwood Drive, Columbia, Maryland 21046, USA   |   Contact Us:   410-290-5114

 

© 2018 Vectorworks, Inc. All Rights Reserved. Vectorworks, Inc. is part of the Nemetschek Group.

×