diff options
author | André Nusser <andre.nusser@googlemail.com> | 2020-04-19 22:50:57 +0200 |
---|---|---|
committer | André Nusser <andre.nusser@googlemail.com> | 2020-04-19 22:50:57 +0200 |
commit | fc8a6632d515fa36aa14e95bb1bbde57a10fd43a (patch) | |
tree | 2f5ece7b3addd9b00ad62eb3b02e65c424c4439c /src/powermap.h | |
parent | 4191e78012ad4cd5fc216aa355ee97a682065ce4 (diff) |
Add untested version of Powermap with all features.
Diffstat (limited to 'src/powermap.h')
-rw-r--r-- | src/powermap.h | 35 |
1 files changed, 21 insertions, 14 deletions
diff --git a/src/powermap.h b/src/powermap.h index 8dcccc9..589573f 100644 --- a/src/powermap.h +++ b/src/powermap.h @@ -26,34 +26,41 @@ */ #pragma once +#include <array> +#include <vector> + class Powermap { +public: using Power = float; + using Powers = std::vector<Power>; struct PowerPair { Power in; Power out; + + bool operator!=(PowerPair const& other) { + return in != other.in || out != other.out; + } }; -public: - Powermap() = default; + Powermap(); - Power map(Power in) const; + Power map(Power in); void reset(); - // set parameters - void setMinInput(Power min_input); - void setMaxInput(Power max_input); - void setFixed(PowerPair fixed); + void setFixed0(PowerPair new_value); + void setFixed1(PowerPair new_value); + void setFixed2(PowerPair new_value); + void setShelf(bool enable); private: - // input parameters - Power min_input; - Power max_input; - PowerPair fixed; + // input parameters (state of this class) + std::array<PowerPair, 3> fixed; + bool shelf; - // spline parameters - float a1, b1, c1, d1; - float a2, b2, c2, d2; + // spline parameters (deterministically computed from the input parameters) + std::array<float, 5> m; + bool spline_needs_update; void updateSpline(); }; |