From 351e844f6a3c5484acfcf4fb0154bcab6f1780a0 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Sat, 13 Apr 2013 05:45:07 +0200 Subject: Don't use axes as class/struct members. Use an array instead, and iterate over them where applicable. --- ftnoir_tracker_udp/ftnoir_tracker_udp.cpp | 22 +++++++++------------- ftnoir_tracker_udp/ftnoir_tracker_udp.h | 4 ++-- 2 files changed, 11 insertions(+), 15 deletions(-) (limited to 'ftnoir_tracker_udp') diff --git a/ftnoir_tracker_udp/ftnoir_tracker_udp.cpp b/ftnoir_tracker_udp/ftnoir_tracker_udp.cpp index 4978fa8d..58316298 100644 --- a/ftnoir_tracker_udp/ftnoir_tracker_udp.cpp +++ b/ftnoir_tracker_udp/ftnoir_tracker_udp.cpp @@ -38,12 +38,8 @@ FTNoIR_Tracker::FTNoIR_Tracker() bEnableZ = true; portAddress = 5551; - newHeadPose.x = 0.0f; - newHeadPose.y = 0.0f; - newHeadPose.z = 0.0f; - newHeadPose.yaw = 0.0f; - newHeadPose.pitch = 0.0f; - newHeadPose.roll = 0.0f; + for (int i = 0; i < 6; i++) + newHeadPose[i] = 0; } FTNoIR_Tracker::~FTNoIR_Tracker() @@ -111,26 +107,26 @@ void FTNoIR_Tracker::StartTracker(QFrame* videoFrame) return; } -bool FTNoIR_Tracker::GiveHeadPoseData(THeadPoseData *data) +bool FTNoIR_Tracker::GiveHeadPoseData(double *data) { mutex.lock(); if (bEnableX) { - data->x = newHeadPose.x; + data[TX] = newHeadPose[TX]; } if (bEnableX) { - data->y = newHeadPose.y; + data[TY] = newHeadPose[TY]; } if (bEnableX) { - data->z = newHeadPose.z; + data[TZ] = newHeadPose[TZ]; } if (bEnableYaw) { - data->yaw = newHeadPose.yaw; + data[RX] = newHeadPose[RX]; } if (bEnablePitch) { - data->pitch = newHeadPose.pitch; + data[RY] = newHeadPose[RY]; } if (bEnableRoll) { - data->roll = newHeadPose.roll; + data[RZ] = newHeadPose[RZ]; } mutex.unlock(); return true; diff --git a/ftnoir_tracker_udp/ftnoir_tracker_udp.h b/ftnoir_tracker_udp/ftnoir_tracker_udp.h index d60b27a4..ccb42ac1 100644 --- a/ftnoir_tracker_udp/ftnoir_tracker_udp.h +++ b/ftnoir_tracker_udp/ftnoir_tracker_udp.h @@ -16,7 +16,7 @@ public: ~FTNoIR_Tracker(); void StartTracker( QFrame *videoframe ); - bool GiveHeadPoseData(THeadPoseData *data); + bool GiveHeadPoseData(double *data); void loadSettings(); volatile bool should_quit; void WaitForExit() { @@ -34,7 +34,7 @@ private: QHostAddress destIP; // Destination IP-address QHostAddress srcIP; // Source IP-address - THeadPoseData newHeadPose; // Structure with new headpose + double newHeadPose[6]; // Structure with new headpose float portAddress; // Port-number bool bEnableRoll; -- cgit v1.2.3