ViewVC Help
View File | Revision Log | View Changeset | Root Listing
root/Oni2/OniSplit/Math/FMath.cs
Revision: 1114
Committed: Wed Jan 22 14:08:57 2020 UTC (5 years, 8 months ago) by iritscen
File size: 959 byte(s)
Log Message:
Adding OniSplit source code (v0.9.99.0). Many thanks to Neo for all his work over the years.

File Contents

# Content
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 }