Merge remote-tracking branch 'origin/master' into oxidize_cucumber

This commit is contained in:
Dennis
2024-05-31 09:29:45 +02:00
31 changed files with 87 additions and 242 deletions
@@ -6,6 +6,7 @@
#include "util/coordinate_calculation.hpp"
#include <boost/optional/optional_io.hpp>
#include <numbers>
namespace osrm::extractor::intersection
{
@@ -79,11 +80,11 @@ namespace
{
double findAngleBisector(double alpha, double beta)
{
alpha *= M_PI / 180.;
beta *= M_PI / 180.;
alpha *= std::numbers::pi / 180.;
beta *= std::numbers::pi / 180.;
const auto average =
180. * std::atan2(std::sin(alpha) + std::sin(beta), std::cos(alpha) + std::cos(beta)) /
M_PI;
180. * std::atan2(std::sin(alpha) + std::sin(beta), std::cos(alpha) + std::cos(beta)) *
std::numbers::inv_pi;
return std::fmod(average + 360., 360.);
}
@@ -351,7 +351,7 @@ bool MergableRoadDetector::IsCircularShape(const NodeID intersection_node,
// ---- ----
// \ /
// -------
const auto constexpr CIRCULAR_POLYGON_ISOPERIMETRIC_LOWER_BOUND = 0.85 / (4 * M_PI);
const auto constexpr CIRCULAR_POLYGON_ISOPERIMETRIC_LOWER_BOUND = 0.85 / (4 * std::numbers::pi);
if (connect_again && coordinates_to_the_left.front() == coordinates_to_the_left.back())
{ // if the left and right roads connect again and are closed polygons ...
const auto area = util::coordinate_calculation::computeArea(coordinates_to_the_left);
@@ -359,7 +359,7 @@ bool MergableRoadDetector::IsCircularShape(const NodeID intersection_node,
const auto area_to_squared_perimeter_ratio = std::abs(area) / (perimeter * perimeter);
// then don't merge roads if A/L² is greater than the lower bound
BOOST_ASSERT(area_to_squared_perimeter_ratio <= 1. / (4 * M_PI));
BOOST_ASSERT(area_to_squared_perimeter_ratio <= 1. / (4 * std::numbers::pi));
if (area_to_squared_perimeter_ratio >= CIRCULAR_POLYGON_ISOPERIMETRIC_LOWER_BOUND)
return true;
}
+1 -1
View File
@@ -337,7 +337,7 @@ RoundaboutType RoundaboutHandler::getRoundaboutType(const NodeID nid) const
return RoundaboutType::RoundaboutIntersection;
}
const double radius = roundabout_length / (2 * M_PI);
const double radius = roundabout_length * 0.5 * std::numbers::inv_pi;
// Looks like a rotary: large roundabout with dedicated name
// do we have a dedicated name for the rotary, if not its a roundabout
+1 -1
View File
@@ -64,7 +64,7 @@ Napi::Object Engine::Init(Napi::Env env, Napi::Object exports)
* ```
*
* @param {Object|String} [options={shared_memory: true}] Options for creating an OSRM object or string to the `.osrm` file.
* @param {String} [options.algorithm] The algorithm to use for routing. Can be 'CH', 'CoreCH' or 'MLD'. Default is 'CH'.
* @param {String} [options.algorithm] The algorithm to use for routing. Can be 'CH', or 'MLD'. Default is 'CH'.
* Make sure you prepared the dataset with the correct toolchain.
* @param {Boolean} [options.shared_memory] Connects to the persistent shared memory datastore.
* This requires you to run `osrm-datastore` prior to creating an `OSRM` object.
-7
View File
@@ -36,13 +36,6 @@ OSRM::OSRM(engine::EngineConfig &config)
// Now, check that the algorithm requested can be used with the data
// that's available.
if (config.algorithm == EngineConfig::Algorithm::CoreCH)
{
util::Log(logWARNING) << "Using CoreCH is deprecated. Falling back to CH";
config.algorithm = EngineConfig::Algorithm::CH;
}
switch (config.algorithm)
{
case EngineConfig::Algorithm::CH:
+2 -2
View File
@@ -61,7 +61,7 @@ std::istream &operator>>(std::istream &in, EngineConfig::Algorithm &algorithm)
in >> token;
boost::to_lower(token);
if (token == "ch" || token == "corech")
if (token == "ch")
algorithm = EngineConfig::Algorithm::CH;
else if (token == "mld")
algorithm = EngineConfig::Algorithm::MLD;
@@ -159,7 +159,7 @@ inline unsigned generateServerProgramOptions(const int argc,
("algorithm,a",
value<EngineConfig::Algorithm>(&config.algorithm)
->default_value(EngineConfig::Algorithm::CH, "CH"),
"Algorithm to use for the data. Can be CH, CoreCH, MLD.") //
"Algorithm to use for the data. Can be CH, MLD.") //
("disable-feature-dataset",
value<std::vector<storage::FeatureDataset>>(&config.disable_feature_dataset)->multitoken(),
"Disables a feature dataset from being loaded into memory if not needed. Options: "
+1 -2
View File
@@ -146,7 +146,6 @@ double bearing(const Coordinate coordinate_1, const Coordinate coordinate_2)
double computeAngle(const Coordinate first, const Coordinate second, const Coordinate third)
{
using namespace boost::math::constants;
using namespace coordinate_calculation;
if (first == second || second == third)
@@ -163,7 +162,7 @@ double computeAngle(const Coordinate first, const Coordinate second, const Coord
const double v2y =
web_mercator::latToY(toFloating(third.lat)) - web_mercator::latToY(toFloating(second.lat));
double angle = (atan2_lookup(v2y, v2x) - atan2_lookup(v1y, v1x)) * 180. / pi<double>();
double angle = (atan2_lookup(v2y, v2x) - atan2_lookup(v1y, v1x)) * 180. * std::numbers::inv_pi;
while (angle < 0.)
{