summaryrefslogtreecommitdiff
path: root/src/mbgl/util/geo.cpp
diff options
context:
space:
mode:
authorBruno de Oliveira Abinader <bruno@mapbox.com>2016-03-10 19:49:09 +0200
committerBruno de Oliveira Abinader <bruno@mapbox.com>2016-03-18 00:53:14 +0200
commitac70ada2d3e9b842a1fd3f46361d323ddb20d232 (patch)
treed1dedaf12bee23241b55622210378981299a567c /src/mbgl/util/geo.cpp
parentcfcccb94a10c60444438049c078b066ea9a08463 (diff)
downloadqtlocation-mapboxgl-ac70ada2d3e9b842a1fd3f46361d323ddb20d232.tar.gz
[core] Check for NaNs in mbgl::util::{min,max,clamp}
Diffstat (limited to 'src/mbgl/util/geo.cpp')
-rw-r--r--src/mbgl/util/geo.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/mbgl/util/geo.cpp b/src/mbgl/util/geo.cpp
index bf7cf38117..7d9db65c4c 100644
--- a/src/mbgl/util/geo.cpp
+++ b/src/mbgl/util/geo.cpp
@@ -1,3 +1,4 @@
+#include <mbgl/util/math.hpp>
#include <mbgl/util/geo.hpp>
#include <mbgl/util/constants.hpp>
#include <mbgl/map/tile_id.hpp>
@@ -13,8 +14,8 @@ LatLng::LatLng(const TileID& id) {
}
ScreenCoordinate LatLng::project() const {
- // Clamp to the latitude limits of Mercator.
- const double constrainedLatitude = ::fmin(::fmax(latitude, -util::LATITUDE_MAX), util::LATITUDE_MAX);
+ // Clamp to the latitude limits of Web Mercator.
+ const double constrainedLatitude = util::clamp(latitude, -util::LATITUDE_MAX, util::LATITUDE_MAX);
// Project a coordinate into unit space in a square map.
const double sine = std::sin(constrainedLatitude * util::DEG2RAD);