blob: c7d0dcdfc92981c3665a13b0a9567ed5d32fbd52 (
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
26
27
28
29
|
#pragma once
#include <math.h>
#include "accel-base.hpp"
namespace rawaccel {
/// <summary> Struct to hold "natural" (vanishing difference) acceleration implementation. </summary>
struct natural_impl {
double rate;
double limit;
natural_impl(const accel_args& args) :
rate(args.accel), limit(args.limit - 1)
{
rate /= limit;
}
inline double operator()(double speed) const {
// f(x) = k(1-e^(-mx))
return limit - (limit * exp(-rate * speed));
}
};
using accel_natural = additive_accel<natural_impl>;
}
|