feat: AABB Center, Size & HalfSize
This commit is contained in:
parent
da67f4559b
commit
528649659d
|
@ -6,6 +6,10 @@ namespace Syntriax.Engine.Physics2D.Primitives;
|
||||||
|
|
||||||
public record AABB(Vector2D LowerBoundary, Vector2D UpperBoundary)
|
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)
|
public static AABB FromVectors(IEnumerable<Vector2D> vectors)
|
||||||
{
|
{
|
||||||
int counter = 0;
|
int counter = 0;
|
||||||
|
|
Loading…
Reference in New Issue