move imgui property code and Pysics Actor code to a single file

This commit is contained in:
2026-01-10 14:48:17 +08:00
parent 9e1474e643
commit f857d8e791
16 changed files with 442 additions and 210 deletions

View File

@ -29,6 +29,29 @@ namespace Prism
Y = Mathf.Clamp(Y, min.Y, max.Y);
}
public float LengthSquared()
{
return X * X + Y * Y;
}
public float Length()
{
return (float)Math.Sqrt(X * X + Y * Y);
}
public Vec2 Normalized()
{
float length = Length();
return new Vec2(X / length, Y / length);
}
public void Normalize()
{
float length = Length();
X = X / length;
Y = Y / length;
}
public static Vec2 operator -(Vec2 l, Vec2 r)
{
return new Vec2(l.X - r.X, l.Y - r.Y);

View File

@ -60,6 +60,11 @@ namespace Prism
Z = Mathf.Clamp(Z, min.Z, max.Z);
}
public float LengthSquared()
{
return X * X + Y * Y + Z * Z;
}
public float Length()
{
return (float)Math.Sqrt(X * X + Y * Y + Z * Z);