chore: Vector2D DebuggerDisplay

This commit is contained in:
Syntriax 2024-01-22 19:03:16 +03:00
parent 25e3c818ce
commit 3ddf6748e2
1 changed files with 5 additions and 0 deletions

View File

@ -2,6 +2,7 @@ using System;
namespace Syntriax.Engine.Physics2D.Primitives;
[System.Diagnostics.DebuggerDisplay($"{{{nameof(GetDebuggerDisplay)},nq}}")]
public record Vector2D(float X, float Y)
{
public readonly static Vector2D Up = new(0f, 1f);
@ -32,4 +33,8 @@ public record Vector2D(float X, float Y)
public static float Dot(Vector2D left, Vector2D right) => left.X * right.X + left.Y * right.Y;
public override string ToString() => $"Vector2D({X}, {Y})";
#if DEBUG
private string GetDebuggerDisplay => $"{ToString()}, Length: {Length(this)}, LengthSquared: {LengthSquared(this)}, Normalized: {Normalize(this)}";
#endif
}