6 * Sine and Cosine of arctangents, calculated by
7 * (sin(atan(index/100.0))*1024.+0.5)
8 * (cos(atan(index/100.0))*1024.+0.5)
9 * To use, get rational tangent between 0<=tan<=1, scale by 100,
10 * and look up sin and cos, and use linear interpolation. divide by 1024.
11 * Maximum error is 0.0020. Without linear interpolation, it's 0.010.
226 icossin2(int x, int y, int *cosp, int *sinp)
228 int sinsign, cossign, tan, tan10, rem;
233 *sinp = ICOSSCALE, *cosp = 0;
235 *sinp = -ICOSSCALE, *cosp = 0;
238 sinsign = cossign = 1;
250 stp = &cosinus[tan10];
256 ctp = &cosinus[tan10];
258 rem = tan-(tan10*10);
259 *sinp = sinsign*(stp[0]+(stp[1]-stp[0])*rem/10);
260 *cosp = cossign*(ctp[0]+(ctp[1]-ctp[0])*rem/10);