-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Intersection geometry refactor #136
Comments
Without knowing the details of the current algorithm, I am heartened to read these individual points, because a lot of them make sense to me! That first list of steps all sound great to me (though I can't comment on I'm imagining one PR that adds I like the idea of different I'm viewing the |
It's maybe a minor point, but as we keep
I think we'll want to do this anyway for #67. I certainly need lane-level routing even in non traffic sim applications. If we didn't care about it, all the lane-level turn restrictions wouldn't even be necessary to track! The big complication here in my mind is about lane-changing, but likely this is one of those weird legacy traffic sim-centered assumptions that we'll revisit and come up with a much simpler idea. |
I think so, yeah. I'm conceptualising the derived data as being updated immediately, but am constantly thinking about ways to delay the actual calculation too. So anything in the public API should cause derived data to be updated straight away, but there should be some other mechanism for transformations to use that is more efficient. The idea of doing an entire transformation all at once is powerful I think:
|
…Roads, not this InputRoad indirection. #136 This paves the way for Roads storing trim_start and trim_end fields. WIP: This breaks some degenerate intersections, and causes some changes everywhere. (More minimal trimming!)
…Roads, not this InputRoad indirection. #136 This paves the way for Roads storing trim_start and trim_end fields. WIP: This breaks some degenerate intersections, and causes some changes everywhere. (More minimal trimming!)
…Roads, not this InputRoad indirection. #136 This paves the way for Roads storing trim_start and trim_end fields.
…Roads, not this InputRoad indirection. #136 This paves the way for Roads storing trim_start and trim_end fields.
…Roads, not this InputRoad indirection. #136 This paves the way for Roads storing trim_start and trim_end fields. No behavioral change, per tests
…intersection geometry algorithm after trimming road centers. #136 This needs a little more work to keep intersections minimal
I have a few branches going with some big cleanups here! Hoping to have a PR out by end of Friday. I started from scratch with the intersection trimming algorithm and arrived at something a bit simpler than the current mess, but only by a little. Some of the complexity there seems to be inherent. But lots goes away if we just trust that roads are coming in already sorted clockwise. |
WIP: It's not maintained everywhere yet
#140 is an uncontroversial start. I have a handful of experiments that I wanted to rubber-duck talk through... simplify_intersection_geomhttps://github.com/a-b-street/osm2streets/tree/simplify_intersection_geom starts deduping the code that generates the final polygon after something else trims back roads.
The corners are too bulky. Instead we want to use all of those places where two road edges were meeting at a point. Because of how I've refactored the code so far, holding onto those points in order is kind of complex. So this branch instead uses the trimmed road lines, continues the last line off to infinity, and looks for the collision point. Because of some cases I don't entirely understand yet, that collision can happen far away, so we restrict it to existing inside the thick first-pass polygon. The result is nicer: But this corner-handling code breaks in a few places I need to work on more. Any thoughts about this strategy generally? simplify_intersection_geom_trust_orderinghttps://github.com/a-b-street/osm2streets/tree/simplify_intersection_geom_trust_ordering rewrites generalized trim from first principles.
maintain_trim_disthttps://github.com/a-b-street/osm2streets/tree/maintain_trim_dist gets rid of
|
That sounds like a sensible enough approach, though there are cases where it is not sufficient. Ideally, the generated section would follow the original edge geometry of the trimmed road until it meets the neighbouring road. Maybe that means the geometry should in fact be calculated at the same time as the trim distances are calculated, or that On the other hand, it might be worth continuing with this approach, and allowing some intersections to have incorrect geometry at that stage. The smaller intersection area is useful as a conservative estimate of the are covered. I think we want to generate actual curb lines at a later stage, taking into account traffic paths, and generating curves.
Extending center lines past their original extent is a powerful ability, and pretty desirable in the long term, I think. This is the kind of thing that makes me want to treat One approach to start with would be to not extend center lines and instead prioritise implementing the ability for intersections to draw lanes going them. Even when that is working, high on/off ramps will still result in huge intersections, but with lanes drawn appropriately through the whole thing, which might still be problematic for A/B Street. |
I'm still puzzling through some of the changes from the placements PR. An example is I've confirmed the problem isn't failing to maintain I'm fairly sure the problem is this: One explanation is that previously we were just getting lucky. If our Unfortunately this means the multiple ideas for refactoring code will get a bit more complicated, but I'll try this idea out, see if it gets better results, and try to put all of the refactoring ideas together in a sensible order for reviewing. |
…tersection geometry refactors. #136
Works sometimes, but brittle. I think we really need to maintain trim distance
…aller diff. Mechanical renaming. #136
Works sometimes, but brittle. I think we really need to maintain trim distance
… making it much simpler. #136 The test diffs look fine. There are arbitrary choices we can change later.
I rewrote the handling for dead-ends and map edges from scratch. It's much simpler now, and the square intersection shapes look nice. See https://github.com/a-b-street/osm2streets/blob/3f41273ab3a7a1ba079614f778c0b36dd113e732/osm2streets/src/geometry/terminus.rs for caveats. An example of winding up with too-short roads is: I'm going to rewrite the degenerate handling from scratch now too, then tackle the harder generalized + pretrimmed cases. Will open a PR for anything non-trivial |
…Start recording trim_start and trim_end and use that to calculate the final trimmed center line. #136
…rmally. #136 Immense improvement to many tests
…rmally. #136 Immense improvement to many tests
case where we need to remove orphaned intersections immediately, and simplify the intersection geometry transform a bit. #136
case where we need to remove orphaned intersections immediately, and simplify the intersection geometry transform a bit. #136
… that's necessary. #136 Introduces some big regressions from effectively detecting and short roads earlier.
https://github.com/a-b-street/osm2streets/tree/op_not_transform is an attempt to wrap up the hard remaining piece of this issue -- updating trims and geometry constantly, not as one big transformation pass at the end. It introduces regressions like... But also makes some improvements, like no longer shrinking overlapping roads in The root problem is a big change in ordering of operations. Now we set The new thing may be "correct" -- the regressions are in places where the current |
…rimmed by the time transformations run. #136 In fact, this improves a few cases! Pretrimmed distances should always reflect the "original" state of the graph, for maximum trim.
…rimmed by the time transformations run. #136 In fact, this improves a few cases! Pretrimmed distances should always reflect the "original" state of the graph, for maximum trim.
…rimmed by the time transformations run. #136 In fact, this improves a few cases! Pretrimmed distances should always reflect the "original" state of the graph, for maximum trim.
There are a few ideas rumbling around for improving intersection geometry code. The current thing is quite a scary mess. In some first attempts to detangle it, I think I've found some smaller cleanup steps that should happen in some order first.
InputRoad
and returningResults
. Every road should have start and end trim distances, which can both be passed in (the results from the previous round) and modified by the algorithm.intersection.point
; it's a meaningless field after the first transformation. We can set the initial intersection polygon guess to be a circle there, maybe.trim_roads_for_merging
and instead store start/end trim distance on every roadRoadLine
,Piece
, and maybeEdge
from Start rendering sidewalk corners. #130.I think some/all of the above should happen before we attempt to remove the intersection geom transformation and instead always keep things updated as we make mutations elsewhere in the codebase.
More dramatic ideas:
generalized_trim_back
. We should only look for collisions between adjacent pairs of road edges.second_half
mess and the problems with two polylines hitting each other at multiple pointsdeduped.sort_by_key
stuff at the end if possible. See what tests break without it. We should be able to produce the polygon points in the correct order, if our input roads are sorted correctly.pretrimmed_geometry
case less weird. Maybe take the main algorithm and first go updatetrim_start
andtrim_end
everywhere. Then have a second method that just produces the polygon from that.on_off_ramp
from scratch. Maybe this is triggered byIntersectionKind
now and has nothing to do with highway type. Maybe there are better ideas to generate the geometry here.The text was updated successfully, but these errors were encountered: