Turn SVG path into line segments

后端 未结 2 1318
天命终不由人
天命终不由人 2020-12-18 15:36

I am trying to turn a SVG path into a list of points in Node. I\'m using elementtree to parse the SVG file.

d is the definition for the path, getPos simply turns a \

2条回答
  •  旧时难觅i
    2020-12-18 16:11

    SVG contains its own path segment parser so why reinvent the wheel. Try building on this: http://jsfiddle.net/longsonr/skWH5/

    In gecko the path is parsed by starting at the beginning, reading one non-whitespace character, then using a table of the number of expected arguments that follow to know to read so many numbers (which may have up to one comma separating them). This continues till the end of the string.

提交回复
热议问题