rawaccel/common/accel-power.hpp
a1xd 85aefb4ba1 add arg checks in wrapper
minor changes to settings shape, requires driver reinstall
add error handling to writer

grapher changes:

add prettier serialization + comments
add elements for scale and separated limit/exp
reset irrelevant (invisible) arg input before checks/write
2020-09-27 23:04:29 -04:00

26 lines
494 B
C++

#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.scale), exponent(args.exponent)
{}
inline double operator()(double speed) const {
// f(x) = (mx)^k
return pow(speed * scale, exponent);
}
};
using accel_power = nonadditive_accel<power_impl>;
}