HAX IT DOES STUFFS

git-svn-id: svn://svn.ijw.co.nz/svn/OpenRa@1280 993157c7-ee19-0410-b2c4-bb4e9862e678
This commit is contained in:
chrisf
2007-07-15 17:13:35 +00:00
parent b90f1859c2
commit 0a6eaeb26f
7 changed files with 105 additions and 5 deletions

View File

@@ -48,5 +48,28 @@ namespace OpenRa.Game
{
return new float2(a.X / b.X, a.Y / b.Y);
}
public static bool WithinEpsilon(float2 a, float2 b, float e)
{
float2 d = a - b;
return Math.Abs(d.X) < e && Math.Abs(d.Y) < e;
}
static float Sign(float f)
{
if (f > 0) return 1;
if (f < 0) return -1;
return 0;
}
public float2 Sign()
{
return new float2(Sign(X), Sign(Y));
}
public static float Dot(float2 a, float2 b)
{
return a.X * b.X + a.Y * b.Y;
}
}
}