17
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-10-29 19:47:30 +01:00

feat(track): 3D sleepers and switch timbers, blade heel and throw from templates, one rail carving pass

- sleepers3d / sleepers3dplain / sleepers3dbed in eu07.ini: timbers put together from the begin, main and end parts of a model
  and stretched to their length, plain sleepers of their own model; tracks whose plain sleepers would touch are laid as one
  cluster, lines of timbers led by priority and turned to the bisectors of frogs and crossings at a limited rate, whole timbers
  under crossings, split ones between tracks with room to part them, gaps filled per rail and overlaps shortened or dropped;
  clusters worked out in a background thread while driving, on demand in the editor
- the ballast can be left out under the beams (sleepers3dbed no)
- blades get their heel and throw from the switch template or blades <heel> <throw> in the scenery; blades of double switches
  run on into the track linking them to the next switch
- rail cutting at frogs, wing rails, movable noses and switch crossings done by one carving pass (RailCarve)
- tint of the rail treads applied to the colour only, without the matte band at the frog
- a switch trailed through with a movable nose set the other way derails the vehicle
- self-tests: sleepercheck, sharedzones, beamsnear, throw, sleepersbg
This commit is contained in:
maj00r
2026-10-17 23:28:36 +02:00
parent 21eca4d9a6
commit d25f20a56c
49 changed files with 9802 additions and 848 deletions

View File

@@ -15,8 +15,9 @@ http://mozilla.org/MPL/2.0/.
#include "world/Segment.h"
// switches described by their geometry, of the catalogue and made by the user in the template editor: the main track is a
// straight, the diverging track a chain of parts of linearly changing curvature from the start of the switch; a double switch
// (Rpd to both sides, Rpj to one side) is two switches, the second starting on the main track of the first
// straight, the diverging track a chain of parts of linearly changing curvature from the start of the switch; a symmetric
// switch (Rls) has both tracks turning by the same parts to both sides; a double switch (Rpd to both sides, Rpj to one side)
// is two switches, the second starting on the main track of the first
namespace switch_design
{
@@ -30,23 +31,29 @@ struct part
struct design
{
std::string name;
std::string type{"Rz"}; // Rz, Rpd, Rpj
std::string type{"Rz"}; // Rz, Rls, Rpd, Rpj
std::string rail{"-"};
double main{0.0}; // length of the main track, 0: as far as the diverging tracks reach
std::vector<part> parts;
double lead{0.0}; // the pre-blade stretch: the diverging track runs along the main one up to the tip of the blade
double entry{0.0}; // degrees, the angle of the blade to the stock rail at its tip, 0: the diverging track leaves tangentially
double tip{0.0};
double heel{0.0}; // where the moving blades end, from the start of the switch, 0: as long as the flangeway behind them needs
double bladethrow{0.0}; // how far the tips of the blades move over, 0: the usual 160 mm
double stagger{0.0}; // of a double switch: where its second switch starts on the main track
std::vector<part> parts2; // of the second switch, empty: the same as the first
double lead2{-1.0}; // of the second switch, negative: the same as the first
double entry2{-1.0};
double tip2{-1.0};
double a{0.0}; // as the catalogue gives them, 0: from the geometry
double b{0.0};
std::string note; // shown after the name on the list
bool own{false}; // made in the template editor, kept in the file of the user
bool movable{false}; // the frog with a movable nose
};
bool double_switch(std::string const &Type);
bool symmetric_switch(std::string const &Type);
// diverging track of the chain of parts from the start, with the first direction along +z and turning to +x
struct path
@@ -55,7 +62,13 @@ struct path
double angle{0.0}; // at the end, radians
double radius{0.0}; // the sharpest
};
path diverging(std::vector<part> const &Parts, double Lead = 0.0, double Entry = 0.0);
path diverging(std::vector<part> const &Parts, double Lead = 0.0, double Entry = 0.0, double Tip = 0.0);
double blade_tip(std::vector<part> const &Parts, double Lead, double Entry, double Tip, bool Symmetric);
// the tip of a blade with a cut tip from the start of its curve, as the tables of the rail give it, 0: none for the radius
double cut_tip(std::string const &Rail, double Radius);
// the pre-blade stretch and the angle in radians of blades cutting into the stock rails, as the ordinary switch of the catalogue
// with the same rail, radius and ratio has them; 0 and 0 for blades tangent to them
std::pair<double, double> secant_blade(std::string const &Rail, double Radius, double Ratio);
// the paths of the switch in its own space: the main and the diverging track of the first switch, then of the second one of a
// double switch and the plain track joining the two; empty with the reason in Error when the design can't make a switch