Folds mercator projections into coordinate_calculation
This commit is contained in:
@@ -62,8 +62,14 @@ double bearing(const FixedPointCoordinate first_coordinate,
|
||||
double computeAngle(const FixedPointCoordinate first,
|
||||
const FixedPointCoordinate second,
|
||||
const FixedPointCoordinate third);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
namespace mercator
|
||||
{
|
||||
double yToLat(const double value);
|
||||
double latToY(const double latitude);
|
||||
} // ns mercator
|
||||
} // ns coordinate_calculation
|
||||
} // ns util
|
||||
} // ns osrm
|
||||
|
||||
#endif // COORDINATE_CALCULATION
|
||||
|
||||
@@ -1,26 +0,0 @@
|
||||
#ifndef MERCATOR_HPP
|
||||
#define MERCATOR_HPP
|
||||
|
||||
#include <cmath>
|
||||
|
||||
namespace osrm
|
||||
{
|
||||
namespace util
|
||||
{
|
||||
namespace mercator
|
||||
{
|
||||
|
||||
inline double yToLat(const double value) noexcept
|
||||
{
|
||||
return 180. * M_1_PI * (2. * std::atan(std::exp(value * M_PI / 180.)) - M_PI_2);
|
||||
}
|
||||
|
||||
inline double latToY(const double latitude) noexcept
|
||||
{
|
||||
return 180. * M_1_PI * std::log(std::tan(M_PI_4 + latitude * (M_PI / 180.) / 2.));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif // MERCATOR_HPP
|
||||
@@ -8,7 +8,6 @@
|
||||
|
||||
#include "util/bearing.hpp"
|
||||
#include "util/integer_range.hpp"
|
||||
#include "util/mercator.hpp"
|
||||
#include "util/osrm_exception.hpp"
|
||||
#include "util/typedefs.hpp"
|
||||
|
||||
@@ -140,8 +139,8 @@ class StaticRTree
|
||||
FixedPointCoordinate(coordinate_list.at(current_element.v).lat,
|
||||
coordinate_list.at(current_element.v).lon));
|
||||
current_centroid.lat =
|
||||
COORDINATE_PRECISION *
|
||||
mercator::latToY(current_centroid.lat / COORDINATE_PRECISION);
|
||||
COORDINATE_PRECISION * coordinate_calculation::mercator::latToY(
|
||||
current_centroid.lat / COORDINATE_PRECISION);
|
||||
|
||||
current_wrapper.m_hilbert_value = hilbertCode(current_centroid);
|
||||
}
|
||||
@@ -342,7 +341,7 @@ class StaticRTree
|
||||
{
|
||||
std::vector<EdgeDataT> results;
|
||||
std::pair<double, double> projected_coordinate = {
|
||||
mercator::latToY(input_coordinate.lat / COORDINATE_PRECISION),
|
||||
coordinate_calculation::mercator::latToY(input_coordinate.lat / COORDINATE_PRECISION),
|
||||
input_coordinate.lon / COORDINATE_PRECISION};
|
||||
|
||||
// initialize queue with root element
|
||||
|
||||
Reference in New Issue
Block a user