Relax strict bearings ordering condition to non-strict one, #4331

This commit is contained in:
Michael Krasnyk 2017-09-18 18:31:25 +02:00
parent 2532d56b85
commit fa1a4e8bf6

View File

@ -192,10 +192,11 @@ IntersectionGenerator::ComputeIntersectionShape(const NodeID node_at_center_of_i
next != intersection.end(); next != intersection.end();
++curr, ++next) ++curr, ++next)
{ {
if (!bearings_order(*curr, *next)) if (bearings_order(*next, *curr))
{ // If the true bearing is out of the initial order then adjust to keep the order. { // If the true bearing is out of the initial order (next before current) then
// The adjustment angle is at most 0.5 degree or a half-angle // adjust the next bearing to keep the order. The adjustment angle is at most
// between the current bearing and the base bearing to prevent overlaps. // 0.5° or a half-angle between the current bearing and the base bearing.
// to prevent overlapping over base bearing + 360°.
const auto angle_adjustment = std::min( const auto angle_adjustment = std::min(
.5, util::restrictAngleToValidRange(base_bearing - curr->bearing) / 2.); .5, util::restrictAngleToValidRange(base_bearing - curr->bearing) / 2.);
next->bearing = next->bearing =