feat: AABB Center, Size & HalfSize

This commit is contained in:
Syntriax 2024-01-24 18:37:43 +03:00
parent da67f4559b
commit 528649659d
1 changed files with 4 additions and 0 deletions

View File

@ -6,6 +6,10 @@ namespace Syntriax.Engine.Physics2D.Primitives;
public record AABB(Vector2D LowerBoundary, Vector2D UpperBoundary)
{
public Vector2D Center => (LowerBoundary + UpperBoundary) * .5f;
public Vector2D Size => LowerBoundary.FromTo(UpperBoundary).Abs();
public Vector2D SizeHalf => Size * .5f;
public static AABB FromVectors(IEnumerable<Vector2D> vectors)
{
int counter = 0;