Add Exts.ISqrt to avoid fp sqrt calculations.

This commit is contained in:
Paul Chote
2014-06-28 14:16:00 +12:00
parent 5c82fff0ef
commit 4216f66ca4
6 changed files with 93 additions and 7 deletions

View File

@@ -37,9 +37,9 @@ namespace OpenRA
public static int Dot(WVec a, WVec b) { return a.X * b.X + a.Y * b.Y + a.Z * b.Z; }
public long LengthSquared { get { return (long)X * X + (long)Y * Y + (long)Z * Z; } }
public int Length { get { return (int)Math.Sqrt(LengthSquared); } }
public int Length { get { return (int)Exts.ISqrt(LengthSquared); } }
public long HorizontalLengthSquared { get { return (long)X * X + (long)Y * Y; } }
public int HorizontalLength { get { return (int)Math.Sqrt(HorizontalLengthSquared); } }
public int HorizontalLength { get { return (int)Exts.ISqrt(HorizontalLengthSquared); } }
public WVec Rotate(WRot rot)
{