U coordinate of a point on a curve

   20641   10   2
User Avatar
Member
48 posts
Joined: 10月 2009
Offline
Another question:
How do I get the U coordinate of a point on a curve?
User Avatar
Member
1390 posts
Joined: 7月 2005
Offline
dinkleberry
Another question:
How do I get the U coordinate of a point on a curve?

Append UVTextureSOP to your curve, set Texture Type: Rows&Columns and Apply to: Point texture. Done. Points uvs follow implicit curve coordinate U.

cheers,
skk.
User Avatar
Member
48 posts
Joined: 10月 2009
Offline
Sweet, thanks.
User Avatar
スタッフ
2540 posts
Joined: 7月 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.
There's at least one school like the old school!
User Avatar
Member
339 posts
Joined: 8月 2007
Offline
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?
Jesse Erickson
Fx Animator
WDAS
User Avatar
Member
1390 posts
Joined: 7月 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.
User Avatar
Member
1533 posts
Joined: 7月 2005
Offline
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
User Avatar
スタッフ
635 posts
Joined: 7月 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.
User Avatar
Member
224 posts
Joined: 6月 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

Attachments:
test_u_point_ver2.hipnc (54.3 KB)

Patrick
User Avatar
Member
16 posts
Joined: 9月 2012
Offline
Hi All,
I'm using primuv() in VEX to get the “P” attrib on a curve at the specific UV location. Is there a way to find the opposite in VEX, given the point “P” attribute, return the UV location? Points not in a straight line, randomly positioned in space, unevenly distributed.

Thanks
User Avatar
Member
252 posts
Joined: 1月 2008
Offline
Look at xyzdist(), It will return closest prim and uv.

Returns the distance to the closest point on the geometry. This will find positions on the surfaces of the geometry, not just point positions.
  • Quick Links