Subversion Repositories libOLED

Rev

Rev 4 | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed

  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:
  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);
  20.  
  21.   unsigned const AP_K = 256;
  22.  
  23.   int AP_SCALE(int x) { return x / AP_K; };
  24.  
  25.   /* the number of steps in 90 degrees */
  26.   static int const SINE_SCALING = 4;
  27.   static int const SINE_STEPS = (90 * SINE_SCALING);
  28.  
  29. };
  30.