diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2016-07-18 10:29:34 +0200 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2016-07-18 10:29:34 +0200 |
commit | 9fc8ebfd8ab54b9fe1caaf60147dd43a573d67ef (patch) | |
tree | 16ce8640a875e9381e11f6a8587cb060685084e2 /proto-ft | |
parent | 181770b1e169b9c7c75eacdc969102cce18a8be7 (diff) |
proto/ft: cleanup deg->rad conversionopentrack-2.3-rc49p9
Diffstat (limited to 'proto-ft')
-rw-r--r-- | proto-ft/ftnoir_protocol_ft.cpp | 18 | ||||
-rw-r--r-- | proto-ft/ftnoir_protocol_ft.h | 2 |
2 files changed, 14 insertions, 6 deletions
diff --git a/proto-ft/ftnoir_protocol_ft.cpp b/proto-ft/ftnoir_protocol_ft.cpp index 111af156..d0e89753 100644 --- a/proto-ft/ftnoir_protocol_ft.cpp +++ b/proto-ft/ftnoir_protocol_ft.cpp @@ -37,10 +37,11 @@ FTNoIR_Protocol::~FTNoIR_Protocol() dummyTrackIR.waitForFinished(50); } -void FTNoIR_Protocol::pose(const double* headpose) { - const float yaw = -rads_to_degrees(headpose[Yaw]); - const float pitch = -rads_to_degrees(headpose[Pitch]); - const float roll = rads_to_degrees(headpose[Roll]); +void FTNoIR_Protocol::pose(const double* headpose) +{ + const float yaw = -degrees_to_rads(headpose[Yaw]); + const float pitch = -degrees_to_rads(headpose[Pitch]); + const float roll = degrees_to_rads(headpose[Roll]); const float tx = float(headpose[TX] * 10); const float ty = float(headpose[TY] * 10); const float tz = float(headpose[TZ] * 10); @@ -93,7 +94,14 @@ void FTNoIR_Protocol::pose(const double* headpose) { data->DataID += 1; } -void FTNoIR_Protocol::start_tirviews() { +float FTNoIR_Protocol::degrees_to_rads(double degrees) +{ + static constexpr double pi = 3.14159265358979323846; + return float(degrees*pi/180); +} + +void FTNoIR_Protocol::start_tirviews() +{ QString aFileName = OPENTRACK_BASE_PATH + OPENTRACK_LIBRARY_PATH "TIRViews.dll"; if ( QFile::exists( aFileName )) { FTIRViewsLib.setFileName(aFileName); diff --git a/proto-ft/ftnoir_protocol_ft.h b/proto-ft/ftnoir_protocol_ft.h index d2d40449..d90d916e 100644 --- a/proto-ft/ftnoir_protocol_ft.h +++ b/proto-ft/ftnoir_protocol_ft.h @@ -66,9 +66,9 @@ private: QMutex game_name_mutex; static check_for_first_run runonce_check; - static inline float rads_to_degrees(double degrees) { return float(degrees * 0.017453); } void start_tirviews(); void start_dummy(); + static float degrees_to_rads(double degrees); public: static void set_protocols(bool ft, bool npclient); |