actually calculate distance instead of using .distance which is a timing value
This commit is contained in:
@@ -298,6 +298,12 @@ CoordinateExtractor::GetCoordinateAlongRoad(const NodeID intersection_node,
|
||||
return TrimCoordinatesToLength(coordinates, LOOKAHEAD_DISTANCE_WITHOUT_LANES).back();
|
||||
}
|
||||
|
||||
std::vector<util::Coordinate>
|
||||
CoordinateExtractor::GetForwardCoordinatesAlongRoad(const NodeID from, const EdgeID turn_edge) const
|
||||
{
|
||||
return GetCoordinatesAlongRoad(from, turn_edge, false, node_based_graph.GetTarget(turn_edge));
|
||||
}
|
||||
|
||||
std::vector<util::Coordinate>
|
||||
CoordinateExtractor::GetCoordinatesAlongRoad(const NodeID intersection_node,
|
||||
const EdgeID turn_edge,
|
||||
|
||||
@@ -649,6 +649,12 @@ IntersectionGenerator::GetActualNextIntersection(const NodeID starting_node,
|
||||
return result;
|
||||
}
|
||||
|
||||
const CoordinateExtractor&
|
||||
IntersectionGenerator::GetCoordinateExtractor() const
|
||||
{
|
||||
return coordinate_extractor;
|
||||
}
|
||||
|
||||
} // namespace guidance
|
||||
} // namespace extractor
|
||||
} // namespace osrm
|
||||
|
||||
@@ -162,8 +162,12 @@ operator()(const NodeID, const EdgeID source_edge_id, Intersection intersection)
|
||||
return intersection;
|
||||
|
||||
// Threshold check, if the intersection is too far away, don't bother continuing
|
||||
const auto &next_road_data = node_based_graph.GetEdgeData(next_road.turn.eid);
|
||||
if (next_road_data.distance > MAX_SLIPROAD_THRESHOLD)
|
||||
const auto coordinate_extractor = intersection_generator.GetCoordinateExtractor();
|
||||
const auto next_road_length = util::coordinate_calculation::getLength(
|
||||
coordinate_extractor.GetForwardCoordinatesAlongRoad(
|
||||
node_based_graph.GetTarget(source_edge_id), next_road.turn.eid),
|
||||
&util::coordinate_calculation::haversineDistance);
|
||||
if (next_road_length > MAX_SLIPROAD_THRESHOLD)
|
||||
{
|
||||
return intersection;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#include "extractor/guidance/turn_discovery.hpp"
|
||||
#include "extractor/guidance/constants.hpp"
|
||||
#include "util/coordinate_calculation.hpp"
|
||||
|
||||
namespace osrm
|
||||
{
|
||||
@@ -34,9 +35,14 @@ bool findPreviousIntersection(const NodeID node_v,
|
||||
*/
|
||||
const constexpr double COMBINE_DISTANCE_CUTOFF = 30;
|
||||
|
||||
const auto coordinate_extractor = turn_analysis.getGenerator().GetCoordinateExtractor();
|
||||
const auto via_edge_length = util::coordinate_calculation::getLength(
|
||||
coordinate_extractor.GetForwardCoordinatesAlongRoad(node_v, via_edge),
|
||||
&util::coordinate_calculation::haversineDistance);
|
||||
|
||||
// we check if via-edge is too short. In this case the previous turn cannot influence the turn
|
||||
// at via_edge and the intersection at NODE_W
|
||||
if (node_based_graph.GetEdgeData(via_edge).distance > COMBINE_DISTANCE_CUTOFF)
|
||||
if (via_edge_length > COMBINE_DISTANCE_CUTOFF)
|
||||
return false;
|
||||
|
||||
// Node -> Via_Edge -> Intersection[0 == UTURN] -> reverse_of(via_edge) -> Intersection at node
|
||||
|
||||
Reference in New Issue
Block a user