summaryrefslogtreecommitdiff
path: root/common/accel-logarithmic.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'common/accel-logarithmic.hpp')
-rw-r--r--common/accel-logarithmic.hpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/common/accel-logarithmic.hpp b/common/accel-logarithmic.hpp
new file mode 100644
index 0000000..928eda9
--- /dev/null
+++ b/common/accel-logarithmic.hpp
@@ -0,0 +1,20 @@
+#pragma once
+
+#include <math.h>
+
+#include "accel-base.hpp"
+
+namespace rawaccel {
+
+ /// <summary> Struct to hold logarithmic acceleration implementation. </summary>
+ struct accel_logarithmic : accel_base {
+
+ using accel_base::accel_base;
+
+ inline double accelerate(double speed) const {
+ //f(x) = log(m*x+1)
+ return log(speed_coeff * speed + 1);
+ }
+ };
+
+}