intersects method

bool intersects(
  1. Rect other
)

Whether or not other intersect this rectangle.

This only works for sorted rectangles.

Implementation

bool intersects(Rect other) {
  assert(other.left <= other.right && other.top <= other.bottom);
  assert(left <= right && top <= bottom);
  if (isEmpty || other.isEmpty) {
    return false;
  }
  return math.max(left, other.left) < math.min(right, other.right) &&
      math.max(top, other.top) < math.min(bottom, other.bottom);
}