Distance at Point along Curve

   4603   7   3
User Avatar
Member
5 posts
Joined: 9月 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
679 posts
Joined: 2月 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: 9月 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 - 2020年7月6日 06:09:54
User Avatar
Member
1737 posts
Joined: 5月 2006
Online
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
8538 posts
Joined: 7月 2007
Online
for polygonal curves you can also use Edge Transport SOP
Tomas Slancik
FX Supervisor
Method Studios, NY
User Avatar
Member
5 posts
Joined: 9月 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 - 2020年7月6日 16:16:52
User Avatar
Member
331 posts
Joined: 4月 2018
Offline
The Distance Along Geometry SOP does exactly this.
User Avatar
Member
1 posts
Joined: 9月 2016
Offline
eikonoklastes
The Distance Along Geometry SOP does exactly this.

Thanks, @eikonoklastes.
  • Quick Links