intersect method
Implementation
Bounds<T>? intersect(Bounds<T> b) {
final leftX = math.max(min.x, b.min.x);
final rightX = math.min(max.x, b.max.x);
final topY = math.max(min.y, b.min.y);
final bottomY = math.min(max.y, b.max.y);
if (leftX <= rightX && topY <= bottomY) {
return Bounds(CustomPoint(leftX, topY), CustomPoint(rightX, bottomY));
}
return null;
}