\r
static public final float[] sin = new float[SIN_COUNT];\r
static public final float[] cos = new float[SIN_COUNT];\r
- \r
+\r
static {\r
for (int i = 0; i < SIN_COUNT; i++) {\r
float a = (i + 0.5f) / SIN_COUNT * radFull;\r
sin[i] = (float)Math.sin(a);\r
cos[i] = (float)Math.cos(a);\r
}\r
+ for (int i = 0; i < 360; i += 90) {\r
+ sin[(int)(i * degToIndex) & SIN_MASK] = (float)Math.sin(i * degreesToRadians);\r
+ cos[(int)(i * degToIndex) & SIN_MASK] = (float)Math.cos(i * degreesToRadians);\r
+ }\r
}\r
\r
static public final float sin (float rad) {\r
- return (float)Math.sin(rad);\r
-// return sin[(int)(rad * radToIndex) & SIN_MASK];\r
+ return sin[(int)(rad * radToIndex) & SIN_MASK];\r
}\r
\r
static public final float cos (float rad) {\r
- return (float)Math.cos(rad);\r
-// return cos[(int)(rad * radToIndex) & SIN_MASK];\r
+ return cos[(int)(rad * radToIndex) & SIN_MASK];\r
}\r
\r
static public final float sinDeg (float deg) {\r
- return (float)Math.sin(degreesToRadians * deg);\r
-// return sin[(int)(deg * degToIndex) & SIN_MASK];\r
+ return sin[(int)(deg * degToIndex) & SIN_MASK];\r
}\r
\r
static public final float cosDeg (float deg) {\r
- return (float)Math.cos(degreesToRadians * deg);\r
-// return cos[(int)(deg * degToIndex) & SIN_MASK];\r
+ return cos[(int)(deg * degToIndex) & SIN_MASK];\r
}\r
\r
// ---\r