27 ArgumentNullException.ThrowIfNull(points);
30 foreach (
Vector2 point
in points) {
36 if (
Min.X ==
float.PositiveInfinity) {
37 throw new ArgumentException(
"points");
41 public static implicit
operator BoundingRectangle((
float X1,
float Y1,
float X2,
float Y2) v) =>
new(v.X1, v.Y1, v.X2, v.Y2);
47 public override string ToString() => $
"{Min},{Max}";
57 return vector.X * vector.
Y;
65 float num = circle.Center.X - Math.Clamp(circle.
Center.
X,
Min.X,
Max.X);
66 float num2 = circle.Center.Y - Math.Clamp(circle.
Center.
Y,
Min.Y,
Max.Y);
67 return num * num + num2 * num2 <= circle.Radius * circle.
Radius;
91 return MathF.Sqrt(num * num + num2 * num2);
static int Min(int x1, int x2)
static int Max(int x1, int x2)
BoundingRectangle(Vector2 min, Vector2 max)
override string ToString()
static float Distance(BoundingRectangle r, Vector2 p)
static BoundingRectangle Union(BoundingRectangle r, Vector2 p)
override bool Equals(object obj)
BoundingRectangle(IEnumerable< Vector2 > points)
bool Equals(BoundingRectangle other)
bool Intersection(BoundingCircle circle)
static BoundingRectangle Intersection(BoundingRectangle r1, BoundingRectangle r2)
bool Intersection(BoundingRectangle r)
override int GetHashCode()
static bool operator!=(BoundingRectangle a, BoundingRectangle b)
IEnumerable< Vector2 > Corners
static bool operator==(BoundingRectangle a, BoundingRectangle b)
BoundingRectangle(float x1, float y1, float x2, float y2)
static BoundingRectangle Union(BoundingRectangle r1, BoundingRectangle r2)
static Vector2 Max(Vector2 v, float f)
static Vector2 Min(Vector2 v, float f)