From b81d4ac044e2e61a69f02ddecd8aedeb780c1a7b Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Wed, 17 Sep 2014 04:23:54 +0200 Subject: simplify alt axis logic --- facetracknoir/tracker.cpp | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) (limited to 'facetracknoir') diff --git a/facetracknoir/tracker.cpp b/facetracknoir/tracker.cpp index 01fd0b4c..ca505315 100644 --- a/facetracknoir/tracker.cpp +++ b/facetracknoir/tracker.cpp @@ -39,16 +39,11 @@ Tracker::~Tracker() static void get_curve(double pos, double& out, THeadPoseDOF& axis) { bool altp = (pos < 0) && axis.opts.altp; - if (altp) { - out = (axis.opts.invert ? -1 : 1) * axis.curveAlt.getValue(pos); - axis.curve.setTrackingActive( false ); - axis.curveAlt.setTrackingActive( true ); - } - else { - out = (axis.opts.invert ? -1 : 1) * axis.curve.getValue(pos); - axis.curve.setTrackingActive( true ); - axis.curveAlt.setTrackingActive( false ); - } + axis.curve.setTrackingActive( !altp ); + axis.curveAlt.setTrackingActive( altp ); + auto& fc = altp ? axis.curveAlt : axis.curve; + out = (axis.opts.invert ? -1 : 1) * fc.getValue(pos); + out += axis.opts.zero; } -- cgit v1.2.3