blob: 1ab0e53ee335de4921a8869ec36679d16cbeb194 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
#pragma once
#include <math.h>
#include "accel-base.hpp"
namespace rawaccel {
/// <summary> Struct to hold logarithmic acceleration implementation. </summary>
struct logarithmic_impl {
double accel;
logarithmic_impl(const accel_args& args) : accel(args.accel) {}
inline double operator()(double speed) const {
//f(x) = log(m*x+1)
return log(accel * speed + 1);
}
// incorrect but this style is slated for removal
inline double legacy_offset(double speed) const { return operator()(speed); }
};
using accel_logarithmic = additive_accel<logarithmic_impl>;
}
|