Replace M_PI with std::numbers:pi (#2713)

This commit is contained in:
Bart Louwers
2024-08-13 01:26:49 +02:00
committed by GitHub
parent b42fa344b3
commit d19ab42d0a
22 changed files with 126 additions and 64 deletions

View File

@@ -35,7 +35,11 @@
#include <mbgl/gl/types.hpp>
#include <mbgl/renderer/image_manager.hpp>
#include <numbers>
using namespace mbgl::platform;
using namespace std::numbers;
namespace mbgl {
struct LocationIndicatorRenderParameters {
@@ -108,8 +112,8 @@ protected:
const vec2 norm = normalized();
// From theta to bearing
return util::rad2degf(util::wrap<float>(
static_cast<float>(M_PI_2) - std::atan2(-norm.y, norm.x), 0.0f, static_cast<float>(M_PI * 2.0)));
return util::rad2degf(
util::wrap<float>((pi_v<float> / 2) - std::atan2(-norm.y, norm.x), 0.0f, pi_v<float> * 2));
}
Point<double> toPoint() const { return {x, y}; }