intersect method

IRect intersect(
  1. IRect other
)

Implementation

IRect intersect(IRect other) {
  final ix0 = math.max(x0, other.x0);
  final iy0 = math.max(y0, other.y0);
  final ix1 = math.min(x1, other.x1);
  final iy1 = math.min(y1, other.y1);
  if (ix0 >= ix1 || iy0 >= iy1) return IRect.empty;
  return IRect(ix0, iy0, ix1, iy1);
}