handle missing cases, cleaning up
This commit is contained in:
@@ -218,8 +218,7 @@ bool IntersectionGenerator::CanMerge(const NodeID node_at_intersection,
|
||||
coordinate_at_intersection,
|
||||
node_at_intersection](const std::size_t index,
|
||||
const std::size_t other_index) {
|
||||
const auto GetActualTarget = [&](const std::size_t index)
|
||||
{
|
||||
const auto GetActualTarget = [&](const std::size_t index) {
|
||||
EdgeID last_in_edge_id;
|
||||
GetActualNextIntersection(
|
||||
node_at_intersection, intersection[index].turn.eid, nullptr, &last_in_edge_id);
|
||||
@@ -239,6 +238,10 @@ bool IntersectionGenerator::CanMerge(const NodeID node_at_intersection,
|
||||
const double distance_to_target = util::coordinate_calculation::haversineDistance(
|
||||
coordinate_at_intersection, coordinate_at_target);
|
||||
|
||||
const constexpr double MAX_COLLAPSE_DISTANCE = 30;
|
||||
if (distance_to_target < MAX_COLLAPSE_DISTANCE)
|
||||
return false;
|
||||
|
||||
const bool becomes_narrower =
|
||||
angularDeviation(turn_angle, other_turn_angle) < NARROW_TURN_ANGLE &&
|
||||
angularDeviation(turn_angle, other_turn_angle) <
|
||||
@@ -474,14 +477,14 @@ Intersection IntersectionGenerator::MergeSegregatedRoads(const NodeID intersecti
|
||||
Intersection IntersectionGenerator::AdjustForJoiningRoads(const NodeID node_at_intersection,
|
||||
Intersection intersection) const
|
||||
{
|
||||
// FIXME remove
|
||||
return intersection;
|
||||
// nothing to do for dead ends
|
||||
if (intersection.size() <= 1)
|
||||
return intersection;
|
||||
|
||||
for (auto &road : intersection)
|
||||
// We can't adjust the very first angle, because the u-turn should always be 0
|
||||
for (std::size_t road_index = 1; road_index < intersection.size(); ++road_index)
|
||||
{
|
||||
auto &road = intersection[road_index];
|
||||
// to find out about the above situation, we need to look at the next intersection (at d in
|
||||
// the example). If the initial road can be merged to the left/right, we are about to adjust
|
||||
// the angle.
|
||||
@@ -525,7 +528,7 @@ Intersection IntersectionGenerator::AdjustForJoiningRoads(const NodeID node_at_i
|
||||
return intersection;
|
||||
}
|
||||
|
||||
inline Intersection
|
||||
Intersection
|
||||
IntersectionGenerator::GetActualNextIntersection(const NodeID starting_node,
|
||||
const EdgeID via_edge,
|
||||
NodeID *resulting_from_node = nullptr,
|
||||
|
||||
Reference in New Issue
Block a user