aboutsummaryrefslogtreecommitdiff
path: root/utils/rectintersect.js
blob: bd2c4790b5532a6139bfd9fe0017efe22c3e7e67 (plain)
1
2
3
4
5
6
7
8
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;
}