fix over-eager intersection polygon that ate a curve due to two hits with the perpendicular

This commit is contained in:
Dustin Carlino 2019-02-08 12:16:06 -08:00
parent bb6f5e0af0
commit cb752dceff
2 changed files with 3 additions and 4 deletions

View File

@ -12,8 +12,6 @@
- the base geometry in OSM is just wrong... because ways have to be connected at the center lines
- one-lane coming off a 4 or 5 lane and going one way... maybe it should be shifted to the other side
- that messes up the nice curve later. need to clip, not shift.
- o123 is a pretty weird shape, it eats the entire curve
- did the second_half stuff mess things up?
- o40 has a long cut when merged, why not hit in the middle?
- what if we allow intersections between infinite lines for merged cases?
- try it bigger

View File

@ -136,8 +136,9 @@ fn generalized_trim_back(
)
.infinite();
// How could something perpendicular to a shifted polyline never hit the original
// polyline?
let trim_to = road_center.intersection_infinite(&perp).unwrap();
// polyline? Also, find the hit closest to the intersection -- this matters for
// very curvy roads, like highway ramps.
let trim_to = road_center.reversed().intersection_infinite(&perp).unwrap();
let trimmed = road_center.get_slice_ending_at(trim_to).unwrap();
if trimmed.length() < shortest_center.length() {
shortest_center = trimmed;