chore: Vector2D DebuggerDisplay
This commit is contained in:
parent
25e3c818ce
commit
3ddf6748e2
|
@ -2,6 +2,7 @@ using System;
|
||||||
|
|
||||||
namespace Syntriax.Engine.Physics2D.Primitives;
|
namespace Syntriax.Engine.Physics2D.Primitives;
|
||||||
|
|
||||||
|
[System.Diagnostics.DebuggerDisplay($"{{{nameof(GetDebuggerDisplay)},nq}}")]
|
||||||
public record Vector2D(float X, float Y)
|
public record Vector2D(float X, float Y)
|
||||||
{
|
{
|
||||||
public readonly static Vector2D Up = new(0f, 1f);
|
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 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() => $"Vector2D({X}, {Y})";
|
||||||
|
|
||||||
|
#if DEBUG
|
||||||
|
private string GetDebuggerDisplay => $"{ToString()}, Length: {Length(this)}, LengthSquared: {LengthSquared(this)}, Normalized: {Normalize(this)}";
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue