From a9b804e18c811c781a099a70b960f5bbde61257d Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Mon, 18 Jul 2016 12:14:51 +0200 Subject: some: replace hardcoded pi values with the same pi constant We can't depend on M_PI existing after including cmath. --- tracker-pt/ftnoir_tracker_pt.h | 7 ++++--- tracker-pt/ftnoir_tracker_pt_settings.h | 3 ++- tracker-pt/point_extractor.h | 3 ++- 3 files changed, 8 insertions(+), 5 deletions(-) (limited to 'tracker-pt') diff --git a/tracker-pt/ftnoir_tracker_pt.h b/tracker-pt/ftnoir_tracker_pt.h index 40f9ad4a..d2f69ac2 100644 --- a/tracker-pt/ftnoir_tracker_pt.h +++ b/tracker-pt/ftnoir_tracker_pt.h @@ -17,6 +17,7 @@ #include "pt_video_widget.h" #include "opentrack-compat/timer.hpp" #include "opentrack/opencv-camera-dialog.hpp" +#include "opentrack-compat/pi-constant.hpp" #include #include @@ -32,7 +33,7 @@ class TrackerDialog_PT; // Constantly processes the tracking chain in a separate thread class Tracker_PT : public QThread, public ITracker, private pt_types { - static constexpr double pi = 3.14159265359; + static constexpr double pi = OPENTRACK_PI; Q_OBJECT friend class camera_dialog; @@ -76,8 +77,8 @@ private: volatile bool ever_success; volatile unsigned char commands; - static constexpr f rad2deg = f(180/3.14159265); - //static constexpr float deg2rad = float(3.14159265/180); + static constexpr f rad2deg = f(180/OPENTRACK_PI); + //static constexpr float deg2rad = float(OPENTRACK_PI/180); }; class TrackerDll : public Metadata diff --git a/tracker-pt/ftnoir_tracker_pt_settings.h b/tracker-pt/ftnoir_tracker_pt_settings.h index 830bf92e..f5256f18 100644 --- a/tracker-pt/ftnoir_tracker_pt_settings.h +++ b/tracker-pt/ftnoir_tracker_pt_settings.h @@ -8,6 +8,7 @@ #pragma once +#include "opentrack-compat/pi-constant.hpp" #include #include @@ -16,7 +17,7 @@ struct pt_types using f = double; static constexpr f eps = std::numeric_limits::epsilon(); - static constexpr f pi = f(3.14159265358979323846); + static constexpr f pi = f(OPENTRACK_PI); template using vec = cv::Vec; using vec2 = vec<2>; diff --git a/tracker-pt/point_extractor.h b/tracker-pt/point_extractor.h index 52b4cb32..16740b91 100644 --- a/tracker-pt/point_extractor.h +++ b/tracker-pt/point_extractor.h @@ -13,6 +13,7 @@ #include #include "ftnoir_tracker_pt_settings.h" +#include "opentrack-compat/pi-constant.hpp" #include #include @@ -29,7 +30,7 @@ public: settings_pt s; private: - static constexpr double pi = 3.14159265359; + static constexpr double pi = OPENTRACK_PI; std::vector points; QMutex mtx; -- cgit v1.2.3