enlarge method

BBox enlarge(
  1. BBox other
)

Returns the smallest box enclosing both this and other.

Implementation

BBox enlarge(BBox other) {
  assert(other.dims == dims);
  final out = List<double>.filled(2 * dims, 0);
  for (var i = 0; i < dims; i++) {
    out[i] = math.min(bounds[i], other.bounds[i]);
    out[i + dims] = math.max(bounds[i + dims], other.bounds[i + dims]);
  }
  return BBox(dims, out);
}