Skip to content

Commit

Permalink
fix #14836
Browse files Browse the repository at this point in the history
  • Loading branch information
namdre committed May 7, 2024
1 parent 022d6a7 commit 777f31b
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/netbuild/NBAlgorithms_Ramps.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
#include "NBAlgorithms_Ramps.h"

#define OFFRAMP_LOOKBACK 500
#define MIN_SPLIT_LENGTH POSITION_EPS

//#define DEBUG_RAMPS
#define DEBUGNODEID ""
Expand Down Expand Up @@ -241,7 +242,7 @@ NBRampsComputer::buildOnRamp(NBNode* cur, NBNodeCont& nc, NBEdgeCont& ec, NBDist
}
}
// check whether a further split is necessary
if (curr != nullptr && !dontSplit && currLength - POSITION_EPS < rampLength && curr->getNumLanes() == firstLaneNumber && std::find(incremented.begin(), incremented.end(), curr) == incremented.end()) {
if (curr != nullptr && !dontSplit && currLength + MIN_SPLIT_LENGTH < rampLength && curr->getNumLanes() == firstLaneNumber && std::find(incremented.begin(), incremented.end(), curr) == incremented.end()) {
// there is enough place to build a ramp; do it
bool wasFirst = first == curr;
std::string newNodeID = getUnusedID(curr->getID() + "-AddedOnRampNode", nc);
Expand Down Expand Up @@ -343,7 +344,7 @@ NBRampsComputer::buildOffRamp(NBNode* cur, NBNodeCont& nc, NBEdgeCont& ec, NBDis
}
}
// check whether a further split is necessary
if (curr != nullptr && !dontSplit && currLength - POSITION_EPS < rampLength && curr->getNumLanes() == firstLaneNumber && std::find(incremented.begin(), incremented.end(), curr) == incremented.end()) {
if (curr != nullptr && !dontSplit && currLength + MIN_SPLIT_LENGTH < rampLength && curr->getNumLanes() == firstLaneNumber && std::find(incremented.begin(), incremented.end(), curr) == incremented.end()) {
// there is enough place to build a ramp; do it
bool wasFirst = first == curr;
Position pos = curr->getGeometry().positionAtOffset(curr->getGeometry().length() - (rampLength - currLength));
Expand Down

0 comments on commit 777f31b

Please sign in to comment.