summaryrefslogtreecommitdiff
path: root/plugingui
diff options
context:
space:
mode:
authorBent Bisballe Nyeng <deva@aasimon.org>2020-03-08 14:26:42 +0100
committerBent Bisballe Nyeng <deva@aasimon.org>2020-03-08 14:31:46 +0100
commit96939530fe1b997f2161ea94356888cb37ca2a2a (patch)
treee6ba8f5e5a83524bcdec8af1b8d214b1f14ea8bd /plugingui
parent1fe164e36f0996fb07f62de0ac38199943818095 (diff)
Get rid of c-style M_PI.
Diffstat (limited to 'plugingui')
-rw-r--r--plugingui/knob.cc19
1 files changed, 9 insertions, 10 deletions
diff --git a/plugingui/knob.cc b/plugingui/knob.cc
index 3d09d51..25200a7 100644
--- a/plugingui/knob.cc
+++ b/plugingui/knob.cc
@@ -29,13 +29,12 @@
#include "painter.h"
#include <hugin.hpp>
-#include <stdio.h>
+#include <cmath>
-// M_PI is not defined in math.h if __STRICT_ANSI__ is defined.
-#ifdef __STRICT_ANSI__
-#undef __STRICT_ANSI__
-#endif
-#include <math.h>
+namespace
+{
+const double pi = std::atan(1.0) * 4.0;
+}
namespace GUI
{
@@ -211,11 +210,11 @@ void Knob::repaintEvent(RepaintEvent* repaintEvent)
// Make it start from 20% and stop at 80%
double padval = current_value * 0.8 + 0.1;
- double from_x = sin((-1 * padval + 1) * 2 * M_PI) * radius * 0.6;
- double from_y = cos((-1 * padval + 1) * 2 * M_PI) * radius * 0.6;
+ double from_x = sin((-1 * padval + 1) * 2 * pi) * radius * 0.6;
+ double from_y = cos((-1 * padval + 1) * 2 * pi) * radius * 0.6;
- double to_x = sin((-1 * padval + 1) * 2 * M_PI) * radius * 0.8;
- double to_y = cos((-1 * padval + 1) * 2 * M_PI) * radius * 0.8;
+ double to_x = sin((-1 * padval + 1) * 2 * pi) * radius * 0.8;
+ double to_y = cos((-1 * padval + 1) * 2 * pi) * radius * 0.8;
// Draw "fat" line by drawing 9 lines with moved start/ending points.
p.setColour(Colour(1.0f, 0.0f, 0.0f, 1.0f));