Open pifantastic opened 9 years ago
Here's the source if you'd like to take a look: https://github.com/alexandersimoes/d3plus/blob/master/src/geom/path2poly.coffee
It's a pretty brute force way to converting the SVG path into coordinates. Currently, I believe it only catches lines and angles (no curves).
The current implementation of
d3plus.geom.path2poly
does not correctly handle curveto commands. For example:Given a path with data:
d3plus.geom.path2poly
returns:Here is a jsbin with a reproduction: http://jsbin.com/pohudefufo/1/edit?html,js,output
I haven't dug into the issue as I'm fairly new to hacking on SVG. My current workaround is to render the paths first, and get the polygon information via
.getPointAtLength()
. However that method is quite slow.