From 8e06d669b5dcbf8360cc93e934c635ec167b3c73 Mon Sep 17 00:00:00 2001 From: Casey Ugone Date: Fri, 9 Feb 2024 13:31:45 -0600 Subject: [PATCH] Replaces global pi value with std::numbers::pi_v --- olcUTIL_Geometry2D.h | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/olcUTIL_Geometry2D.h b/olcUTIL_Geometry2D.h index 7e3be8a..8442af2 100644 --- a/olcUTIL_Geometry2D.h +++ b/olcUTIL_Geometry2D.h @@ -191,6 +191,7 @@ #include #include #include +#include #ifndef OLC_V2D_TYPE #define OLC_V2D_TYPE @@ -507,8 +508,6 @@ namespace olc namespace olc::utils::geom2d { - // Lemon Meringue - inline const double pi = 3.141592653589793238462643383279502884; // Floating point error margin inline const double epsilon = 0.001; @@ -718,13 +717,13 @@ namespace olc::utils::geom2d // Get area of circle inline constexpr T area() const { - return T(pi) * radius * radius; + return std::numbers::pi_v * radius * radius; } // Get circumference of circle inline constexpr T perimeter() const { - return T(2.0 * pi) * radius; + return T(2.0) * std::numbers::pi_v * radius; } // Get circumference of circle