Page 1 of 1

Rail Position in Blueprints

Posted: Fri Dec 01, 2023 8:48 pm
by chibbi
Short Description
I am parsing factorio blueprints containing a section of a rail system. These rails are supposed to be parsed into another format by their position.
The positions of entities are not right. Some blueprints have a axis inverted. This does not happen with every possible blueprint and it is not always the same axis.
Does someone have helpful links or a good explanation about how i should understand the positions of single rail entities?

What i have already done
I can successfully parse and generate blueprints and blueprint books.
I can generate and parse a variable length of rails straight up (direction: None or 4) or straight to the right (direction: 2 or 6).
These will not show me if i have understood the position in the slightest, because a axis-parallel line works no matter if it gets inverted in y or x axis.
I can parse arbitrary blueprints and put the positions of every object onto a coord system with matplotlib.

Detail explanation of the problem
With Matplotlib (or looking at the individual positions) it becomes clear that on every blueprint has at least one axis is inverted. It is mostly the X-Axis but also sometimes the Y-Axis. When i encode the json object back to a blueprint string and reimport it to factorio it is not inverted in any way.
Because the Inversion is not always on the same Axis, i don't know what could cause this (i mean i have ideas, but was not able to confirm any).
I am fairly sure that it is not a problem with my parsing, because by parsing there cant only be a problem with the x or y value of every entity.
Example for an inverted blueprint which does not contain rails:
inverted_chest_blueprint.png
inverted_chest_blueprint.png (452.17 KiB) Viewed 348 times
Example for inverted blueprint with rails:
inverted_rail_blueprint.png
inverted_rail_blueprint.png (305.03 KiB) Viewed 348 times
Inverted on y axis:
inverted_on_y.png
inverted_on_y.png (489.66 KiB) Viewed 348 times
does someone have an idea what i misunderstand or forgot?

Re: Rail Position in Blueprints

Posted: Fri Dec 01, 2023 9:47 pm
by Qon
When making blueprint strings, positive x is to the right, positive y is down. Your plots have positive y up. So I assume that is your issue. All your plots in your pictures are upside down.

Re: Rail Position in Blueprints

Posted: Fri Dec 01, 2023 11:09 pm
by chibbi
Ahhh, that makes sense.
basically i always have my y axis inverted and sometimes misinterpreted that as having my x axis inverted.