PDA

View Full Version : pointOnCurve question (coordinates to parameter conversion)


zoster
07-29-2007, 03:05 AM
Hi,

I have a locator that is on my curve. it has some coordonates - x,y,z . i want to find out the parameter number of that point on my curve ( something like 0.346789 )

SO, if i know the coordinates of a point on a curve, how do i select that point on the curve in order to use the pointOnCurve command and get the parameter value of it?

I would be really greatful if anyoane can help me out

thanks!

PS: more detailed situation:
( i have a locator that is a result of the intersection of a curve with another curve.
i want to transform the position of that locator in a parameter regarding the (first) curve.)

pixlix2
07-30-2007, 11:02 AM
hi,
I'm not 100% sure if I understood exactly what you want, but I made a little example using the closestPointOnCruve command (i think you need to have the bonustools installed, not sure)

select the locator, then the curve and execute - a pointOnCurve node will be created at the closest position to the curve.

{
string $sel[] = `ls -sl`;
loadPlugin -quiet "closestPointOnCurve.mll" ;
float $a[] = `pointPosition ($sel[0])`;
float $uParam = `closestPointOnCurve -inPosition $a[0] $a[1] $a[2] -q -paramU $sel[1]`;
string $pNode = `createNode pointOnCurveInfo`;
connectAttr ($sel[1] + ".worldSpace") ($pNode + ".inputCurve");
setAttr ($pNode + ".parameter") $uParam;
}

CGTalk Moderation
07-30-2007, 11:02 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.