summaryrefslogtreecommitdiff
path: root/common/accel-classic.hpp
diff options
context:
space:
mode:
authora1xd <[email protected]>2021-03-29 18:01:20 -0400
committera1xd <[email protected]>2021-03-29 18:01:20 -0400
commited0bbc22681681a16b7d45b05133c38a0b82006f (patch)
tree3c883ad3c85608cd167efded8cce09733527f835 /common/accel-classic.hpp
parentrefactor common/settings (diff)
downloadrawaccel-ed0bbc22681681a16b7d45b05133c38a0b82006f.tar.xz
rawaccel-ed0bbc22681681a16b7d45b05133c38a0b82006f.zip
formatting + file renames
Diffstat (limited to 'common/accel-classic.hpp')
-rw-r--r--common/accel-classic.hpp16
1 files changed, 10 insertions, 6 deletions
diff --git a/common/accel-classic.hpp b/common/accel-classic.hpp
index c7d6519..4385897 100644
--- a/common/accel-classic.hpp
+++ b/common/accel-classic.hpp
@@ -1,10 +1,11 @@
#pragma once
+#include "rawaccel-base.hpp"
+#include "utility.hpp"
+
#include <math.h>
#include <float.h>
-#include "rawaccel-settings.h"
-
namespace rawaccel {
/// <summary> Struct to hold "classic" (linear raised to power) acceleration implementation. </summary>
@@ -18,7 +19,8 @@ namespace rawaccel {
power(args.power),
accel_raised(pow(args.accel_classic, power - 1)) {}
- double base_fn(double x) const {
+ double base_fn(double x) const
+ {
return accel_raised * pow(x - offset, power) / x;
}
};
@@ -40,7 +42,8 @@ namespace rawaccel {
}
}
- inline double operator()(double x) const {
+ double operator()(double x) const
+ {
if (x <= offset) return 1;
return sign * minsd(base_fn(x), sens_cap) + 1;
}
@@ -67,7 +70,8 @@ namespace rawaccel {
}
}
- double operator()(double x) const {
+ double operator()(double x) const
+ {
double output;
if (x <= offset) return 1;
@@ -81,7 +85,7 @@ namespace rawaccel {
return sign * output + 1;
}
-
+
static double gain(double x, double accel, double power, double offset)
{
return power * pow(accel * (x - offset), power - 1);