From 948fb5ef0ffd6a83675763d80053a433e09aea06 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Fri, 24 Jul 2015 13:47:09 +0200 Subject: accela: try to smooth out the rotation function Issue: #204 --- ftnoir_filter_accela/ftnoir_filter_accela.cpp | 10 ++++------ ftnoir_filter_accela/ftnoir_filter_accela_dialog.cpp | 12 ++++++++++++ 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/ftnoir_filter_accela/ftnoir_filter_accela.cpp b/ftnoir_filter_accela/ftnoir_filter_accela.cpp index f8bd2ab1..cb5f1fa5 100644 --- a/ftnoir_filter_accela/ftnoir_filter_accela.cpp +++ b/ftnoir_filter_accela/ftnoir_filter_accela.cpp @@ -10,15 +10,13 @@ #include #include #include "opentrack/plugin-api.hpp" -using namespace std; static constexpr double rot_gains[][2] = { { 2.66, 110 }, - { 2.33, 80 }, - { 2, 50 }, - { 1.66, 30 }, + { 2.0, 50 }, + { 1.66, 29 }, { 1.33, 15 }, - { 1, 5 }, + { 1, 6 }, { .66, 1.4 }, { .33, .4 }, { 0, 0 }, @@ -96,7 +94,7 @@ void FTNoIR_Filter::filter(const double* input, double *output) const double vec = in - last_output[i]; const double dz = i >= 3 ? rot_dz : trans_dz; - const double vec_ = max(0., fabs(vec) - dz); + const double vec_ = std::max(0., fabs(vec) - dz); const double thres = i >= 3 ? rot_t : trans_t; const double val = m.getValue(vec_ / thres); const double result = last_output[i] + (vec < 0 ? -1 : 1) * dt * val; diff --git a/ftnoir_filter_accela/ftnoir_filter_accela_dialog.cpp b/ftnoir_filter_accela/ftnoir_filter_accela_dialog.cpp index 60e5dbd3..67f15457 100644 --- a/ftnoir_filter_accela/ftnoir_filter_accela_dialog.cpp +++ b/ftnoir_filter_accela/ftnoir_filter_accela_dialog.cpp @@ -10,11 +10,14 @@ #include #include #include "opentrack/plugin-api.hpp" +#include "qfunctionconfigurator/qfunctionconfigurator.h" +#include FilterControls::FilterControls() : accela_filter(nullptr) { ui.setupUi( this ); + connect(ui.buttonBox, SIGNAL(accepted()), this, SLOT(doOK())); connect(ui.buttonBox, SIGNAL(rejected()), this, SLOT(doCancel())); @@ -40,6 +43,15 @@ FilterControls::FilterControls() : void FilterControls::register_filter(IFilter* filter) { accela_filter = static_cast(filter); + +#ifdef LEAKING_DEBUG + auto d = new QDialog(); + auto r = new QFunctionConfigurator(d); + r->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); + r->setConfig(&accela_filter->rot, ""); + r->setFixedSize(800, 300); + d->show(); +#endif } void FilterControls::unregister_filter() -- cgit v1.2.3