feat: Vector2D Magnitude & MagnitudeSquared & Normalized Fields

This commit is contained in:
Syntriax 2024-01-22 19:07:50 +03:00
parent 3ddf6748e2
commit 30102f142c
1 changed files with 4 additions and 0 deletions

View File

@ -5,6 +5,10 @@ namespace Syntriax.Engine.Physics2D.Primitives;
[System.Diagnostics.DebuggerDisplay($"{{{nameof(GetDebuggerDisplay)},nq}}")]
public record Vector2D(float X, float Y)
{
public float Magnitude => Length(this);
public float MagnitudeSquared => LengthSquared(this);
public Vector2D Normalized => Normalize(this);
public readonly static Vector2D Up = new(0f, 1f);
public readonly static Vector2D Down = new(0f, -1f);
public readonly static Vector2D Left = new(-1f, 0f);