17
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-10-18 17:19:18 +02:00

Switches: lay the pre-blade lead and the blade, not a tangent arc

A turnout's diverging track does not leave the through track tangentially. It
runs straight along the through track to the blade tip (odcinek przediglicowy),
breaks away there by the blade angle (kąt nagięcia iglicy, beta), runs straight
over the blade to its heel, and only then curves - through alfa - beta, not the
whole crossing angle - to the frog.

Give TurnoutSegment a turn_in: a signed heading break applied before the segment
is laid, which is the only way to express a track leaving by an angle rather than
a tangent. lay_turnout then places the lead, the break and the blade ahead of the
curve and hands the curve the angle that is actually left to spend; a zero blade
length keeps the break and starts the curve at the tip. Reject a blade angle that
is negative or already reaches the crossing angle.

All-zero blade figures lay exactly the old tangent arc from PR, so existing
layouts are untouched. Junction and turnout_preset carry the three new figures
through to the panel; the presets themselves still hold zeros until the Id-1
catalogue numbers are in.

Add test_turnout: the lead sits on the through track, the blade breaks by beta,
and the frog still lands on the full crossing angle and the catalogue length,
mirrored for a right-hand turnout.
This commit is contained in:
maj00r
2026-08-27 19:36:52 +02:00
parent 4ae24114ba
commit 8cd42980e6
10 changed files with 223 additions and 25 deletions

View File

@@ -20,16 +20,17 @@ std::vector<turnout_preset> const &turnout_presets()
// the type tables (metres). the diverging leaves not tangent but at the blade angle (beta) after a
// straight pre-blade lead, then arcs by (alfa - beta) to the frog.
//
// blade_angle and pre_blade are NOT yet from Id-1 - left at 0 (a tangent arc from PR) until the
// catalogue figures are in. Fill them per type when we have them; the geometry already supports it.
// blade_angle, pre_blade and blade_length are NOT yet from Id-1 - left at 0, which lays a tangent
// arc straight from PR. Fill them per type when the catalogue figures are in; the geometry
// (domain::lay_turnout) already lays the pre-blade lead, the blade break and the shortened arc.
static std::vector<turnout_preset> const presets{
{"Rz 1:7,5 R190", 7.5, 190.0, 25.222, 0.0, 0.0},
{"Rz 1:9 R190", 9.0, 190.0, 27.138, 0.0, 0.0},
{"Rz 1:9 R300", 9.0, 300.0, 33.230, 0.0, 0.0},
{"Rz 1:12 R500", 12.0, 500.0, 41.594, 0.0, 0.0},
{"Rz 1:14 R500", 14.0, 500.0, 42.371, 0.0, 0.0},
{"Rz 1:14 R760", 14.0, 760.0, 54.216, 0.0, 0.0},
{"Rz 1:18,5 R1200", 18.5, 1200.0, 64.818, 0.0, 0.0}};
{"Rz 1:7,5 R190", 7.5, 190.0, 25.222, 0.0, 0.0, 0.0},
{"Rz 1:9 R190", 9.0, 190.0, 27.138, 0.0, 0.0, 0.0},
{"Rz 1:9 R300", 9.0, 300.0, 33.230, 0.0, 0.0, 0.0},
{"Rz 1:12 R500", 12.0, 500.0, 41.594, 0.0, 0.0, 0.0},
{"Rz 1:14 R500", 14.0, 500.0, 42.371, 0.0, 0.0, 0.0},
{"Rz 1:14 R760", 14.0, 760.0, 54.216, 0.0, 0.0, 0.0},
{"Rz 1:18,5 R1200", 18.5, 1200.0, 64.818, 0.0, 0.0, 0.0}};
return presets;
}