It's more of a math question. So a bezier curve has the following formula, both in the
B_x(t) = (1-t)^3 * P0_x + (1-t)^2 * t * P1_x + (1-t) * t^2 * P2_x + t^3 * P3_x
B_y(t) = (1-t)^3 * P0_y + (1-t)^2 * t * P1_y + (1-t) * t^2 * P2_x + t^3 * P3_y
Length traveled by
t along a curve
gamma is given by:
length_gamma(t) = integration( sqrt( derivative( gamma_x(s) ) ^2 + derivative( gamma_y(s) ) ^2 ) )
There's no human-writable solution to the integral, so you have to approximate.
gamma(t) by the expression
B(t) to get the length
length_B traveled by
t along the bezier segment. Let's say it travels from
n values between
L that correspond to the evenly spaced points. For examples, lengths of the form
Now you need to inverse the function
length_B, so you can compute the
t back from the length
l. It's quite a lot of math and I'm lazy as hell, try doing it yourself. If you can't, you can go to the math stackexchange. For a more complete answer, you can go there anyway.
Once you have that inverse
length_B function (or a reasonable approximation), you process is quite simple.
- Create lengths
l[k] of given path distance away from the origin
- Compute their corresponding
- Positing the points using