chore: Better Debugger Display Declaration

This commit is contained in:
Syntriax 2024-01-22 19:15:02 +03:00
parent c1ea190c02
commit cd0a100224
1 changed files with 2 additions and 6 deletions

View File

@ -2,7 +2,7 @@ using System;
namespace Syntriax.Engine.Physics2D.Primitives;
[System.Diagnostics.DebuggerDisplay($"{{{nameof(GetDebuggerDisplay)},nq}}")]
[System.Diagnostics.DebuggerDisplay("{ToString(),nq}, Length: {Magnitude}, LengthSquared: {MagnitudeSquared}, Normalized: {Normalized}")]
public record Vector2D(float X, float Y)
{
public float Magnitude => Length(this);
@ -36,9 +36,5 @@ public record Vector2D(float X, float Y)
public static float Angle(Vector2D left, Vector2D right) => MathF.Acos(Dot(left, right) / (Length(left) * Length(right)));
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
public override string ToString() => $"{nameof(Vector2D)}({X}, {Y})";
}