summaryrefslogtreecommitdiffhomepage
path: root/opentrack/tracker.cpp
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2014-11-29 12:25:27 +0100
committerStanislaw Halik <sthalik@misaki.pl>2014-11-29 12:25:27 +0100
commite7d57ba055627e6b6c8f6de61a497894e0caa658 (patch)
tree1ffe7924840380d3404e2a80d31623428925f5ec /opentrack/tracker.cpp
parent8a87e1a658f04eaffa10da30f019a64902f8d917 (diff)
implement zero shortcut
Diffstat (limited to 'opentrack/tracker.cpp')
-rw-r--r--opentrack/tracker.cpp24
1 files changed, 18 insertions, 6 deletions
diff --git a/opentrack/tracker.cpp b/opentrack/tracker.cpp
index be0ecd84..a6433da5 100644
--- a/opentrack/tracker.cpp
+++ b/opentrack/tracker.cpp
@@ -26,6 +26,7 @@ Tracker::Tracker(main_settings& s, Mappings &m, SelectedLibraries &libs) :
m(m),
centerp(false),
enabledp(true),
+ zero_(false),
should_quit(false),
libs(libs),
r_b(dmat<3,3>::eye()),
@@ -127,12 +128,26 @@ void Tracker::logic()
m(5).opts.invert,
};
+ static constexpr double pi = 3.141592653;
+ static constexpr double r2d = 180. / pi;
+
Pose value, raw;
- for (int i = 0; i < 6; i++)
+ if (!zero_)
+ for (int i = 0; i < 6; i++)
+ {
+ value(i) = newpose[i];
+ raw(i) = newpose[i];
+ }
+ else
{
- value(i) = newpose[i];
- raw(i) = newpose[i];
+ auto mat = rmat_to_euler(r_b);
+
+ for (int i = 0; i < 3; i++)
+ {
+ raw(i+3) = value(i+3) = mat(i, 0) * r2d;
+ raw(i) = value(i) = t_b[i];
+ }
}
if (centerp)
@@ -149,9 +164,6 @@ void Tracker::logic()
const dmat<3, 1> euler = rmat_to_euler(m_);
for (int i = 0; i < 3; i++)
{
- static constexpr double pi = 3.141592653;
- static constexpr double r2d = 180. / pi;
-
value(i) -= t_b[i];
value(i+3) = euler(i, 0) * r2d;
}