source: OniSplit/Math/FMath.cs@ 1170

Last change on this file since 1170 was 1114, checked in by iritscen, 5 years ago

Adding OniSplit source code (v0.9.99.0). Many thanks to Neo for all his work over the years.

File size: 959 bytes
Line 
1using System;
2
3namespace 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}
Note: See TracBrowser for help on using the repository browser.