Closed dabreegster closed 1 year ago
Before collapsing, something very wrong is happening with clockwise ordering. The north and south intersection both supposedly have 4 roads connected?! And where are the labels?
Ah my mistake, the road ordering layer is relative to the final output, not each debug step
I think https://github.com/a-b-street/osm2streets/blob/687ee0e63b63952d3399e66a5d731fa1f0c6b1cd/osm2streets/src/geometry/general_case.rs#L61 is messing up between r7 and r8. These two form a loop, and we're winding up trimming to the wrong end.
I have a theory that the intersection geometry code give up any time there is a loop road. That would explain the circle at the end.
But the messed up geometry at step 6 is a different problem. I agree that it looks like the wrong end of r8 is being used. But maybe only for some of the calculations? It looks like the algorithm asks about the intersection between r7 and r8 without specifying which end of each road it cares about?
It looks like the algorithm asks about the intersection between r7 and r8 without specifying which end of each road it cares about?
This might be it..
I had a fuzzy thought earlier about how we trim the center line back based on a hit point from the projected left or right line. Right now we either maximize or minimize the length of the resulting polyline, in an attempt to find the one "closest to the intersection." I might try minimizing the distance to the actual hit point we found.. because it should pretty much always be about road_width / 2 away.
I'll try both of these ideas out and try and figure this out finally. Loop roads have caused enough trouble!
https://a-b-street.github.io/osm2streets/#18.41/51.47558/-2.53673 When we collapse degenerate roads, the geometry somewhere blows up, and then this makes us incorrectly collapse a road
https://user-images.githubusercontent.com/1664407/219696918-4731b63b-afd3-4e43-8140-6819e6dc61db.mp4