The International Simutrans Forum

Development => Bug Reports => Known bugs and features => Topic started by: kazarmy on November 18, 2019, 02:33:35 PM

Title: [r8849 & r8868] Network graph shows loops incorrectly under some orientations
Post by: kazarmy on November 18, 2019, 02:33:35 PM
----Truck----



----Tram----



The images above show the network graphs for a truck loop and a tram loop. What the red ovals emphasize is that, depending on the map orientation, the entire loop isn't shown correctly.

The screenshots have been done with r8849 but I confirm that this bug happens also with r8868. The pak used is pak64 120.4.1 r1974. Savegame is attached.

The truck loop is the Renfield pass/mail line while the tram loop is the Renfield tram line (the only tram line). The tram loop is the truck loop with the stops visited in reverse.
Title: Re: [r8849 & r8868] Network graph shows loops incorrectly under some orientations
Post by: Mariculous on November 18, 2019, 02:51:37 PM
I did also observe this in the past when setting up replacements, thus a depot is added to the route.
I would not expect the route to the depot to show up on the map, as it is not part of the line but only part of vehicles schedules.

The area marked by the red circle seems to be the same for both, apart from being rotated for sure.
Title: Re: [r8849 & r8868] Network graph shows loops incorrectly under some orientations
Post by: kazarmy on November 18, 2019, 02:57:59 PM
Yes the red circle is the same area, but the point at the tip is not a depot but a station.

PS. I have forgotten that the forum software is not WYSIWYG and that copious usage of the Preview button is needed. But now the original post looks like I want it to look.
Title: Re: [r8849 & r8868] Network graph shows loops incorrectly under some orientations
Post by: kazarmy on November 18, 2019, 03:03:29 PM
The problem is that the base is also a station, but it isn't visited twice in the loop.
Title: Re: [r8849 & r8868] Network graph shows loops incorrectly under some orientations
Post by: Mariculous on November 18, 2019, 06:24:22 PM
Oh well, that edit changes a lot.
I have never seen this but that's for sure due to I'm only playing online so I can't rotate the map at all.

However, for two given points, that do not share the same x or y coordinates, there are exactly two possible ways to connect them with a diagonal and a straight.
Either you go the straight way first and then the diagonal way or you go the diagonal way first and then the straight way.

It seems that this is the cause for the diferent looking map graph
However, both express exactly the same as it is only schematic and does not show the actual vehicles path.
I have visualized this by rotating the second image, changing line color from grey to red and overlaying the first image with it. You can see that the same stations are connected, it just looks a little bit different but it's showing the exact same information in a slightly different way.
I would parse that information as "remove that far-away stop in that point of the schedule and add it in between the two stops in the north, where it is much closer to.
Title: Re: [r8849 & r8868] Network graph shows loops incorrectly under some orientations
Post by: Leartin on November 19, 2019, 05:33:03 AM
I suppose it happens because two stations are aligned diagonally (or horizontally or vertically), so their connection is not shown as straight+diagonal, but just a diagonal.
Title: Re: [r8849 & r8868] Network graph shows loops incorrectly under some orientations
Post by: kazarmy on November 19, 2019, 11:21:04 AM
QuoteEither you go the straight way first and then the diagonal way or you go the diagonal way first and then the straight way.

It seems that this is the cause for the diferent looking map graph


Yes it does appear that the graph algorithm should choose straight first and then diagonal for the red ovals, but I think this should only happen if the diagonal is already in use, so probably the fix isn't as easy as I first thought.

Quote
I would parse that information as "remove that far-away stop in that point of the schedule and add it in between the two stops in the north, where it is much closer to.

The road network unfortunately doesn't allow that  ::(  and I'm not going to blow up any building just for a schematic problem.


PS. I have finally found the joys of the Toggle View button when composing replies.
Title: Re: [r8849 & r8868] Network graph shows loops incorrectly under some orientations
Post by: prissi on November 20, 2019, 02:44:32 PM
The actual algorithm is very simple. Also if the last line was a diagonal, it tries to continue with the same diagonal, since usually this is what one would expect. (Minimizing the corners). However, rotated there is no way to continue with the current direction. It then uses a diagonal, in order to avoid sharp corners (however, this can be improved, a sharp corner would have actually a more gentle curve here).
Title: Re: [r8849 & r8868] Network graph shows loops incorrectly under some orientations
Post by: kazarmy on November 20, 2019, 03:19:10 PM
what is this start_diagonal and why is it set to true? what can happen if last_diagonal is true for both the first and last stop of a loop line?

(sorry no build system in place so can't test anything ... not even sure that I know what I'm talking about)