summaryrefslogtreecommitdiff
path: root/common/accel-logarithmic.hpp
diff options
context:
space:
mode:
authorJacobPalecki <[email protected]>2020-08-31 23:03:46 -0700
committerGitHub <[email protected]>2020-08-31 23:03:46 -0700
commit471fe599bab6ba0632ddd1dacd20c7fc42db0eee (patch)
tree90a82ee14dbb112621657efbd2523ed35f59d154 /common/accel-logarithmic.hpp
parentMerge pull request #16 from JacobPalecki/Misc (diff)
parentadd independent xy accel to driver (diff)
downloadrawaccel-471fe599bab6ba0632ddd1dacd20c7fc42db0eee.tar.xz
rawaccel-471fe599bab6ba0632ddd1dacd20c7fc42db0eee.zip
Merge pull request #17 from a1xd/indep
Indep
Diffstat (limited to 'common/accel-logarithmic.hpp')
-rw-r--r--common/accel-logarithmic.hpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/common/accel-logarithmic.hpp b/common/accel-logarithmic.hpp
index 928eda9..c7991c7 100644
--- a/common/accel-logarithmic.hpp
+++ b/common/accel-logarithmic.hpp
@@ -7,14 +7,16 @@
namespace rawaccel {
/// <summary> Struct to hold logarithmic acceleration implementation. </summary>
- struct accel_logarithmic : accel_base {
+ struct logarithmic_impl {
+ double accel;
- using accel_base::accel_base;
+ logarithmic_impl(const accel_args& args) : accel(args.accel) {}
- inline double accelerate(double speed) const {
+ inline double operator()(double speed) const {
//f(x) = log(m*x+1)
- return log(speed_coeff * speed + 1);
+ return log(accel * speed + 1);
}
};
+ using accel_logarithmic = additive_accel<logarithmic_impl>;
}