17
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-10-31 08:50:52 +01:00

feat(editor): switch templates by their geometry and a template editor: the diverging track is a chain of straights, arcs and transition curves from the start of the switch, with the pre-blade stretch and the angle of the blade at its tip; own templates are kept in eu07_switch_templates.txt and listed in the switch tool; double switches Rpd and Rpj are laid as two switches joined by the main track and handled as one set by sliding, replacing, flipping, the gizmo and deleting, with drives for both switches; self-test switchtemplates

This commit is contained in:
maj00r
2026-10-14 23:17:30 +02:00
parent ea341af27a
commit 52a289b15b
16 changed files with 2076 additions and 156 deletions

View File

@@ -26,9 +26,9 @@ namespace switch_store
struct record
{
scene::layer_handle layer{null_handle};
std::string kind{"switch"}; // switch, slip, crossing
std::string kind{"switch"}; // switch, slip, crossing, double
std::string name; // the switch, or the base name of a slip or a crossing
std::string type{"Rz"}; // Rz, Rlj, Rld, Rkp, Rkpd, Skrz, - when unknown
std::string type{"Rz"}; // Rz, Rlj, Rld, Rkp, Rkpd, Skrz, Rpd, Rpj, - when unknown
std::string rail{"-"};
double radius{0.0}; // of the diverging track of the straight switch the type is made of
double ratio{0.0}; // n of 1:n
@@ -36,7 +36,7 @@ struct record
double a{0.0};
double b{0.0};
double main_radius{0.0}; // of the main track, signed: + to the right, - to the left, 0 straight
std::vector<std::string> parts; // the switch, the switches of a slip, the paths of a crossing
std::vector<std::string> parts; // the switch, the switches of a slip or of a double switch, the paths of a crossing
glm::dvec3 start{0.0}; // of the first part
glm::dvec2 direction{0.0, 1.0};
// ends of the main and the diverging track of the first part seen from its start: along, across, along, across. it stays the