17
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-10-17 20:19:20 +02:00
Files
maszyna/editor/turnouts.h
maj00r 707b4de2f4 Editor checkpoint: turnout domain service, web->editor rename, Id-1 templates
Checkpoint of the editor branch so work isn't carried loose across a branch
switch. Builds.

- maj0sted turnout geometry moved into the domain: domain::lay_turnout lays the
  diverging path (pre-blade lead, blade at beta, arc of alfa-beta, frog rail) and
  solve_junction is a thin adapter onto it.
- the maj0sted web/ tree renamed to editor/ (namespace and paths) - there is no
  WASM here, it's plain native C++ the editor calls.
- click places the switch at its start (początek rozjazdu); the branch's leaving
  straight is locked tangent to the frog; switches can be slid along the through
  track and flipped L/P.
- Polish turnout templates carry catalogue length (Id-1-consistent lengths), plus
  blade-angle and pre-blade fields (left 0 until the catalogue figures are in).
- TURNOUT_SPEC.md: the Bezier-based runtime/model contract.
- also folds in other pending branch changes (scenery, tests) to leave a clean tree.
2026-08-27 19:36:55 +02:00

37 lines
1.3 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
};
// 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