diff options
author | Wim Vriend <facetracknoir@gmail.com> | 2012-08-27 14:27:09 +0000 |
---|---|---|
committer | Wim Vriend <facetracknoir@gmail.com> | 2012-08-27 14:27:09 +0000 |
commit | 0d7f0fb2d36e9a89a556214b24c4551d1352aa75 (patch) | |
tree | c1533ee85ace7ce66575ecf08c7af8174a4d0103 | |
parent | 863efe5f6f51fb0fd9dedec38527a11e8510e0f2 (diff) |
Changed reference to winable.h
git-svn-id: svn+ssh://svn.code.sf.net/p/facetracknoir/code@122 19e81ba0-9b1a-49c3-bd6c-561e1906d5fb
-rw-r--r-- | FTNoIR_Filter_Accela/FTNoIR_FilterControls.ui | 32 | ||||
-rw-r--r-- | FTNoIR_Filter_Accela/ftnoir_filter_accela.cpp | 26 | ||||
-rw-r--r-- | FTNoIR_Protocol_Base/ftnoir_protocol_base.h | 2 | ||||
-rw-r--r-- | FTNoIR_Protocol_MOUSE/FTNoIR_Protocol_MOUSE.h | 2 |
4 files changed, 41 insertions, 21 deletions
diff --git a/FTNoIR_Filter_Accela/FTNoIR_FilterControls.ui b/FTNoIR_Filter_Accela/FTNoIR_FilterControls.ui index f22e3cc7..50599e4d 100644 --- a/FTNoIR_Filter_Accela/FTNoIR_FilterControls.ui +++ b/FTNoIR_Filter_Accela/FTNoIR_FilterControls.ui @@ -9,8 +9,8 @@ <rect>
<x>0</x>
<y>0</y>
- <width>1118</width>
- <height>649</height>
+ <width>518</width>
+ <height>349</height>
</rect>
</property>
<property name="windowTitle">
@@ -43,14 +43,14 @@ </property>
<property name="minimumSize">
<size>
- <width>1100</width>
- <height>600</height>
+ <width>500</width>
+ <height>300</height>
</size>
</property>
<property name="maximumSize">
<size>
- <width>65535</width>
- <height>65535</height>
+ <width>500</width>
+ <height>300</height>
</size>
</property>
<property name="currentIndex">
@@ -60,10 +60,10 @@ <attribute name="title">
<string>Rotation</string>
</attribute>
- <widget class="QFunctionConfigurator" name="translationScalingConfig">
+ <widget class="QFunctionConfigurator" name="scalingConfig">
<property name="geometry">
<rect>
- <x>420</x>
+ <x>80</x>
<y>30</y>
<width>215</width>
<height>220</height>
@@ -108,11 +108,16 @@ <string>Output Yaw (degr.)</string>
</property>
</widget>
- <widget class="QFunctionConfigurator" name="scalingConfig">
+ </widget>
+ <widget class="QWidget" name="tab_2">
+ <attribute name="title">
+ <string>Translation</string>
+ </attribute>
+ <widget class="QFunctionConfigurator" name="translationScalingConfig">
<property name="geometry">
<rect>
- <x>80</x>
- <y>30</y>
+ <x>30</x>
+ <y>20</y>
<width>215</width>
<height>220</height>
</rect>
@@ -157,11 +162,6 @@ </property>
</widget>
</widget>
- <widget class="QWidget" name="tab_2">
- <attribute name="title">
- <string>Translation</string>
- </attribute>
- </widget>
</widget>
</item>
<item>
diff --git a/FTNoIR_Filter_Accela/ftnoir_filter_accela.cpp b/FTNoIR_Filter_Accela/ftnoir_filter_accela.cpp index 8e9abb62..fce05f33 100644 --- a/FTNoIR_Filter_Accela/ftnoir_filter_accela.cpp +++ b/FTNoIR_Filter_Accela/ftnoir_filter_accela.cpp @@ -4,6 +4,12 @@ * purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*/
+/*
+ Modifications (last one on top):
+ 20120807 - WVR: FunctionConfig is now also used for the Filter. The extrapolation was adapted from Stanislaw.
+ Additional changes: I have added two parameters to the constructor of FunctionConfig and
+ renamed 3 member-functions (getFilterFullName is now called getFullName).
+*/
#include "ftnoir_filter_Accela.h"
#include "math.h"
#include <QDebug>
@@ -101,15 +107,27 @@ void FTNoIR_Filter::FilterHeadPoseData(THeadPoseData *current_camera_position, T double vec = e2 - start;
int sign = vec < 0 ? -1 : 1;
double x = fabs(vec);
- double foo = (i >= 3 ? functionConfig : translationFunctionConfig).getValue((x > 4 ? 4 : x));
- if (x > 4)
- foo = x * x * log(x) / log(4.0);
+ QList<QPointF> points = (i >= 3 ? functionConfig : translationFunctionConfig).getPoints();
+ int extrapolatep = 0;
+ double ratio;
+ double maxx;
+ double add;
+ // extrapolation of a spline
+ if (points.size() > 1) {
+ QPointF last = points[points.size() - 1];
+ QPointF penultimate = points[points.size() - 2];
+ ratio = (last.y() - penultimate.y()) / (last.x() - penultimate.x());
+ extrapolatep = 1;
+ add = last.y();
+ maxx = last.x();
+ }
+ double foo = extrapolatep && x > maxx ? add + ratio * (x - maxx) : (i >= 3 ? functionConfig : translationFunctionConfig).getValue(x);
// the idea is that "empty" updates without new head pose data are still
// useful for filtering, as skipping them would result in jerky output.
// the magic "100" is the amount of calls to the filter by FTNOIR per sec.
double velocity = foo / 100.0;
double sum = start + velocity * sign;
- bool done = /*x >= 6 || */(sign > 0 ? sum >= e2 : sum <= e2);
+ bool done = (sign > 0 ? sum >= e2 : sum <= e2);
if (done) {
output[i] = e2;
} else {
diff --git a/FTNoIR_Protocol_Base/ftnoir_protocol_base.h b/FTNoIR_Protocol_Base/ftnoir_protocol_base.h index 20569409..1711a08e 100644 --- a/FTNoIR_Protocol_Base/ftnoir_protocol_base.h +++ b/FTNoIR_Protocol_Base/ftnoir_protocol_base.h @@ -37,7 +37,7 @@ //#include "winbase.h"
#include "windows.h"
-#include "winable.h"
+//#include "winable.h"
// COM-Like abstract interface.
// This interface doesn't require __declspec(dllexport/dllimport) specifier.
diff --git a/FTNoIR_Protocol_MOUSE/FTNoIR_Protocol_MOUSE.h b/FTNoIR_Protocol_MOUSE/FTNoIR_Protocol_MOUSE.h index dfe4ae3e..723f11b1 100644 --- a/FTNoIR_Protocol_MOUSE/FTNoIR_Protocol_MOUSE.h +++ b/FTNoIR_Protocol_MOUSE/FTNoIR_Protocol_MOUSE.h @@ -40,6 +40,8 @@ #include <QDebug>
#include <QFile>
+#include "winable.h"
+
#define MOUSE_AXIS_MIN 0
#define MOUSE_AXIS_MAX 65535
|