diff options
| author | Jacob Palecki <[email protected]> | 2021-04-06 23:11:20 -0700 |
|---|---|---|
| committer | Jacob Palecki <[email protected]> | 2021-04-06 23:11:20 -0700 |
| commit | 258fcd3bd236a787f07d7dac2049be524d86cb75 (patch) | |
| tree | 8a92d603c6c9db3e822b7cc09d2a88c485ebed3b /common | |
| parent | Rename accelMotivity to growthRate (diff) | |
| download | rawaccel-258fcd3bd236a787f07d7dac2049be524d86cb75.tar.xz rawaccel-258fcd3bd236a787f07d7dac2049be524d86cb75.zip | |
Fix natural legacy algorithm, rename accelNatural to decayRate
Diffstat (limited to 'common')
| -rw-r--r-- | common/accel-natural.hpp | 4 | ||||
| -rw-r--r-- | common/rawaccel-base.hpp | 2 | ||||
| -rw-r--r-- | common/rawaccel-validate.hpp | 2 |
3 files changed, 4 insertions, 4 deletions
diff --git a/common/accel-natural.hpp b/common/accel-natural.hpp index 31ed190..1f18e0d 100644 --- a/common/accel-natural.hpp +++ b/common/accel-natural.hpp @@ -16,7 +16,7 @@ namespace rawaccel { offset(args.offset), limit(args.limit - 1) { - accel = args.accel_natural / fabs(limit); + accel = args.decay_rate / fabs(limit); } }; @@ -28,7 +28,7 @@ namespace rawaccel { double offset_x = x - offset; double decay = exp(-accel * offset_x); - return limit * (1 - (decay * offset_x + offset) / x) + 1; + return limit * (1 - (decay)) + 1; } using natural_base::natural_base; diff --git a/common/rawaccel-base.hpp b/common/rawaccel-base.hpp index fc49a62..7dc1b96 100644 --- a/common/rawaccel-base.hpp +++ b/common/rawaccel-base.hpp @@ -51,7 +51,7 @@ namespace rawaccel { double offset = 0; double cap = 1.5; double accel_classic = 0.005; - double accel_natural = 0.1; + double decay_rate = 0.1; double growth_rate = 1; double motivity = 1.5; double power = 2; diff --git a/common/rawaccel-validate.hpp b/common/rawaccel-validate.hpp index 338fbdc..230ddac 100644 --- a/common/rawaccel-validate.hpp +++ b/common/rawaccel-validate.hpp @@ -83,7 +83,7 @@ namespace rawaccel { } if (args.growth_rate <= 0 || - args.accel_natural <= 0 || + args.decay_rate <= 0 || args.accel_classic <= 0) { error("acceleration"" must be positive"); } |