47 #define MATH_PI 3.141592653589793238462643383280 53 template<
typename _Tp>
54 constexpr _Tp
min(_Tp a, _Tp b)
56 return (a < b) ? a : b;
59 template<
typename _Tp>
60 constexpr _Tp
max(_Tp a, _Tp b)
62 return (a > b) ? a : b;
65 template<
typename _Tp>
66 constexpr _Tp
constrain(_Tp val, _Tp min_val, _Tp max_val)
68 return (val < min_val) ? min_val : ((val > max_val) ? max_val : val);
75 return (int16_t)
math::constrain(value, (
float)INT16_MIN, (
float)INT16_MAX);
78 template<
typename _Tp>
79 constexpr
bool isInRange(_Tp val, _Tp min_val, _Tp max_val)
81 return (min_val <= val) && (val <= max_val);
87 return degrees * (
static_cast<T
>(
MATH_PI) / static_cast<T>(180));
93 return radians * (
static_cast<T
>(180) / static_cast<T>(
MATH_PI));
105 return fabs(val - 0.0) < DBL_EPSILON;
constexpr _Tp constrain(_Tp val, _Tp min_val, _Tp max_val)
constexpr T degrees(T radians)
constexpr int16_t constrainFloatToInt16(float value)
Constrain float values to valid values for int16_t.
constexpr bool isInRange(_Tp val, _Tp min_val, _Tp max_val)
bool isZero(float val)
Safe way to check if float is zero.
constexpr T radians(T degrees)
Vector< float, 6 > f(float t, const Matrix< float, 6, 1 > &, const Matrix< float, 3, 1 > &)
constexpr _Tp min(_Tp a, _Tp b)
constexpr _Tp max(_Tp a, _Tp b)