It's more of a math question. So a bezier curve has the following formula, both in the x and y component.
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.
Replace the 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 0 to L.
Now pick n values between 0 and L that correspond to the evenly spaced points. For examples, lengths of the form k*L/n for k from 0 to n.
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 (P0_x,P1_x). - Compute their corresponding
t[k] using length_B_inverse. - Positing the points using
(B_x(t[k]),B_y(t[k])).
tin, say, 100 steps, and measure the distances between the resulting points. Then, interpolate along this polyline as desired. \$\endgroup\$