chore: Better Debugger Display Declaration
This commit is contained in:
parent
c1ea190c02
commit
cd0a100224
|
@ -2,7 +2,7 @@ using System;
|
||||||
|
|
||||||
namespace Syntriax.Engine.Physics2D.Primitives;
|
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 record Vector2D(float X, float Y)
|
||||||
{
|
{
|
||||||
public float Magnitude => Length(this);
|
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 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 static float Dot(Vector2D left, Vector2D right) => left.X * right.X + left.Y * right.Y;
|
||||||
|
|
||||||
public override string ToString() => $"Vector2D({X}, {Y})";
|
public override string ToString() => $"{nameof(Vector2D)}({X}, {Y})";
|
||||||
|
|
||||||
#if DEBUG
|
|
||||||
private string GetDebuggerDisplay => $"{ToString()}, Length: {Length(this)}, LengthSquared: {LengthSquared(this)}, Normalized: {Normalize(this)}";
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue