summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-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;
}
}
}