namespace Infrastructure.Utils;

public class BoundingBox
{
    public double MinX { get; set; }
    public double MinY { get; set; }
    public double MaxX { get; set; }
    public double MaxY { get; set; }

    public BoundingBox(double minX, double minY, double maxX, double maxY)
    {
        MinX = minX;
        MinY = minY;
        MaxX = maxX;
        MaxY = maxY;
    }

    public static BoundingBox Merge(BoundingBox bbox1, BoundingBox bbox2)
    {
        return new BoundingBox(
            Math.Min(bbox1.MinX, bbox2.MinX),
            Math.Min(bbox1.MinY, bbox2.MinY),
            Math.Max(bbox1.MaxX, bbox2.MaxX),
            Math.Max(bbox1.MaxY, bbox2.MaxY)
        );
    }
}