Initial commit: Theriapolis baseline at port/godot branch point

Captures the pre-Godot-port state of the codebase. This is the rollback
anchor for the Godot port (M0 of theriapolis-rpg-implementation-plan-godot-port.md).
All Phase 0 through Phase 6.5 work is included; Phase 7 is in flight.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
Christopher Wiebe
2026-04-30 20:40:51 -07:00
commit b451f83174
525 changed files with 75786 additions and 0 deletions
+43
View File
@@ -0,0 +1,43 @@
namespace Theriapolis.Core.Util;
/// <summary>
/// Lightweight 2D float vector for world-pixel-space polyline coordinates.
/// Intentionally avoids System.Numerics to keep Core dependency-free.
/// </summary>
public readonly struct Vec2
{
public readonly float X;
public readonly float Y;
public Vec2(float x, float y) { X = x; Y = y; }
public static Vec2 operator +(Vec2 a, Vec2 b) => new(a.X + b.X, a.Y + b.Y);
public static Vec2 operator -(Vec2 a, Vec2 b) => new(a.X - b.X, a.Y - b.Y);
public static Vec2 operator *(Vec2 a, float s) => new(a.X * s, a.Y * s);
public static Vec2 operator *(float s, Vec2 a) => new(a.X * s, a.Y * s);
public static Vec2 operator /(Vec2 a, float s) => new(a.X / s, a.Y / s);
public float LengthSquared => X * X + Y * Y;
public float Length => MathF.Sqrt(LengthSquared);
public Vec2 Normalized
{
get
{
float len = Length;
return len < 1e-6f ? new Vec2(0, 0) : this * (1f / len);
}
}
/// <summary>90° CCW rotation — perpendicular vector.</summary>
public Vec2 Perp => new(-Y, X);
public static float Dot(Vec2 a, Vec2 b) => a.X * b.X + a.Y * b.Y;
public static float DistSq(Vec2 a, Vec2 b) => (a - b).LengthSquared;
public static float Dist(Vec2 a, Vec2 b) => (a - b).Length;
/// <summary>Linear interpolation between a and b at parameter t.</summary>
public static Vec2 Lerp(Vec2 a, Vec2 b, float t) => a + (b - a) * t;
public override string ToString() => $"({X:F1}, {Y:F1})";
}