gba-trycatch

annotate src/sincos.h @ 11:c47e54796b82

added a simple README
author John Tsiombikas <nuclear@member.fsf.org>
date Sun, 22 Jun 2014 07:54:29 +0300
parents 8e9225853d75
children
rev   line source
nuclear@3 1 #ifndef SINCOS_H_
nuclear@3 2 #define SINCOS_H_
nuclear@3 3
nuclear@3 4 #include <stdint.h>
nuclear@3 5
nuclear@4 6 /*#define M_PI_X16 (int32_t)(M_PI * 65536.0) */
nuclear@4 7 #define M_PI_X16 (int32_t)((31416 << 16) / 10000)
nuclear@3 8
nuclear@3 9 #define SINLUT_SCALE 512
nuclear@3 10 #define SINLUT_SIZE 512
nuclear@3 11 int16_t sinlut[SINLUT_SIZE];
nuclear@3 12
nuclear@3 13 void sincos_init(void);
nuclear@3 14
nuclear@3 15 /* takes angle in [0, SINLUT_SIZE] and returns:
nuclear@3 16 * sin(2 * angle / SINLUT_SIZE / pi) * SINLUT_SCALE
nuclear@3 17 */
nuclear@3 18 int16_t sin_int(int16_t norm_angle);
nuclear@3 19 int16_t cos_int(int16_t norm_angle);
nuclear@3 20
nuclear@3 21 /* takes angle in fixed point 16.16 radians [0, 2pi << 16]
nuclear@3 22 * and returns 16.16 fixed point in [-1 << 16, 1 << 16]
nuclear@3 23 */
nuclear@3 24 int32_t sin_x16(int32_t radians);
nuclear@3 25 int32_t cos_x16(int32_t radians);
nuclear@3 26
nuclear@3 27 #endif /* SINCOS_H_ */