MCPcopy Create free account
hub / github.com/Code-Bullet/Jump-King / pathToPoints

Function pathToPoints

libraries/p5.js:29647–29668  ·  view source on GitHub ↗
(cmds, options)

Source from the content-addressed store, hash-verified

29645// path-utils
29646
29647function pathToPoints(cmds, options) {
29648
29649 var opts = parseOpts(options, {
29650 sampleFactor: 0.1,
29651 simplifyThreshold: 0,
29652 });
29653
29654 var len = pointAtLength(cmds,0,1), // total-length
29655 t = len / (len * opts.sampleFactor),
29656 pts = [];
29657
29658 for (var i = 0; i < len; i += t) {
29659 pts.push(pointAtLength(cmds, i));
29660 }
29661
29662 if (opts.simplifyThreshold) {
29663 /*var count = */simplify(pts, opts.simplifyThreshold);
29664 //console.log('Simplify: removed ' + count + ' pts');
29665 }
29666
29667 return pts;
29668}
29669
29670function simplify(pts, angle) {
29671

Callers 1

p5.jsFile · 0.85

Calls 3

parseOptsFunction · 0.85
pointAtLengthFunction · 0.85
simplifyFunction · 0.85

Tested by

no test coverage detected