Bayley Wang
/
foc-ed_in_the_bot_compact
robot
MathHelpers/MathHelpers.cpp
- Committer:
- bwang
- Date:
- 2016-11-02
- Revision:
- 19:a6cf15f89f3d
- Child:
- 38:07cb4ae6c1bd
File content as of revision 19:a6cf15f89f3d:
#include "MathHelpers.h" float map(float x, float in_min, float in_max, float out_min, float out_max) { return (x - in_min) * (out_max - out_min) / (in_max - in_min) + out_min; } float constrain(float in, float min, float max) { if(in > max) return max; if(in < min) return min; return in; } float fminf(float a, float b) { if(a < b) return a; return b; } float fmaxf(float a, float b) { if(a > b) return a; return b; }