Skip to content

Commit

Permalink
fix #14777
Browse files Browse the repository at this point in the history
  • Loading branch information
namdre committed Apr 26, 2024
1 parent bdae8cd commit bf44431
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/netbuild/NBNodeShapeComputer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -754,10 +754,13 @@ NBNodeShapeComputer::badIntersection(const NBEdge* e1, const NBEdge* e2, double
}
const double minDistanceThreshold = (e1->getTotalWidth() + e2->getTotalWidth()) / 2 + POSITION_EPS;
std::vector<double> distances = geom1.distances(geom2, true);
const double minDist = VectorHelper<double>::minValue(distances);
std::vector<double> distances2 = geom1.distances(geom2);
const double minDist = VectorHelper<double>::minValue(distances2);
const double maxDist = VectorHelper<double>::maxValue(distances);
const bool curvingTowards = geom1[0].distanceTo2D(geom2[0]) > minDistanceThreshold && minDist < minDistanceThreshold;
const bool onTop = (maxDist - POSITION_EPS < minDistanceThreshold) && endAngleDiff < 30;
const bool bothDefault = e1->hasDefaultGeometryEndpointAtNode(&myNode) && e2->hasDefaultGeometryEndpointAtNode(&myNode);
const bool neverTouch = minDist > minDistanceThreshold * 2 && !bothDefault;
geom1.extrapolate2D(EXT);
geom2.extrapolate2D(EXT);
Position intersect = geom1.intersectionPosition2D(geom2);
Expand All @@ -768,11 +771,12 @@ NBNodeShapeComputer::badIntersection(const NBEdge* e1, const NBEdge* e2, double
<< " endAngleDiff=" << endAngleDiff
<< " geom1=" << geom1 << " geom2=" << geom2
<< " distances=" << toString(distances) << " minDist=" << minDist << " maxDist=" << maxDist << " thresh=" << minDistanceThreshold
<< " neverTouch=" << neverTouch
<< " intersectPos=" << intersect
<< "\n";
}
#endif
return onTop || curvingTowards || !intersects;
return onTop || curvingTowards || !intersects || neverTouch;
}


Expand Down

0 comments on commit bf44431

Please sign in to comment.