Rauno U
/
Miisu
Six crescent shaped legs
Math.hpp
- Committer:
- sim642
- Date:
- 2016-06-21
- Revision:
- 47:4f418a4b0051
- Parent:
- 18:1437610bea8b
File content as of revision 47:4f418a4b0051:
#ifndef MATH_H #define MATH_H #include <cmath> template<typename T> T min(T a, T b) { return a < b ? a : b; } template<typename T> T max(T a, T b) { return a > b ? a : b; } template<typename T> T clamp(T val, T low, T high) { return ::min(::max(val, low), high); } template<typename T> T clampAmplitude(T val, T amp) { amp = std::abs(amp); // ensure order return clamp(val, -amp, amp); } #endif // MATH_H