Replace M_PI with std::numbers:pi (#2713)
This commit is contained in:
@@ -14,6 +14,10 @@
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
|
||||
#include <numbers>
|
||||
|
||||
using namespace std::numbers;
|
||||
|
||||
namespace mbgl {
|
||||
|
||||
static double signedArea(const GeometryCoordinates& ring) {
|
||||
@@ -127,7 +131,7 @@ Feature::geometry_type convertGeometry(const GeometryTileFeature& geometryTileFe
|
||||
|
||||
auto tileCoordinatesToLatLng = [&](const Point<int16_t>& p) {
|
||||
double y2 = 180 - (p.y + y0) * 360 / size;
|
||||
return Point<double>((p.x + x0) * 360 / size - 180, std::atan(std::exp(y2 * M_PI / 180)) * 360.0 / M_PI - 90.0);
|
||||
return Point<double>((p.x + x0) * 360 / size - 180, std::atan(std::exp(y2 * pi / 180)) * 360.0 / pi - 90.0);
|
||||
};
|
||||
|
||||
const GeometryCollection& geometries = geometryTileFeature.getGeometries();
|
||||
@@ -205,7 +209,7 @@ GeometryCollection convertGeometry(const Feature::geometry_type& geometryTileFea
|
||||
p.x = int16_t(util::clamp<int64_t>(
|
||||
static_cast<int16_t>(x), std::numeric_limits<int16_t>::min(), std::numeric_limits<int16_t>::max()));
|
||||
|
||||
auto y = (180 - (std::log(std::tan((c.y + 90) * M_PI / 360.0)) * 180 / M_PI)) * size / 360 - y0;
|
||||
auto y = (180 - (std::log(std::tan((c.y + 90) * pi / 360.0)) * 180 / pi)) * size / 360 - y0;
|
||||
p.y = int16_t(util::clamp<int64_t>(
|
||||
static_cast<int16_t>(y), std::numeric_limits<int16_t>::min(), std::numeric_limits<int16_t>::max()));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user