mathandy / svgpathtools

A collection of tools for manipulating and analyzing SVG Path objects and Bezier curves.
MIT License
558 stars 142 forks source link

Approximate Arcs With Beziers #130

Closed tatarize closed 3 years ago

tatarize commented 4 years ago

Closes #103 Replaces #116

Adds in the ability to replace all Arcs within a Path with either Cubic or Quadratic bezier curves. Adds in the ability to perform this action on on the Arc line segments themselves.

tatarize commented 4 years ago

Added tests for the code. I'm kinda shocked how much better Cubic is than Quad. But I guess it makes a lot of sense. @mathandy I'd be surprised if there was any objection to this code.

njhurst commented 4 years ago

The arc length test was set with a really poor target precision so that it would run quickly, I couldn't find it any more, but you should update it to the same precision as the other cases with this change. Cubic beziers converge as O(e^6), Quadratic as O(e^4), so cubics quickly dominate. For geometric approximation it's even more stark, but I don't recall the convergence rates.

mathandy commented 3 years ago

Thanks