alexbol99 / flatten-js

Javascript library for 2d geometry
MIT License
535 stars 56 forks source link

Support cubic bezier curves #116

Open cuixiping opened 2 years ago

cuixiping commented 2 years ago

flatten-js is a great library for web vector graphics apps. Cubic bezier curves are widely used in web apps. Is there a plan to support cubic bezier curves?

alexbol99 commented 2 years ago

Currently I don't have a plans to support bezier curves in this library

sysmaya commented 1 year ago

That's what I came to ask. Support for bezier curves. Summing up: If I handle paths like this circle "M 193.1 253.5 C 193.1 218.3 223.8 190 261.8 190 C 299.7 190 330.5 218.3 330.5 253.5 C 330.5 288.5 299.7 316.8 261.8 317 C 223.8 316.8 193.1 288.5 193.1 253.5" this library doesn't work for me.

It's a real pity. This is the best library to handle geometry. The best and most complete (almost...) :(

romgrk commented 4 months ago

In case someone needs cubic Bezier curves, I have forked the library and added support for them in https://github.com/romgrk/2d-geometry. They're not optimized much, for example the bounding box is computed by iteration rather than through the analytical solution, but they work well enough. It also has a new Path primitive that works like an SVG Path but allows operating on it, e.g. length, splitting, etc.

I have opted to fork rather than open PRs because I saw quite a few things I wanted changed for a graph library I'm working on, and going through many cycles of PR reviews wouldn't have worked for me.