Firmware
Macros | Functions
Limits.hpp File Reference

Limiting / constrain helper functions. More...

#include <float.h>
#include <math.h>
#include <stdint.h>

Go to the source code of this file.

Macros

#define MATH_PI   3.141592653589793238462643383280
 

Functions

template<typename _Tp >
constexpr _Tp math::min (_Tp a, _Tp b)
 
template<typename _Tp >
constexpr _Tp math::max (_Tp a, _Tp b)
 
template<typename _Tp >
constexpr _Tp math::constrain (_Tp val, _Tp min_val, _Tp max_val)
 
constexpr int16_t math::constrainFloatToInt16 (float value)
 Constrain float values to valid values for int16_t. More...
 
template<typename _Tp >
constexpr bool math::isInRange (_Tp val, _Tp min_val, _Tp max_val)
 
template<typename T >
constexpr T math::radians (T degrees)
 
template<typename T >
constexpr T math::degrees (T radians)
 
bool math::isZero (float val)
 Safe way to check if float is zero.
 
bool math::isZero (double val)
 Safe way to check if double is zero.
 

Detailed Description

Limiting / constrain helper functions.

Function Documentation

§ constrainFloatToInt16()

constexpr int16_t math::constrainFloatToInt16 ( float  value)

Constrain float values to valid values for int16_t.

Invalid values are just clipped to be in the range for int16_t.