summaryrefslogtreecommitdiff
path: root/common/accel-classic.hpp
blob: 4cc52ca4d222d9dbb3fde515695eccd9cf61a310 (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 "classic" (linear raised to power) acceleration implementation. </summary>
	struct classic_impl {
		double accel;
		double power;

		classic_impl(const accel_args& args) :
			accel(args.accel), power(args.exponent - 1)
		{}

		inline double operator()(double speed) const {
			//f(x) = (mx)^(k-1)
			return pow(accel * speed, power);
		}
	};

	using accel_classic = additive_accel<classic_impl>;
	
}