Ben Katz
/
Hobbyking_Cheetah_V1
FOC Implementation for putting multirotor motors in robots
FastMath/FastMath.cpp
- Committer:
- benkatz
- Date:
- 2016-10-31
- Revision:
- 14:80ce59119d93
- Parent:
- 0:4e1c4df6aabd
File content as of revision 14:80ce59119d93:
#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); }