12constexpr const inline T&
clamp(
const T& value,
const T& low,
const T& high) {
13 return (value < low) ? low : (high < value) ? high : value;
24 const T one =
static_cast<T
>(1);
25 if (score <= old_thresh) {
26 return score * new_thresh / old_thresh;
28 return one - (one - score) * (one - new_thresh) / (one - old_thresh);
33 float range = max_val - min_val;
34 return val - range * std::floor((val - min_val) / range);
constexpr const T & clamp(const T &value, const T &low, const T &high)
T scale_score(T score, T old_thresh, T new_thresh)
float wrap_to_range(float val, float min_val, float max_val)