MCPcopy Create free account
hub / github.com/DGVPSH/SlackOpen / MathUtils

Class MathUtils

src/main/java/net/optifine/util/MathUtils.java:5–94  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3import net.minecraft.util.MathHelper;
4
5public class MathUtils
6{
7 public static final float PI = (float)Math.PI;
8 public static final float PI2 = ((float)Math.PI * 2F);
9 public static final float PId2 = ((float)Math.PI / 2F);
10 private static final float[] ASIN_TABLE = new float[65536];
11
12 public static float asin(float value)
13 {
14 return ASIN_TABLE[(int)((double)(value + 1.0F) * 32767.5D) & 65535];
15 }
16
17 public static float acos(float value)
18 {
19 return ((float)Math.PI / 2F) - ASIN_TABLE[(int)((double)(value + 1.0F) * 32767.5D) & 65535];
20 }
21
22 public static int getAverage(int[] vals)
23 {
24 if (vals.length <= 0)
25 {
26 return 0;
27 }
28 else
29 {
30 int i = getSum(vals);
31 int j = i / vals.length;
32 return j;
33 }
34 }
35
36 public static int getSum(int[] vals)
37 {
38 if (vals.length <= 0)
39 {
40 return 0;
41 }
42 else
43 {
44 int i = 0;
45
46 for (int j = 0; j < vals.length; ++j)
47 {
48 int k = vals[j];
49 i += k;
50 }
51
52 return i;
53 }
54 }
55
56 public static int roundDownToPowerOfTwo(int val)
57 {
58 int i = MathHelper.roundUpToPowerOfTwo(val);
59 return val == i ? i : i / 2;
60 }
61
62 public static boolean equalsDelta(float f1, float f2, float delta)

Callers

nothing calls this directly

Calls 1

asinMethod · 0.80

Tested by

no test coverage detected