feat: implicit conversion from circle to aabb2d
This commit is contained in:
@@ -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);
|
||||
|
||||
/// <summary>
|
||||
/// Creates an <see cref="AABB2D"/> from a collection of <see cref="Vector2D"/>s.
|
||||
/// </summary>
|
||||
|
Reference in New Issue
Block a user