diff options
| author | a1xd <[email protected]> | 2020-07-24 19:32:47 -0400 |
|---|---|---|
| committer | GitHub <[email protected]> | 2020-07-24 19:32:47 -0400 |
| commit | c47353e802418e29a02cbe36c12b3cd726bc8a73 (patch) | |
| tree | bead4e812c9b9d6a90d34d10fc3a6d64f5c9d37b /common/rawaccel.hpp | |
| parent | Merge pull request #2 from JacobPalecki/PowerStyle (diff) | |
| parent | Flip k and b as scale and exponent for power mode (diff) | |
| download | rawaccel-c47353e802418e29a02cbe36c12b3cd726bc8a73.tar.xz rawaccel-c47353e802418e29a02cbe36c12b3cd726bc8a73.zip | |
Merge pull request #3 from JacobPalecki/PowerFix
Power style: additional fixes
Diffstat (limited to 'common/rawaccel.hpp')
| -rw-r--r-- | common/rawaccel.hpp | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/common/rawaccel.hpp b/common/rawaccel.hpp index a60fe1c..095af76 100644 --- a/common/rawaccel.hpp +++ b/common/rawaccel.hpp @@ -73,9 +73,8 @@ struct accel_function { // accel ramp rate double b = 0; - // the limit for natural and sigmoid modes, - // the exponent for classic mode, - // or the scale factor for power mode + // the limit for natural and sigmoid modes + // or the exponent for classic and power modes double k = 1; vec2d weight = { 1, 1 }; @@ -99,7 +98,7 @@ struct accel_function { break; case mode::sigmoid: accel_val = k / (exp(-b * (speed - m)) + 1); break; - case mode::power: accel_val = (speed_offset > 0 && speed < 1) ? 0 : pow(speed, b*k) - 1; + case mode::power: accel_val = (speed_offset > 0 && speed < 1) ? 0 : pow(speed*b, k) - 1; break; default: break; @@ -132,7 +131,7 @@ struct accel_function { if (args.time_min <= 0) error("min time must be positive"); if (args.lim_exp <= 1) { if (args.accel_mode == mode::classic) error("exponent must be greater than 1"); - else if (args.accel_mode == mode::power) error("scale factor must be greater than 1"); + if (args.accel_mode == mode::power) { if (args.lim_exp <=0 ) error("exponent must be greater than 0"); } else error("limit must be greater than 1"); } |