bezierjs icon indicating copy to clipboard operation
bezierjs copied to clipboard

add in SVG parsing

Open Pomax opened this issue 4 years ago • 2 comments

The old SVG parsing was throwaway code and was never part of the public API. I've ripped it out so so it can be done properly. An implementation task list:

  • [ ] PolyBezier.fromSVG(path) for accepting a full path
    • [ ] convert any line (LVH) into a quadratic {S, (S+E)/2, E}
    • [ ] convert any elliptical arc (A) into one or more cubics
  • [ ] Bezier.fromSVG(pathsegment) for accepting individual curves (note that arcs cannot be supported by this call)
  • [ ] PolyBezier.toSVG(), as aggregate call for all contained Bezier objects
    • [ ] remember to replace a b M a b with just a b (because each Bezier toSVG() starts with M)
  • [x] Bezier.toSVG(), already implemented

To make this easier, path normalization can be taken from https://github.com/Pomax/svg-path-reverse/blob/gh-pages/reverse.js

Pomax avatar Nov 15 '20 18:11 Pomax

https://github.com/thednp/svg-path-commander has implemented a lot of this.

nathanwinder avatar Apr 01 '23 21:04 nathanwinder

But does way more than is needed here, and at almost 10x the size of this library, definitely not happening.

Pomax avatar Apr 04 '23 04:04 Pomax