summaryrefslogtreecommitdiffhomepage
path: root/ftnoir_tracker_joystick/ftnoir_tracker_joystick.cpp
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2014-09-12 08:26:15 +0200
committerStanislaw Halik <sthalik@misaki.pl>2014-09-12 08:26:15 +0200
commitaa7fe04754cad9c1277e9e19b570b8b69c7f5103 (patch)
treed4dcd4a4241694261ec9c24be93c115759f32049 /ftnoir_tracker_joystick/ftnoir_tracker_joystick.cpp
parent63cd64275512c50948ccc6894a2547c707e8fbe3 (diff)
Correct axis scale logic
Issue: #38
Diffstat (limited to 'ftnoir_tracker_joystick/ftnoir_tracker_joystick.cpp')
-rw-r--r--ftnoir_tracker_joystick/ftnoir_tracker_joystick.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/ftnoir_tracker_joystick/ftnoir_tracker_joystick.cpp b/ftnoir_tracker_joystick/ftnoir_tracker_joystick.cpp
index a4f026de..d3f5806b 100644
--- a/ftnoir_tracker_joystick/ftnoir_tracker_joystick.cpp
+++ b/ftnoir_tracker_joystick/ftnoir_tracker_joystick.cpp
@@ -2,6 +2,7 @@
#include "facetracknoir/plugin-support.h"
#undef NDEBUG
#include <QMutexLocker>
+#include <stdlib.h>
FTNoIR_Tracker::FTNoIR_Tracker() :
g_pDI(nullptr),
@@ -225,9 +226,8 @@ void FTNoIR_Tracker::GetHeadPoseData(double *data)
auto mid = (min_[idx] + max_[idx]) / 2;
auto val = values[idx] - mid;
- auto max = (max_[idx] - mid);
- auto min = (mid - min_[idx]);
- data[i] = val * limits[i] / (double) (val > 0 ? max : min);
+ int scale = val > 0 ? abs(max_[idx] - mid) : -abs(mid - min_[idx]);
+ data[i] = abs(val) * limits[i] / scale;
}
}
}