overlaps method

bool overlaps(
  1. Rectangle other
)

Whether other has a nonzero area of overlap with this rectangle.

Implementation

bool overlaps(Rectangle other) {
  if (right <= other.left || other.right <= left) return false;
  if (bottom <= other.top || other.bottom <= top) return false;
  return true;
}