.block
height: 600
scrolling: no
border: yes
license: cc-by-4.0
calc.mjs
const ERRORS = [
"Polygon's newSize parameter can't be less than 2!",
"Parameter dots[] must contain at least 2 { x, y } objects!",
"Parameter epsilon can't be a negative value!"
];
export default function reducePolygon(dots, newSize, debug=true) {
if (newSize < 2) throw RangeError(ERRORS[0]);
let reduced, ep = 0;
This file has been truncated. show original
data.mjs
export default function mapXYTableToXYArray(t, asVectors=false) {
return t.getArray().map(asVectors && xyArrToVecMap || xyArrToXYObjMap);
}
function xyArrToVecMap([ x, y ]) {
return p5.instance && createVector(+x, +y) || new p5.Vector(+x, +y);
}
function xyArrToXYObjMap([ x, y ]) {
return { x: +x, y: +y };
This file has been truncated. show original
There are more than three files. show original