Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Zolotarev <deathbaba@gmail.com>2010-12-05 19:24:16 +0300
committerAlex Zolotarev <alex@maps.me>2015-09-22 22:33:57 +0300
commitd6e12b7ce4bcbf0ccd1c07eb25de143422913c34 (patch)
treea7e910c330ce4da9b4f2d8be76067adece2561c4 /indexer/mercator.hpp
One Month In Minsk. Made in Belarus.
Diffstat (limited to 'indexer/mercator.hpp')
-rw-r--r--indexer/mercator.hpp33
1 files changed, 33 insertions, 0 deletions
diff --git a/indexer/mercator.hpp b/indexer/mercator.hpp
new file mode 100644
index 0000000000..21cabf7d99
--- /dev/null
+++ b/indexer/mercator.hpp
@@ -0,0 +1,33 @@
+#pragma once
+#include "../geometry/point2d.hpp"
+#include "../base/math.hpp"
+
+struct MercatorBounds
+{
+ static double minX;
+ static double maxX;
+ static double minY;
+ static double maxY;
+
+ inline static double YToLat(double y)
+ {
+ return my::RadToDeg(2.0 * atan(exp(my::DegToRad(y))) - math::pi / 2.0);
+ }
+
+ inline static double LatToY(double lat)
+ {
+ lat = my::clamp(lat, -86.0, 86.0);
+ double const res = my::RadToDeg(log(tan(my::DegToRad(45.0 + lat * 0.5))));
+ return my::clamp(res, -180.0, 180.0);
+ }
+
+ inline static double XToLon(double x)
+ {
+ return x;
+ }
+
+ inline static double LonToX(double lon)
+ {
+ return lon;
+ }
+};