summaryrefslogtreecommitdiff
path: root/common/accel-natural.hpp
diff options
context:
space:
mode:
authora1xd <[email protected]>2021-04-08 02:30:01 -0400
committera1xd <[email protected]>2021-04-08 02:30:01 -0400
commitc55d1bfd01147fa014ac07d4b03ef3cad8427ae6 (patch)
tree39ffa4a79bc6b019443521f10203f787c4b98698 /common/accel-natural.hpp
parentunmark fill as const (diff)
downloadrawaccel-c55d1bfd01147fa014ac07d4b03ef3cad8427ae6.tar.xz
rawaccel-c55d1bfd01147fa014ac07d4b03ef3cad8427ae6.zip
optimize a bit/refactor modify
Diffstat (limited to 'common/accel-natural.hpp')
-rw-r--r--common/accel-natural.hpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/common/accel-natural.hpp b/common/accel-natural.hpp
index 28e17c2..8d25351 100644
--- a/common/accel-natural.hpp
+++ b/common/accel-natural.hpp
@@ -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;
}