1 #ifndef __LUT 2 #define __LUT 1 3 4 #define TRIG_UNIT 511 5 #define ANGLE_UNIT 256 6 /* The same idea as 2*PI, PI/2, PI/4, etc. */ 7 #define ANGLE_UNIT_2 (ANGLE_UNIT*2) 8 #define ANGLE_UNIT_HALF (ANGLE_UNIT/2) 9 #define ANGLE_UNIT_EIGHTH (ANGLE_UNIT/8) 10 #define ANGLE_UNIT_QUART (ANGLE_UNIT/4) 11 #define ANGLE_UNIT_THREE_QUARTERS (ANGLE_UNIT*3/4) 12 13 14 long lut_sin (long a); 15 /* long lut_cos (long a); As a macro */ 16 #define lut_cos(angle) (lut_sin((angle)+ANGLE_UNIT_QUART)) 17 long lut_angle (long dx, long dy); 18 long lut_dist (long x, long y); 19 #endif 20 21 /* You see, 360 degree, 2*PI radians are more or less arbitrary angle units. 22 * Since I have created my own trig functions I can create my own 23 * angle units. I created ones that powers of 2. 24 */ 25 26 27