From 896f7876c160b69a1b5deb65caca01eae92fc5aa Mon Sep 17 00:00:00 2001 From: Syntriax Date: Tue, 21 Oct 2025 18:57:50 +0300 Subject: [PATCH] feat: implicit conversion from circle to aabb2d --- Engine.Core/Primitives/AABB2D.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Engine.Core/Primitives/AABB2D.cs b/Engine.Core/Primitives/AABB2D.cs index cddfa74..205a095 100644 --- a/Engine.Core/Primitives/AABB2D.cs +++ b/Engine.Core/Primitives/AABB2D.cs @@ -42,6 +42,9 @@ public readonly struct AABB2D(Vector2D lowerBoundary, Vector2D upperBoundary) : public static bool operator ==(AABB2D left, AABB2D right) => left.UpperBoundary == right.UpperBoundary && left.LowerBoundary == right.LowerBoundary; public static bool operator !=(AABB2D left, AABB2D right) => left.UpperBoundary != right.UpperBoundary || left.LowerBoundary != right.LowerBoundary; + public static implicit operator AABB2D(Circle circle) => new(circle.Center - new Vector2D(circle.Radius, circle.Radius), circle.Center + new Vector2D(circle.Radius, circle.Radius)); + public static implicit operator AABB2D(Shape2D shape) => FromVectors(shape.Vertices); + /// /// Creates an from a collection of s. ///