summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2015-07-24 13:47:09 +0200
committerStanislaw Halik <sthalik@misaki.pl>2015-07-24 13:47:09 +0200
commit948fb5ef0ffd6a83675763d80053a433e09aea06 (patch)
tree46909023bf581883605db2cad9007dcec35e5237
parente55389fb2a43cd7cc2f1db95bc04a1d1eb789fa9 (diff)
accela: try to smooth out the rotation function
Issue: #204
-rw-r--r--ftnoir_filter_accela/ftnoir_filter_accela.cpp10
-rw-r--r--ftnoir_filter_accela/ftnoir_filter_accela_dialog.cpp12
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 <QDebug>
#include <QMutexLocker>
#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 <algorithm>
#include <QDoubleSpinBox>
#include "opentrack/plugin-api.hpp"
+#include "qfunctionconfigurator/qfunctionconfigurator.h"
+#include <QDialog>
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<FTNoIR_Filter*>(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()