MCPcopy
hub / github.com/processing/p5.js / subdivide

Method subdivide

src/type/p5.Font.js:784–791  ·  view source on GitHub ↗
(pts, pt1, pt2, md)

Source from the content-addressed store, hash-verified

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 = [];

Callers

nothing calls this directly

Calls 2

distMethod · 0.80
pushMethod · 0.45

Tested by

no test coverage detected