From 0d7f0fb2d36e9a89a556214b24c4551d1352aa75 Mon Sep 17 00:00:00 2001 From: Wim Vriend Date: Mon, 27 Aug 2012 14:27:09 +0000 Subject: Changed reference to winable.h git-svn-id: svn+ssh://svn.code.sf.net/p/facetracknoir/code@122 19e81ba0-9b1a-49c3-bd6c-561e1906d5fb --- FTNoIR_Filter_Accela/FTNoIR_FilterControls.ui | 32 +++++++++++++-------------- FTNoIR_Filter_Accela/ftnoir_filter_accela.cpp | 26 ++++++++++++++++++---- FTNoIR_Protocol_Base/ftnoir_protocol_base.h | 2 +- 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 @@ 0 0 - 1118 - 649 + 518 + 349 @@ -43,14 +43,14 @@ - 1100 - 600 + 500 + 300 - 65535 - 65535 + 500 + 300 @@ -60,10 +60,10 @@ Rotation - + - 420 + 80 30 215 220 @@ -108,11 +108,16 @@ Output Yaw (degr.) - + + + + Translation + + - 80 - 30 + 30 + 20 215 220 @@ -157,11 +162,6 @@ - - - Translation - - 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 @@ -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 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 #include +#include "winable.h" + #define MOUSE_AXIS_MIN 0 #define MOUSE_AXIS_MAX 65535 -- cgit v1.2.3