Rev 4 | Details | Compare with Previous | Last modification | View Log | RSS feed
| Rev | Author | Line No. | Line |
|---|---|---|---|
| 4 | mjames | 1 | /* |
| 2 | * ap_math.h |
||
| 3 | * |
||
| 4 | * Created on: 31 Jan 2016 |
||
| 5 | * Author: Mike |
||
| 6 | */ |
||
| 7 | |||
| 8 | #pragma once |
||
| 9 | |||
| 10 | #include <cstdint> |
||
| 11 | |||
| 12 | class ap_math |
||
| 13 | { |
||
| 14 | public: |
||
| 12 | mjames | 15 | ap_math(); |
| 16 | /* returns AP_SCALE * sin(ang) where ang is in degrees * SINE_SCALING*/ |
||
| 17 | int ap_sin(int angle); |
||
| 18 | /* returns AP_SCALE * sin(cos) where ang is in degrees * SINE_SCALING */ |
||
| 19 | int ap_cos(int angle); |
||
| 4 | mjames | 20 | |
| 21 | unsigned const AP_K = 256; |
||
| 22 | |||
| 12 | mjames | 23 | int AP_SCALE(int x) { return x / AP_K; }; |
| 4 | mjames | 24 | |
| 25 | /* the number of steps in 90 degrees */ |
||
| 12 | mjames | 26 | static int const SINE_SCALING = 4; |
| 27 | static int const SINE_STEPS = (90 * SINE_SCALING); |
||
| 4 | mjames | 28 | |
| 29 | }; |