| 3893 | private static int[] DST_TABLE = new int[SIN_TABLE_SIZE+1]; |
| 3894 | // for dx=0..1 find such alpha (0..pi/2) that alpha - sin(alpha) = dx |
| 3895 | private static double shiftfn( double dx ) { |
| 3896 | double a = 0; |
| 3897 | double b = Math.PI/2; |
| 3898 | double c = 0; |
| 3899 | for ( int i=0; i<15; i++ ) { |
| 3900 | c = (a + b) / 2; |
| 3901 | double cq = c - Math.sin(c); |
| 3902 | if ( cq < dx ) |
| 3903 | a = c; |
| 3904 | else |
| 3905 | b = c; |
| 3906 | } |
| 3907 | return c; |
| 3908 | } |
| 3909 | static { |
| 3910 | for ( int i=0; i<=SIN_TABLE_SIZE; i++ ) { |
| 3911 | double angle = Math.PI / 2 * i / SIN_TABLE_SIZE; |