Spline with offset

Hello, I’ve being trying to create some kind of offset over a spline,
after some tests and researches i found out out it doesn’t work just applying an offset. the curvature and length changes based on how far it is from the spline.

so i created a parameter ‘width’ for the my spline which will generate 2 other splines, one on the right and the other on the left, and interpolate all the values based on an offset value

It is working, and there is nothing wrong (well, at least it seems right :smiley:)

What i’m trying to solve now, is “align” the progress on all 3 splines

The red line is my “original” spline
the other two (yellow) are my splines generated based on my width parameter

Those purple lines represent the progress on the spline which in this case is 0.351,
as i mentioned before, i understand that the curvature and length changes and therefore this lines are in the right positions.

But what i need is a way to calculate the progress of the yellow splines to align with the right vector of the red spline.

Is there a way to achieve this ? or am i going on a totally wrong path of having an offset ?

1 Like

If you have the red line. You need to know it’s forward vector at a point. From this you create a perpendicular vector in the road plane. And simply move you point along this vector in both positive and negative direction. Basically, from a point you need vector that goes left and right in the road plane, and use that to generate a point on the yellow line. So no need for yellow splines at all.

1 Like

Thank you for your reply.

I forgot to mentioned what I’m trying to make is an object follow this path.
My first attempt was something as you mentioned, get the right vector of the object and just apply an offset.

what happened was, an offset for the outside part the object move faster in curves and for inside offset not just slowly but also, kind flickering.

that’s why i mentioned about changing the curvature.

But i might have done something wrong, i’ll try again :smiley:

Thank you

Theoretically, if you have a central spline and two parallel splines with different total lengths, you could try aligning their progress using coefficients based on the ratio of their lengths. The idea is to calculate these coefficients by dividing the lengths of the outer splines by the length of the central spline. These coefficients could then be used to adjust the progress along the splines to try and align them. However, if the splines are very curvy and nonlinear, this method might not be accurate enough. In such cases, a more complex approach could be to break the splines into segments and calculate coefficients for each segment individually, which might provide more precise results. But both methods are theoretical and would need practical testing.