diff options
-rw-r--r-- | facetracknoir/settings.ui | 40 | ||||
-rw-r--r-- | opentrack/tracker.cpp | 39 |
2 files changed, 59 insertions, 20 deletions
diff --git a/facetracknoir/settings.ui b/facetracknoir/settings.ui index e9f7060b..9fcd2128 100644 --- a/facetracknoir/settings.ui +++ b/facetracknoir/settings.ui @@ -141,6 +141,46 @@ </widget> </item> <item> + <widget class="QGroupBox" name="groupBox_9"> + <property name="title"> + <string>Centering method</string> + </property> + <layout class="QGridLayout" name="gridLayout"> + <item row="1" column="0"> + <widget class="QLabel" name="label_26"> + <property name="text"> + <string>Method</string> + </property> + </widget> + </item> + <item row="1" column="1"> + <widget class="QComboBox" name="center_method"> + <item> + <property name="text"> + <string>Relative</string> + </property> + </item> + <item> + <property name="text"> + <string>Absolute</string> + </property> + </item> + </widget> + </item> + <item row="0" column="1"> + <widget class="QLabel" name="label_25"> + <property name="text"> + <string>Try changing this if centering doesn't perform correctly for your input device.</string> + </property> + <property name="wordWrap"> + <bool>true</bool> + </property> + </widget> + </item> + </layout> + </widget> + </item> + <item> <widget class="QCheckBox" name="center_at_startup"> <property name="text"> <string>Center at startup</string> diff --git a/opentrack/tracker.cpp b/opentrack/tracker.cpp index 88c90032..8a9a0511 100644 --- a/opentrack/tracker.cpp +++ b/opentrack/tracker.cpp @@ -78,26 +78,15 @@ void Tracker::logic() Pose value, raw; - if (!zero_) - for (int i = 0; i < 6; i++) - { - auto& axis = m(i); - int k = axis.opts.src; - if (k < 0 || k >= 6) - value(i) = 0; - else - value(i) = newpose[k]; - raw(i) = newpose[i]; - } - else + for (int i = 0; i < 6; i++) { - auto mat = rmat::rmat_to_euler(r_b); - - for (int i = 0; i < 3; i++) - { - raw(i+3) = value(i+3) = mat(i) * r2d; - raw(i) = value(i) = t_b[i]; - } + auto& axis = m(i); + int k = axis.opts.src; + if (k < 0 || k >= 6) + value(i) = 0; + else + value(i) = newpose[k]; + raw(i) = newpose[i]; } const double off[] = { @@ -134,7 +123,17 @@ void Tracker::logic() { double tmp[3] = { t(0) - t_b[0], t(1) - t_b[1], t(2) - t_b[2] }; t_compensate(cam, tmp, tmp, false); - const rmat m_ = r * r_b.t(); + rmat m_; + switch (1) + { + case 0: + default: + m_ = r * r_b.t(); + break; + case 1: + m_ = r_b.t() * r; + } + const dmat<3, 1> euler = rmat::rmat_to_euler(m_); for (int i = 0; i < 3; i++) { |