diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2014-06-16 03:00:27 +0200 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2014-06-16 03:00:27 +0200 |
commit | 4d3df8df632d9230389fa2ffec6c4b28fa2985ff (patch) | |
tree | f81dbbe8f4d749c72234679822e55e6bec17dfa9 /facetracknoir | |
parent | b82ddb17360d66ad7270ad58409f53a6e1900437 (diff) |
Revert "lerp class to simplify filter flow"
This reverts commit 5409f26675a444170b3a68fc9750742cc68aaa1d.
Diffstat (limited to 'facetracknoir')
-rw-r--r-- | facetracknoir/lerp.hpp | 45 |
1 files changed, 0 insertions, 45 deletions
diff --git a/facetracknoir/lerp.hpp b/facetracknoir/lerp.hpp deleted file mode 100644 index 70d5995c..00000000 --- a/facetracknoir/lerp.hpp +++ /dev/null @@ -1,45 +0,0 @@ -#pragma once - -#include "facetracknoir/timer.hpp" -#include <algorithm> - -class lerp { -private: - double last[2][6], dt; - Timer t; -public: - lerp() : - last { {0,0,0,0,0,0}, {0,0,0,0,0,0} }, dt(1) - { - } - bool idempotentp(const double* input) - { - for (int i = 0; i < 6; i++) - if (last[0][i] != input[i]) - return false; - return true; - } - - void write(const double* input, double* output) - { - const double q = dt; - dt = std::max(1, t.start()); - - const double c = std::max(std::min(1.0, q/(double)dt), 0.0); - - for (int i = 0; i < 6; i++) - { - last[1][i] = last[0][i]; - last[0][i] = input[i]; - } - - for (int i = 0; i < 6; i++) - output[i] = last[1][i] + (last[0][i] - last[1][i]) * c; - } - - void get_state(double* state) - { - for (int i = 0; i < 6; i++) - state[i] = last[0][i]; - } -}; |