Rev 4 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 4 | Rev 12 | ||
|---|---|---|---|
| Line 7... | Line 7... | ||
| 7 | 7 | ||
| 8 | #pragma once |
8 | #pragma once |
| 9 | 9 | ||
| 10 | #include <cstdint> |
10 | #include <cstdint> |
| 11 | 11 | ||
| 12 | - | ||
| 13 | class ap_math |
12 | class ap_math |
| 14 | { |
13 | { |
| 15 | public: |
14 | public: |
| 16 | ap_math (); |
15 | ap_math(); |
| 17 | - | ||
| 18 | int |
- | |
| - | 16 | /* returns AP_SCALE * sin(ang) where ang is in degrees * SINE_SCALING*/ |
|
| 19 | ap_sin (int angle); |
17 | int ap_sin(int angle); |
| 20 | - | ||
| 21 | int |
- | |
| - | 18 | /* returns AP_SCALE * sin(cos) where ang is in degrees * SINE_SCALING */ |
|
| 22 | ap_cos (int angle); |
19 | int ap_cos(int angle); |
| 23 | 20 | ||
| 24 | unsigned const AP_K = 256; |
21 | unsigned const AP_K = 256; |
| 25 | 22 | ||
| 26 | int AP_SCALE(int x) {return x/AP_K; }; |
23 | int AP_SCALE(int x) { return x / AP_K; }; |
| 27 | 24 | ||
| 28 | /* the number of steps in 90 degrees */ |
25 | /* the number of steps in 90 degrees */ |
| 29 | static int const SINE_SCALING = 4; |
26 | static int const SINE_SCALING = 4; |
| 30 | static int const SINE_STEPS = (90*SINE_SCALING); |
27 | static int const SINE_STEPS = (90 * SINE_SCALING); |
| 31 | - | ||
| 32 | private: |
- | |
| 33 | - | ||
| 34 | - | ||
| 35 | - | ||
| 36 | uint8_t sintab[SINE_STEPS]; |
- | |
| 37 | 28 | ||
| 38 | }; |
29 | }; |
| 39 | - | ||