function testRectRect(rect1, rect2) {
  if (rectHasNoSize(rect1) || rectHasNoSize(rect2)) {
    return false;
  }

  return (
    rect1.x <= rect2.x + rect2.width &&
    rect2.x <= rect1.x + rect1.width &&
    rect1.y <= rect2.y + rect2.height &&
    rect2.y <= rect1.y + rect1.height
  );
}
/**
 * Test if a Rectangle collide with another rectangle. If so, returns true and false otherwise.
 * Both rectangles must have a width and height greather then 0.
 * @private
 * @param {object} rect
 * @param {number} rect.x - x-coordinate
 * @param {number} rect.y - y-coordinate
 * @param {number} rect.width - width
 * @param {number} rect.height - height
 * @param {object} rect
 * @param {number} rect.x - x-coordinate
 * @param {number} rect.y - y-coordinate
 * @param {number} rect.width - width
 * @param {number} rect.height - height
 * @return {boolean} true if rectangle collide with rectangle
 */
Test if a Rectangle collide with another rectangle. If so, returns true and false otherwise.
Both rectangles must have a width and height greather then 0.
Test if a Rectangle collide with another rectangle . If so returns true and false otherwise . Both rectangles must have a width and height greather then 0 .
function testRectRect(rect1, rect2) {
  if (rectHasNoSize(rect1) || rectHasNoSize(rect2)) {
    return false;
  }
  return (
    rect1.x <= rect2.x + rect2.width &&
    rect2.x <= rect1.x + rect1.width &&
    rect1.y <= rect2.y + rect2.height &&
    rect2.y <= rect1.y + rect1.height
  );
}
function testRectRect ( rect1 , rect2 ) { if ( rectHasNoSize ( rect1 ) || rectHasNoSize ( rect2 ) ) { return false ; } return ( rect1 . x <= rect2 . x + rect2 . width && rect2 . x <= rect1 . x + rect1 . width && rect1 . y <= rect2 . y + rect2 . height && rect2 . y <= rect1 . y + rect1 . height ) ; }
Test if a Rectangle collide with another rectangle.
Test if a Rectangle collide with another rectangle .