Pomax / bezierjs

A nodejs and client-side library for (cubic) Bezier curve work
MIT License
1.7k stars 230 forks source link

Consider adding a method to split curve into n equal parts and/or calculating C(l) - coordinates from length along the curve #185

Open igorshmukler opened 1 year ago

igorshmukler commented 1 year ago

A great library. Found it after building many of the functions you implemented. Wish I looked for this earlier.

Would be great to have a function to split curves into n equal parts and/or to calculate C(l) - coordinates from the length along the curve, rather than t. I understand that doing this requires numeric methods, but you do have LUT already. A part of the task is already complete.

Pomax commented 1 year ago

I'd probably stop just short and instead update the lut function to take a parameter that controls whether the steps are in terms of t or in terms of arc length. That way you can use the lut function to get the t values you need to then split the curve as needed yourself.