Skip to content

Commit da502c7

Browse files
committed
draw_basic.cpp uses std::numbers::pi instead of M_PI, undo changes for ezgl/graphics.hpp subtree
1 parent 5aee083 commit da502c7

File tree

2 files changed

+4
-9
lines changed

2 files changed

+4
-9
lines changed

libs/EXTERNAL/libezgl/include/ezgl/graphics.hpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,6 @@
3939
#include <functional>
4040
#include <string>
4141
#include <vector>
42-
#ifdef _WIN32
43-
#define _USE_MATH_DEFINES // ensure (non-standard) value of M_PI is brought in from math.h
44-
#endif
4542
#include <cfloat>
4643
#include <cmath>
4744
#include <algorithm>

vpr/src/draw/draw_basic.cpp

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,7 @@
44
#ifndef NO_GRAPHICS
55

66
#include <cstdio>
7-
#ifdef _WIN32
8-
#define _USE_MATH_DEFINES // ensure (non-standard) value of M_PI is brought in from math.h
9-
#endif
7+
#include <numbers>
108
#include <cmath>
119
#include <algorithm>
1210
#include <sstream>
@@ -1229,7 +1227,7 @@ void draw_flyline_timing_edge(ezgl::point2d start, ezgl::point2d end, float incr
12291227
std::string incr_delay_str = ss.str();
12301228

12311229
// Get the angle of line, to rotate the text
1232-
float text_angle = (180 / M_PI)
1230+
float text_angle = (180 / std::numbers::pi)
12331231
* atan((end.y - start.y) / (end.x - start.x));
12341232

12351233
// Get the screen coordinates for text drawing
@@ -1244,9 +1242,9 @@ void draw_flyline_timing_edge(ezgl::point2d start, ezgl::point2d end, float incr
12441242

12451243
// Find an offset so it is sitting on top/below of the line
12461244
float x_offset = screen_coords.center().x
1247-
- 8 * sin(text_angle * (M_PI / 180));
1245+
- 8 * sin(text_angle * (std::numbers::pi / 180));
12481246
float y_offset = screen_coords.center().y
1249-
- 8 * cos(text_angle * (M_PI / 180));
1247+
- 8 * cos(text_angle * (std::numbers::pi / 180));
12501248

12511249
ezgl::point2d offset_text_bbox(x_offset, y_offset);
12521250
g->draw_text(offset_text_bbox, incr_delay_str.c_str(),

0 commit comments

Comments
 (0)