@woosh/meep-engine
Version:
Pure JavaScript game engine. Fully featured and production ready.
29 lines (21 loc) • 545 B
JavaScript
import AABB2 from "../../2d/aabb/AABB2.js";
/**
*
* @param {AABB2[]} boxes
* @return {boolean}
*/
function validate(boxes) {
const numPatches = boxes.length;
let i, j;
for (i = 0; i < numPatches; i++) {
const p0 = boxes[i];
for (j = i + 1; j < numPatches; j++) {
const p1 = boxes[j];
if (p0.computeOverlap(p1, new AABB2())) {
console.warn("Overlap", p0, p1);
return false;
}
}
}
return true;
}