14#if defined(_WIN32) && !defined(_USE_MATH_DEFINES)
15# define _USE_MATH_DEFINES
37 template <
class float_type>
38 static void LatLonToMercator(
double lat,
double lon,
double scale, float_type &mx, float_type &my) {
40 my = scale *
EARTH_RADIUS_EQUA * std::log(std::tan((90.0 + lat) * Math::Pi<double>() / 360.0));
45 static void MercatorToLatLon(
double mx,
double my,
double scale,
double &lat,
double &lon) {
47 lat = 360.0 * std::atan(std::exp(my / (
EARTH_RADIUS_EQUA * scale))) / Math::Pi<double>() - 90.0;
70 location.
x, -location.
y,
71 result.latitude, result.longitude);
GeoLocation Transform(const Location &location) const
Transform the given location to a GeoLocation using this as geo-reference.
static constexpr T ToRadians(T deg)
static double LatToScale(double lat)
Convert latitude to scale, which is needed by mercator transformations
static void LatLonToMercator(double lat, double lon, double scale, float_type &mx, float_type &my)
Converts lat/lon/scale to mx/my (mx/my in meters if correct scale is given).
static void MercatorToLatLon(double mx, double my, double scale, double &lat, double &lon)
Converts mx/my/scale to lat/lon (mx/my in meters if correct scale is given).
static constexpr double EARTH_RADIUS_EQUA
Earth radius at equator [m].
static void LatLonAddMeters(double lat_start, double lon_start, double dx, double dy, double &lat_end, double &lon_end)
Adds meters dx/dy to given lat/lon and returns new lat/lon.
This file contains definitions of common data structures used in traffic manager.