Another question:
How do I get the U coordinate of a point on a curve?
U coordinate of a point on a curve
20535 10 2- dinkleberry
- Member
- 48 posts
- Joined: Oct. 2009
- Offline
- symek
- Member
- 1390 posts
- Joined: July 2005
- Offline
- dinkleberry
- Member
- 48 posts
- Joined: Oct. 2009
- Offline
- old_school
- Staff
- 2540 posts
- Joined: July 2005
- Offline
Depending on what you want, you can also use the primuv() expression to fetch any attribute value at the specific u and v position along the curve. If you query the “P” attribute you get the actual “u” position along the curve.
It is common to wrap primuv() with the pointdist() expression which will return you the closest spot on a primitive from a given point.
It is common to wrap primuv() with the pointdist() expression which will return you the closest spot on a primitive from a given point.
There's at least one school like the old school!
- tjeeds
- Member
- 339 posts
- Joined: Aug. 2007
- Offline
- symek
- Member
- 1390 posts
- Joined: July 2005
- Offline
tjeeds
I've been looking for a vex version of pointdist, seems like the Primitive Attribute VOP does the same thing as the primuv expression but is there a vex equivalent of pointdist?
I'm afraid there is not. People are asking for this a lot. Looks like a good candidate for a RFE.
Here [forums.odforce.net] you have a discussion on similar issue.
- keyframe
- Member
- 1533 posts
- Joined: July 2005
- Offline
- cb
- Staff
- 635 posts
- Joined: July 2005
- Offline
keyframe
Just for the record, there is another way…
Using an attribcreate sop, create a float point attribute, and set the following as the expression:
fit($PT, 0, $NPT-1, 0, 1)
G
This assumes uniform parameterization and a 0-1 domain, which is not always the case with NURBS and Bezier curves. Also, I am not sure it handles closed curves well. The safest way to access the U coordinate is to use the primuv() expression, as Jeff suggested earlier.
- phtj
- Member
- 224 posts
- Joined: June 2009
- Offline
I was trying to do something similar, but I can't get it to work. I want to find the closest point on a curve, but the primuv + pointdist solution does not seem to give the right point. I think it is due to the fact that the curve does not have a domain…
I have tried various things, but no luck…
See attached file
I have tried various things, but no luck…
See attached file
Patrick
- NSDesign
- Member
- 16 posts
- Joined: Sept. 2012
- Offline
- mawi
- Member
- 251 posts
- Joined: Jan. 2008
- Offline
-
- Quick Links