| 1 |
using System; |
| 2 |
|
| 3 |
namespace Oni |
| 4 |
{ |
| 5 |
internal static class FMath |
| 6 |
{ |
| 7 |
public static float Sign(float x) |
| 8 |
{ |
| 9 |
if (x > 0.0f) |
| 10 |
return 1.0f; |
| 11 |
else if (x < 0.0f) |
| 12 |
return -1.0f; |
| 13 |
else |
| 14 |
return 0.0f; |
| 15 |
} |
| 16 |
|
| 17 |
public static float Sqrt(float x) => (float)Math.Sqrt(x); |
| 18 |
public static float Sqr(float x) => x * x; |
| 19 |
public static float Atan2(float y, float x) => (float)Math.Atan2(y, x); |
| 20 |
public static float Cos(float x) => (float)Math.Cos(x); |
| 21 |
public static float Sin(float x) => (float)Math.Sin(x); |
| 22 |
public static float Acos(float x) => (float)Math.Acos(x); |
| 23 |
public static float Round(float x, int digits) => (float)Math.Round(x, digits); |
| 24 |
public static int RoundToInt32(float f) => (int)Math.Round(f); |
| 25 |
public static int TruncateToInt32(float f) => (int)Math.Truncate(f); |
| 26 |
} |
| 27 |
} |