blob: 1abfdd15b0a51307e79d796eb52ce58028e10bf1 (
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
|
#pragma once
#include <math.h>
#include "accel-base.hpp"
namespace rawaccel {
/// <summary> Struct to hold power (non-additive) acceleration implementation. </summary>
struct power_impl {
double scale;
double exponent;
power_impl(const accel_args& args) :
scale(args.power_scale), exponent(args.power_exp)
{}
inline double operator()(double speed) const {
// f(x) = (mx)^k
return pow(speed * scale, exponent);
}
};
using accel_power = nonadditive_accel<power_impl>;
}
|