Distance at Point along Curve

   7382   7   3
User Avatar
Member
5 posts
Joined: Sept. 2018
Offline
Hi there,

I've been struggling finding a way to get the actual distance at any given point along a curve.
My points are not equally distributed along the curve and the curve may be closed.

A little visualization:


I tried xyzdist() but that only gives me equally values across the curve.

My xyzdist() snippet:

vector primuv;
float dist = xyzdist(3, @P, 0, primuv);
f@u = primuv.x;

I would appreciate if someone gives me a hint how to solve this or a solution.


Kind regards,
Kilian
User Avatar
Member
802 posts
Joined: Feb. 2017
Offline
Hey Kilian,

you can use a resample node. disable the maximum segment length and check curve u attribute. it is exactly the value you are looking for.

Cheers
CYTE
User Avatar
Member
5 posts
Joined: Sept. 2018
Offline
Thanks for the tip but I'm afraid I still get the equal values. Do I miss something? I also tried running a polypath before the resample.


Edited by kgg - July 6, 2020 06:09:54
User Avatar
Member
1853 posts
Joined: May 2006
Offline
Try a uvtexture sop in ‘arc length spline’ mode, set to run on points.
http://www.tokeru.com/cgwiki [www.tokeru.com]
https://www.patreon.com/mattestela [www.patreon.com]
User Avatar
Member
9380 posts
Joined: July 2007
Offline
for polygonal curves you can also use Edge Transport SOP
Tomas Slancik
CG Supervisor
Framestore, NY
User Avatar
Member
5 posts
Joined: Sept. 2018
Offline
mestela
Try a uvtexture sop in ‘arc length spline’ mode, set to run on points.

This works like a charm!
Thank you for your time!
Edited by kgg - July 6, 2020 16:16:52
User Avatar
Member
447 posts
Joined: April 2018
Offline
The Distance Along Geometry SOP does exactly this.
User Avatar
Member
1 posts
Joined: Sept. 2016
Offline
eikonoklastes
The Distance Along Geometry SOP does exactly this.

Thanks, @eikonoklastes.
  • Quick Links