optimize a bit/refactor modify

This commit is contained in:
a1xd 2021-04-08 02:30:01 -04:00
parent 805ed31165
commit c55d1bfd01
10 changed files with 199 additions and 259 deletions

View file

@ -26,8 +26,8 @@ namespace rawaccel {
{
if (x <= offset) return 1;
double offset_x = x - offset;
double decay = exp(-accel * offset_x);
double offset_x = offset - x;
double decay = exp(accel * offset_x);
return limit * (1 - (decay * offset_x + offset) / x) + 1;
}
@ -41,8 +41,8 @@ namespace rawaccel {
{
if (x <= offset) return 1;
double offset_x = x - offset;
double decay = exp(-accel * offset_x);
double offset_x = offset - x;
double decay = exp(accel * offset_x);
double output = limit * (offset_x + decay / accel) + constant;
return output / x + 1;
}