(pts, pt1, pt2, md)
| 782 | |
| 783 | // divide line-segments with intermediate points |
| 784 | const subdivide = (pts, pt1, pt2, md) => { |
| 785 | if (fn.dist(pt1.x, pt1.y, pt2.x, pt2.y) > md) { |
| 786 | let middle = { x: (pt1.x + pt2.x) / 2, y: (pt1.y + pt2.y) / 2 }; |
| 787 | pts.push(middle); |
| 788 | subdivide(pts, pt1, middle, md); |
| 789 | subdivide(pts, middle, pt2, md); |
| 790 | } |
| 791 | }; |
| 792 | |
| 793 | // a point for each path-command plus line subdivisions |
| 794 | let pts = []; |