summaryrefslogtreecommitdiffhomepage
path: root/tracker-pt
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2016-07-18 12:14:51 +0200
committerStanislaw Halik <sthalik@misaki.pl>2016-07-19 07:17:22 +0200
commita9b804e18c811c781a099a70b960f5bbde61257d (patch)
tree069a7de35557f4d9ff141d795d287e4ac128f625 /tracker-pt
parent9fc8ebfd8ab54b9fe1caaf60147dd43a573d67ef (diff)
some: replace hardcoded pi values with the same pi constant
We can't depend on M_PI existing after including cmath.
Diffstat (limited to 'tracker-pt')
-rw-r--r--tracker-pt/ftnoir_tracker_pt.h7
-rw-r--r--tracker-pt/ftnoir_tracker_pt_settings.h3
-rw-r--r--tracker-pt/point_extractor.h3
3 files changed, 8 insertions, 5 deletions
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 <QThread>
#include <QMutex>
@@ -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 <limits>
#include <opencv2/core.hpp>
@@ -16,7 +17,7 @@ struct pt_types
using f = double;
static constexpr f eps = std::numeric_limits<f>::epsilon();
- static constexpr f pi = f(3.14159265358979323846);
+ static constexpr f pi = f(OPENTRACK_PI);
template<int n> using vec = cv::Vec<f, n>;
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 <opencv2/imgproc/imgproc.hpp>
#include "ftnoir_tracker_pt_settings.h"
+#include "opentrack-compat/pi-constant.hpp"
#include <QMutex>
#include <vector>
@@ -29,7 +30,7 @@ public:
settings_pt s;
private:
- static constexpr double pi = 3.14159265359;
+ static constexpr double pi = OPENTRACK_PI;
std::vector<vec2> points;
QMutex mtx;