summaryrefslogtreecommitdiffhomepage
path: root/logic
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2016-08-23 13:32:40 +0200
committerStanislaw Halik <sthalik@misaki.pl>2016-08-23 13:32:40 +0200
commit58f76e59cd28dd7239aa7b275e101a14629e9c3b (patch)
tree3bb12fc721d1c740f4fb6270fac09f942a60b356 /logic
parent0888be6331e0f5c5a964788150172dcb9a61bb34 (diff)
logic/tracker: minor nonsense
Diffstat (limited to 'logic')
-rw-r--r--logic/tracker.cpp23
-rw-r--r--logic/tracker.h2
2 files changed, 12 insertions, 13 deletions
diff --git a/logic/tracker.cpp b/logic/tracker.cpp
index db0deee4..4072d932 100644
--- a/logic/tracker.cpp
+++ b/logic/tracker.cpp
@@ -25,7 +25,6 @@
Tracker::Tracker(Mappings &m, SelectedLibraries &libs, TrackLogger &logger) :
m(m),
- newpose {0,0,0, 0,0,0},
libs(libs),
logger(logger),
centerp(s.center_at_startup),
@@ -117,8 +116,8 @@ void Tracker::logic()
if (k < 0 || k >= 6)
value(i) = 0;
else
- value(i) = newpose[k];
- raw(i) = newpose[i];
+ value(i) = newpose(k);
+ raw(i) = newpose(i);
}
logger.write_pose(raw); // raw
@@ -149,8 +148,10 @@ void Tracker::logic()
if (centerp && !nanp)
{
+ using std::fabs;
+
for (int i = 0; i < 6; i++)
- if (fabs(newpose[i]) != 0)
+ if (fabs(newpose(i)) != 0)
{
can_center = true;
break;
@@ -159,7 +160,6 @@ void Tracker::logic()
if (can_center)
{
-
centerp = false;
if (libs.pFilter)
@@ -250,12 +250,11 @@ void Tracker::logic()
}
else
{
- {
- Pose tmp = value;
+ Pose tmp(value);
+
+ if (libs.pFilter)
+ libs.pFilter->filter(tmp, value);
- if (libs.pFilter)
- libs.pFilter->filter(tmp, value);
- }
logger.write_pose(value); // "filtered"
// CAVEAT rotation only, due to tcomp
@@ -346,12 +345,12 @@ void Tracker::run()
while (!should_quit)
{
- double tmp[6] {0,0,0, 0,0,0};
+ Pose tmp;
libs.pTracker->data(tmp);
if (enabledp)
for (int i = 0; i < 6; i++)
- newpose[i] = elide_nan(tmp[i], newpose[i]);
+ newpose[i] = elide_nan(tmp(i), newpose(i));
logic();
diff --git a/logic/tracker.h b/logic/tracker.h
index 6e5faddf..873e0936 100644
--- a/logic/tracker.h
+++ b/logic/tracker.h
@@ -43,7 +43,7 @@ private:
Timer t;
Pose output_pose, raw_6dof, last_mapped, last_raw;
- double newpose[6];
+ Pose newpose;
SelectedLibraries const& libs;
// The owner of the reference is the main window.
// This design might be usefull if we decide later on to swap out