a-b-street/abstreet

Draw partly overlapping paths

Open

#884 opened on 2022年3月23日

GitHub で見る
 (8 comments) (0 reactions) (0 assignees)Rust (6,779 stars) (256 forks)batch import
good first issue

説明

In the LTN route planning tool, we display 4 routes at a time: Screenshot from 2022-03-23 10-52-47 Zooming in a bit, you can see some of the routes overlap, but then split off and maybe rejoin: Screenshot from 2022-03-23 10-53-17

I find this visually confusing. An idea is to draw one thick line, but divide it into pieces per color when needed. Something like: Screenshot from 2022-03-23 10-53-40 So at first, red, blue, and green share the road. Red splits off and takes the full road. Green and blue continue and split by half, then they each branch out and take the full width. I swear I've seen this kind of wayfinding either in a large train station or maybe even a videogame.

It could be tricky to implement, but possibly fun. Not sure how, but maybe one thing to start with is splitting a Path into pieces based on overlap with a second Path. Maybe this would return something like:

path1: [(subset of path, shared or exclusive), (subset of path, shared or exclusive), ...] path2: [(subset of path, shared or exclusive), (subset of path, shared or exclusive), ...]

Maybe this operation should directly work off multiple inputs (3 or 4 paths), or maybe we could build it off pairs at a time. Then we could draw each path subset using trace and pick appropriate widths. When multiple paths overlap, I guess maybe we have to shift the polyline left or right and adjust the width. Not sure this approach is the most sensible, just an idea.

@jamesneb in case it's interesting

コントリビューターガイド