DRV8323RS Version
Dependencies: mbed-dev-f303 FastPWM3
Diff: FastMath/FastMath.cpp
- Revision:
- 0:4e1c4df6aabd
- Child:
- 20:bf9ea5125d52
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/FastMath/FastMath.cpp Fri Feb 05 00:52:53 2016 +0000 @@ -0,0 +1,14 @@ +#include "FastMath.h" +#include "LUT.h" + +const float Multiplier = 81.4873308631f; + +float FastMath::FastSin(float theta){ + if (theta < 0.0f) theta += 6.28318530718f; + if (theta >= 6.28318530718f) theta -= 6.28318530718f; + return SinTable[(int) (Multiplier*theta)] ; + } + +float FastMath::FastCos(float theta){ + return FastSin(1.57079632679f - theta); + } \ No newline at end of file