aboutsummaryrefslogtreecommitdiff
path: root/utils/rectintersect.js
diff options
context:
space:
mode:
authorHolden Rohrer <holden.rohrer@gmail.com>2019-12-27 00:08:46 -0500
committerHolden Rohrer <holden.rohrer@gmail.com>2019-12-27 14:57:57 -0500
commit73ba5656bd27f4fb40ef59b8a94f69c4af6b8b8a (patch)
tree8dcbc2268de77053680166e790016e398ab4cce8 /utils/rectintersect.js
parentde7d95b13af448ad2c7547060de8ce08fcedd3e4 (diff)
added more utils
Diffstat (limited to 'utils/rectintersect.js')
-rw-r--r--utils/rectintersect.js9
1 files changed, 9 insertions, 0 deletions
diff --git a/utils/rectintersect.js b/utils/rectintersect.js
new file mode 100644
index 0000000..bd2c479
--- /dev/null
+++ b/utils/rectintersect.js
@@ -0,0 +1,9 @@
+// Provides rectIntersect, to determine if two rectangles intersect (and hide the code)
+
+module.exports = function(one, two){ // Rectangles defined by min/max pairs of y/x coords
+ if ( one[0][0] > two[1][0] ||
+ two[0][0] > one[1][0] ||
+ one[0][1] > two[1][1] ||
+ two[0][1] > two[1][1] ) return false;
+ return true;
+}