1. override
Rectangle<T> boundingBox(Rectangle<T> other)

Returns a new rectangle which completely contains this and other.

Source

@override
Rectangle<T> boundingBox(math.Rectangle<T> other) {
  T rLeft = min(left, other.left);
  T rTop = min(top, other.top);
  T rRight = max(right, other.right);
  T rBottom = max(bottom, other.bottom);
  return new Rectangle<T>(rLeft, rTop, rRight - rLeft, rBottom - rTop);
}