runelite-api: replace magic number in sine/cosine calculations with pi/1024

This commit is contained in:
Adam
2017-04-09 17:10:27 -04:00
parent 4dc9a87650
commit 3f6212507d

View File

@@ -26,15 +26,16 @@ package net.runelite.api;
public class Perspective
{
public static final int[] SINE = new int[2048];
public static final int[] COSINE = new int[2048];
private static final double UNIT = Math.PI / 1024d; // How much of the circle each unit of SINE/COSINE is
public static final int[] SINE = new int[2048]; // sine angles for each of the 2048 units, * 65536 and stored as an int
public static final int[] COSINE = new int[2048]; // cosine
static
{
for (int i = 0; i < 2048; ++i)
{
SINE[i] = (int) (65536.0D * Math.sin((double) i * 0.0030679615D));
COSINE[i] = (int) (65536.0D * Math.cos((double) i * 0.0030679615D));
SINE[i] = (int) (65536.0D * Math.sin((double) i * UNIT));
COSINE[i] = (int) (65536.0D * Math.cos((double) i * UNIT));
}
}