a-b-street / a-b-street/abstreet

Draw partly overlapping paths

Offen
#884 8 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
good first issue
Vorherrschende Sprache
Rust
Sterne
8.2k
Forks
380
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

In the LTN route planning tool, we display 4 routes at a time:
![Screenshot from 2022-03-23 10-52-47](https://user-images.githubusercontent.com/1664407/159683468-e5bc7158-1686-42f3-a59d-89bd84296486.png)
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](https://user-images.githubusercontent.com/1664407/159683545-2ee781bd-0b1b-409c-87ec-fb5ec9eb0f44.png)

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](https://user-images.githubusercontent.com/1664407/159684019-045b3ef3-7c40-424b-b94f-2371661ceaaa.png)
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](https://github.com/a-b-street/abstreet/blob/c88f7bbc535d52fb67200586866d6c673718b230/map_model/src/pathfind/v1.rs#L401) 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

Beitragsleitfaden

Für dieses Repository ist kein Beitragsleitfaden indexiert

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.