Fixed FastTrig codestyle

This commit is contained in:
Auxilor
2021-04-03 18:29:43 +01:00
parent b72783ac2e
commit b72046440a

View File

@@ -7,20 +7,20 @@ public class FastTrig {
/**
* Precision.
*/
private static final int precision = 100;
private static final int PRECISION = 100;
/**
* Modulus.
*/
private static final int modulus = 360 * precision;
private static final int MODULUS = 360 * PRECISION;
/**
* Sin lookup table.
*/
private static final double[] SIN_LOOKUP = new double[modulus];
private static final double[] SIN_LOOKUP = new double[MODULUS];
private static double sinLookup(final int a) {
return a >= 0 ? SIN_LOOKUP[a % modulus] : -SIN_LOOKUP[-a % modulus];
return a >= 0 ? SIN_LOOKUP[a % MODULUS] : -SIN_LOOKUP[-a % MODULUS];
}
/**
@@ -30,7 +30,7 @@ public class FastTrig {
* @return The sin.
*/
public static double sin(final double a) {
return sinLookup((int) (a * precision + 0.5f));
return sinLookup((int) (a * PRECISION + 0.5f));
}
/**
@@ -40,13 +40,13 @@ public class FastTrig {
* @return The cosine.
*/
public static double cos(final double a) {
return sinLookup((int) ((a + 90f) * precision + 0.5f));
return sinLookup((int) ((a + 90f) * PRECISION + 0.5f));
}
static {
for (int i = 0; i < SIN_LOOKUP.length; i++) {
SIN_LOOKUP[i] = Math.sin((i * Math.PI) / (precision * 180));
SIN_LOOKUP[i] = Math.sin((i * Math.PI) / (PRECISION * 180));
}
}
}