diff options
| author | Jacob Palecki <[email protected]> | 2020-09-04 01:15:12 -0700 |
|---|---|---|
| committer | Jacob Palecki <[email protected]> | 2020-09-04 01:15:12 -0700 |
| commit | 87ee655d3c0ba3cdb0ca71a1b66aeb02c8c6aa70 (patch) | |
| tree | a2ca5c42352737e3dab48ec854c1cd068a282e46 /common/accel-naturalgain.hpp | |
| parent | The menus mostly work (diff) | |
| parent | Merge pull request #19 from JacobPalecki/gainOffset (diff) | |
| download | rawaccel-87ee655d3c0ba3cdb0ca71a1b66aeb02c8c6aa70.tar.xz rawaccel-87ee655d3c0ba3cdb0ca71a1b66aeb02c8c6aa70.zip | |
Merge with master
Diffstat (limited to 'common/accel-naturalgain.hpp')
| -rw-r--r-- | common/accel-naturalgain.hpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/common/accel-naturalgain.hpp b/common/accel-naturalgain.hpp index 646b2bb..cdfd1fa 100644 --- a/common/accel-naturalgain.hpp +++ b/common/accel-naturalgain.hpp @@ -13,10 +13,15 @@ namespace rawaccel { inline double operator()(double speed) const { // f(x) = k((e^(-mx)-1)/mx + 1) + double base_speed = speed + offset; double scaled_speed = rate * speed; - return limit * (((exp(-scaled_speed) - 1) / scaled_speed) + 1); + return limit * (((exp(-scaled_speed) - 1) / (base_speed * rate) ) + 1 - offset / base_speed); } + inline double legacy_offset(double speed) const { + double scaled_speed = rate * speed; + return limit * (((exp(-scaled_speed) - 1) / scaled_speed) + 1); + } }; using accel_naturalgain = additive_accel<naturalgain_impl>; |