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