mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-10-19 08:29:18 +02:00
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.
38 lines
1.4 KiB
C++
38 lines
1.4 KiB
C++
/*
|
|
This Source Code Form is subject to the
|
|
terms of the Mozilla Public License, v.
|
|
2.0. If a copy of the MPL was not
|
|
distributed with this file, You can
|
|
obtain one at
|
|
http://mozilla.org/MPL/2.0/.
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <string>
|
|
#include <vector>
|
|
|
|
namespace editor
|
|
{
|
|
|
|
// a standard turnout template: its designation and the defining pair a catalogue entry is built on -
|
|
// the crossing mark 1:n (skos) and the radius of the diverging arc. the actual length the switch
|
|
// works out to is computed geometrically from these (arc = R * atan(1/n)), shown next to it; the
|
|
// exact catalogue length can be pinned later if the Id-1 tables call for a different figure
|
|
struct turnout_preset
|
|
{
|
|
std::string name;
|
|
double crossing_n; // skos 1:n
|
|
double radius; // metres
|
|
double length; // catalogue length PR->KR along the through track, metres
|
|
double blade_angle; // kąt nagięcia iglicy (beta), radians; the diverging leaves the straight here
|
|
double pre_blade; // odcinek przediglicowy: straight lead PR -> blade tip, metres
|
|
double blade_length; // the straight blade itself, tip -> heel where the arc starts, metres
|
|
};
|
|
|
|
// typical Polish turnouts (rozjazdy zwyczajne). the (skos, R) pairs are the recognised standard;
|
|
// confirm against Id-1 before treating the derived length as the catalogue length
|
|
std::vector<turnout_preset> const &turnout_presets();
|
|
|
|
} // namespace editor
|