-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathRadicalMath.java
47 lines (38 loc) · 1.09 KB
/
RadicalMath.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
/**
* Contains many of the math functions for various purposes.
*
* @author Rafa, Kaffeinated, Omar Wally
*/
class RadicalMath {
public static float sin_m_zy;
public static float cos_m_zy;
public static float sin_m_xz;
public static float cos_m_xz;
public static float sin_m_xy;
public static float cos_m_xy;
static private final float[] tcos = new float[360];
static private final float[] tsin = new float[360];
static {
for (int i = 0; i < 360; i++) {
tcos[i] = (float) Math.cos(i * 0.01745329251994329576922);
}
//3.14159265358979323846 / 180 = 0.01745329251994329576922
for (int i = 0; i < 360; i++) {
tsin[i] = (float) Math.sin(i * 0.01745329251994329576922);
}
}
static public float cos(int i) {
for (/**/; i >= 360; i -= 360) {
}
for (/**/; i < 0; i += 360) {
}
return tcos[i];
}
static public float sin(int i) {
for (/**/; i >= 360; i -= 360) {
}
for (/**/; i < 0; i += 360) {
}
return tsin[i];
}
}