View Full Version : Finding the U parameter of a curve?
08-18-2005, 07:26 AM
I'm trying to write a MEL procedure that when given a x,y,z point and an EP curve, it would return the U parameter of the curve that is more close to that point.
I would imagine that the folllowing command would do the job...
`pointOnCurve -position $x $y $z -turnOnPercentage true -pr curve1`
but unfortunatelly it gives an error!
Any help on this?
08-18-2005, 10:26 AM
pointOnCurve can only return a position given a parameter U and not vice versa. However, closestPointOnCurve can return the closest point on curve or its U parameter given another position.
closestPointOnCurve -inPosition $x $y $z -q -paramU curve1;
hope this helps
08-18-2005, 05:31 PM
This sounds like exactly what I need...only that I cant find that MEL command anywhere!
Are you sure it is a built-in MEL command and not some extra script you have found somewhere?
After a quick search I found that this closestPointOnCurve is a MAYA API function, which doesn't help much. And it must be part of a plug-in to compile given with the Maya Developement Toolkit, right? have you been using this?
08-18-2005, 05:52 PM
Sorry, I forgot about that. It does come as a plugin which I haven't installed so I;m not sure where it came from. A search in Maya's help says its one of the example plugins in Maya's Developement tool kit. An internet search came up with this:
08-18-2005, 05:59 PM
Yeap, I just found that site as well!
So I guess I'll install this plugin since I dont seem to be able to find an another way to do it by using native MEL commands.
Thanks for your help!
08-18-2005, 07:09 PM
As far as I know there is no build-in MEL command that will calculate closest distance but alternatively you can use pointOnCurve command to find the distance between your point and a number of points on your curve and then use the shortest distance. In that case you might need to chose between precision and speed.
08-18-2005, 08:53 PM
Anyone else has tried using closestPointOnCurve?
The "Parameter U" attribute gives me a weird value that doesnt appear to be clamped between 0-1 , which is what I ultimatelly want.
08-19-2005, 11:06 AM
closestPointOnCurve returns a value between the curve's paramter range. Riobuild your curve
(Edit Curves/Rebuild Curve...) and set the parameter range to 0-1. Also check on CVs under Keep so that your curve's shape doesn't change.
08-24-2005, 04:13 AM
Yeap, I got it working with rebuiltCurve
08-24-2005, 04:13 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.
vBulletin v3.0.5, Copyright ©2000-2013, Jelsoft Enterprises Ltd.