1 | "use strict";
|
2 | Object.defineProperty(exports, "__esModule", { value: true });
|
3 | exports.isOverlap = exports.isOverflow = exports.isInBounds = exports.parseAABB = void 0;
|
4 | function parseAABB(min2) {
|
5 | const { min, max } = min2;
|
6 | return [
|
7 | [min[0], min[1]],
|
8 | [max[0], max[1]],
|
9 | ];
|
10 | }
|
11 | exports.parseAABB = parseAABB;
|
12 |
|
13 |
|
14 |
|
15 |
|
16 |
|
17 | function isInBounds(point, bounds) {
|
18 | const [x, y] = point;
|
19 | const [min, max] = bounds;
|
20 | return x >= min[0] && x <= max[0] && y >= min[1] && y <= max[1];
|
21 | }
|
22 | exports.isInBounds = isInBounds;
|
23 |
|
24 |
|
25 |
|
26 |
|
27 |
|
28 | function isOverflow(b1, b2) {
|
29 | const [min, max] = b1;
|
30 | return !(isInBounds(min, b2) && isInBounds(max, b2));
|
31 | }
|
32 | exports.isOverflow = isOverflow;
|
33 |
|
34 |
|
35 |
|
36 |
|
37 |
|
38 |
|
39 | function isOverlap(b1, b2) {
|
40 | const [min1, max1] = b1;
|
41 | const [min2, max2] = b2;
|
42 | return (min1[0] < max2[0] &&
|
43 | max1[0] > min2[0] &&
|
44 | min1[1] < max2[1] &&
|
45 | max1[1] > min2[1]);
|
46 | }
|
47 | exports.isOverlap = isOverlap;
|
48 |
|
\ | No newline at end of file |