58 return (T(0) <= val) - (val < T(0));
71 const T
expo(
const T &value,
const T &e)
75 return (1 - ec) * x + ec * x * x * x;
90 const T
superexpo(
const T &value,
const T &e,
const T &g)
94 return expo(x, e) * (1 - gc) / (1 - fabsf(x) * gc);
117 T out = (x -
sign(x) * dzc) / (1 - dzc);
119 return out * (fabsf(x) > dzc);
139 const T
gradual(
const T &value,
const T &x_low,
const T &x_high,
const T &y_low,
const T &y_high)
144 }
else if (value > x_high) {
149 T a = (y_high - y_low) / (x_high - x_low);
150 T b = y_low - a * x_low;
151 return a * value + b;
178 const T delta = (T)0.001;
182 bool use_linear_approach =
false;
184 if (((Y_max + Y_min) * (T)0.5) - Y_mid < delta) {
185 use_linear_approach =
true;
190 if (use_linear_approach) {
192 float slope = -(Y_max - Y_min) / (T)2.0;
193 Y_out = slope * X + Y_max;
197 T a = -((Y_mid - Y_max) * (Y_mid - Y_max))
198 / ((T)2.0 * Y_mid - Y_max - Y_min);
200 T b = (Y_mid - c) / a;
201 Y_out = a * powf(b, X) + c;
constexpr _Tp constrain(_Tp val, _Tp min_val, _Tp max_val)
const T superexpo(const T &value, const T &e, const T &g)
Limiting / constrain helper functions.
const T deadzone(const T &value, const T &dz)
const T gradual(const T &value, const T &x_low, const T &x_high, const T &y_low, const T &y_high)
const T expo(const T &value, const T &e)
const T expontialFromLimits(const T &X_in, const T &Y_min, const T &Y_mid, const T &Y_max)
const T expo_deadzone(const T &value, const T &e, const T &dz)