From 3f6212507df51590b888d69f5cd3da21da91039e Mon Sep 17 00:00:00 2001 From: Adam Date: Sun, 9 Apr 2017 17:10:27 -0400 Subject: [PATCH] runelite-api: replace magic number in sine/cosine calculations with pi/1024 --- .../src/main/java/net/runelite/api/Perspective.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/runelite-api/src/main/java/net/runelite/api/Perspective.java b/runelite-api/src/main/java/net/runelite/api/Perspective.java index 154a47f9e3..559d5b9835 100644 --- a/runelite-api/src/main/java/net/runelite/api/Perspective.java +++ b/runelite-api/src/main/java/net/runelite/api/Perspective.java @@ -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)); } }