summaryrefslogtreecommitdiffhomepage
path: root/opentrack-logic/tracker.cpp
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2016-08-09 11:39:46 +0200
committerStanislaw Halik <sthalik@misaki.pl>2016-08-09 11:39:46 +0200
commit40a00851315e193f19ab71e516fbb4c135f44f03 (patch)
tree132cbe200a185712b8c0af8f717c073e729b941f /opentrack-logic/tracker.cpp
parente52f4f6e9df4634c9f01b84c73e30c06ad5e6dc6 (diff)
logic/tracker: simplify
- no need to declare "inverts" as an array. it's used in only one place - class Pose is redundant, use an alias for Mat<...> - declare static constexpr const for logger stuff
Diffstat (limited to 'opentrack-logic/tracker.cpp')
-rw-r--r--opentrack-logic/tracker.cpp19
1 files changed, 5 insertions, 14 deletions
diff --git a/opentrack-logic/tracker.cpp b/opentrack-logic/tracker.cpp
index f36591e4..746a29f4 100644
--- a/opentrack-logic/tracker.cpp
+++ b/opentrack-logic/tracker.cpp
@@ -115,15 +115,6 @@ constexpr double Tracker::c_div;
void Tracker::logic()
{
- bool inverts[6] = {
- m(0).opts.invert,
- m(1).opts.invert,
- m(2).opts.invert,
- m(3).opts.invert,
- m(4).opts.invert,
- m(5).opts.invert,
- };
-
using namespace euler;
Pose value, raw;
@@ -255,7 +246,7 @@ void Tracker::logic()
value(i) += m(i).opts.zero;
for (int i = 0; i < 6; i++)
- value(i) *= int(inverts[i]) * -2 + 1;
+ value(i) *= int(m(i).opts.invert) * -2 + 1;
if (zero_)
for (int i = 0; i < 6; i++)
@@ -314,13 +305,13 @@ void Tracker::run()
#endif
{
- const char* posechannels[6] = { "TX", "TY", "TZ", "Yaw", "Pitch", "Roll" };
- const char* datachannels[5] = { "dt", "raw", "corrected", "filtered", "mapped" };
+ static constexpr const char* posechannels[6] = { "TX", "TY", "TZ", "Yaw", "Pitch", "Roll" };
+ static constexpr const char* datachannels[5] = { "dt", "raw", "corrected", "filtered", "mapped" };
logger.write(datachannels[0]);
char buffer[128];
- for (int j = 1; j < 5; ++j)
+ for (unsigned j = 1; j < 5; ++j)
{
- for (int i = 0; i < 6; ++i)
+ for (unsigned i = 0; i < 6; ++i)
{
snprintf(buffer, 128, "%s%s", datachannels[j], posechannels[i]);
logger.write(buffer);