From ccea3f9d2a4fba4273e3922f106ccaf504e7d2cd Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Sun, 25 Sep 2016 09:05:14 +0200 Subject: gui, logic: allow prevent rotation from affecting compensation Issue: #458 --- gui/options-dialog.cpp | 4 ++ gui/options-dialog.ui | 150 +++++++++++++++++++++++++++++++++++++----------- logic/main-settings.hpp | 4 ++ logic/tracker.cpp | 11 +++- 4 files changed, 136 insertions(+), 33 deletions(-) diff --git a/gui/options-dialog.cpp b/gui/options-dialog.cpp index 71297a59..2f40e39f 100644 --- a/gui/options-dialog.cpp +++ b/gui/options-dialog.cpp @@ -50,6 +50,10 @@ OptionsDialog::OptionsDialog(std::function pause_keybindings) : tie_setting(main.tcomp_disable_ty, ui.tcomp_ty_disable); tie_setting(main.tcomp_disable_tz, ui.tcomp_tz_disable); + tie_setting(main.tcomp_disable_src_yaw, ui.tcomp_src_yaw_disable); + tie_setting(main.tcomp_disable_src_pitch, ui.tcomp_src_pitch_disable); + tie_setting(main.tcomp_disable_src_roll, ui.tcomp_src_roll_disable); + tie_setting(main.a_x.zero, ui.pos_tx); tie_setting(main.a_y.zero, ui.pos_ty); tie_setting(main.a_z.zero, ui.pos_tz); diff --git a/gui/options-dialog.ui b/gui/options-dialog.ui index 193d75a9..291a49d2 100644 --- a/gui/options-dialog.ui +++ b/gui/options-dialog.ui @@ -322,7 +322,13 @@ - 3 + 0 + + + 2 + + + 2 @@ -334,7 +340,7 @@ - Minimize to tray on startup + Minimize to tray on startup when enabled @@ -848,33 +854,117 @@ It won't work properly with translation compensation enabled. - - - - - - Disable X compensation - - - - - - - - - - Disable Y compensation - - - - - - - + + + QFrame::NoFrame - - Disable Z compensation (for using zoom on Z axis) + + QFrame::Raised + + + 0 + + + 0 + + + 0 + + + 0 + + + 0 + + + + + + 3 + 0 + + + + + + + Disable X compensation + + + + + + + + 3 + 0 + + + + + + + Disable Y compensation + + + + + + + + 3 + 0 + + + + + + + Disable Z compensation (for zoom on Z axis) + + + + + + + + 2 + 0 + + + + Disable compensation by yaw + + + + + + + + 2 + 0 + + + + Disable compensation by pitch + + + + + + + + 2 + 0 + + + + Disable compensation by roll + + + + @@ -1324,7 +1414,7 @@ It won't work properly with translation compensation enabled. - Enable - You will be asked for a filename whenever the tracker starts + Enable - You will be asked for a filename whenever tracking starts @@ -1434,10 +1524,6 @@ It won't work properly with translation compensation enabled. pos_ty pos_tz center_method - tcomp_enable - tcomp_tx_disable - tcomp_ty_disable - tcomp_tz_disable src_yaw invert_yaw src_pitch diff --git a/logic/main-settings.hpp b/logic/main-settings.hpp index ca18a0e9..53c5fae1 100644 --- a/logic/main-settings.hpp +++ b/logic/main-settings.hpp @@ -68,6 +68,7 @@ struct main_settings bundle b, b_map; axis_opts a_x, a_y, a_z, a_yaw, a_pitch, a_roll; value tcomp_p, tcomp_disable_tx, tcomp_disable_ty, tcomp_disable_tz; + value tcomp_disable_src_yaw, tcomp_disable_src_pitch, tcomp_disable_src_roll; value tray_enabled, tray_start; value camera_yaw, camera_pitch, camera_roll; value use_camera_offset_from_centering; @@ -92,6 +93,9 @@ struct main_settings tcomp_disable_tx(b, "compensate-translation-disable-x-axis", false), tcomp_disable_ty(b, "compensate-translation-disable-y-axis", false), tcomp_disable_tz(b, "compensate-translation-disable-z-axis", false), + tcomp_disable_src_yaw(b, "compensate-translation-disable-source-yaw", false), + tcomp_disable_src_pitch(b, "compensate-translation-disable-source-pitch", false), + tcomp_disable_src_roll(b, "compensate-translation-disable-source-roll", false), tray_enabled(b, "use-system-tray", false), tray_start(b, "start-in-tray", false), camera_yaw(b, "camera-yaw", 0), diff --git a/logic/tracker.cpp b/logic/tracker.cpp index f0826a5f..84d3afdb 100644 --- a/logic/tracker.cpp +++ b/logic/tracker.cpp @@ -288,8 +288,17 @@ void Tracker::logic() if (s.tcomp_p && !get(f_tcomp_disabled)) { + const double tcomp_c[] = + { + double(!s.tcomp_disable_src_yaw), + double(!s.tcomp_disable_src_pitch), + double(!s.tcomp_disable_src_roll), + }; euler_t value_(value(TX), value(TY), value(TZ)); - t_compensate(euler_to_rmat(euler_t(value(Yaw) * d2r, value(Pitch) * d2r, value(Roll) * d2r)), + t_compensate(euler_to_rmat( + euler_t(value(Yaw) * d2r * tcomp_c[0], + value(Pitch) * d2r * tcomp_c[1], + value(Roll) * d2r * tcomp_c[2])), value_, value_, s.tcomp_disable_tx, -- cgit v1.2.3