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

feat(track): at a crossing at a wide angle each guard rail is glued to its running rail by a filler block between their webs along its whole length, so the flangeways and the gaps cut for the wheels of the other track have a floor instead of showing the ballast; the filler of the track not going through lies a millimetre lower where both overlap

This commit is contained in:
maj00r
2026-10-14 02:16:52 +02:00
parent 3a43871f42
commit a0958cd44e
2 changed files with 26 additions and 0 deletions

View File

@@ -383,6 +383,7 @@ public:
bool flareto { true };
glm::dvec2 frommiter { 0.0 };
glm::dvec2 tomiter { 0.0 };
bool through { true };
};
struct rail_band {
double at { 0.0 };

View File

@@ -1049,6 +1049,22 @@ void wide( TTrack::rail_plan &Plan, double const At, double const Into, double c
Plan.cuts.push_back( cut );
}
TTrack::rail_fill guard_fill( TTrack::guard_rail const &Guard, TTrack::rail_size const &Size ) {
auto const offset { Size.web - ( flangeway + Size.head ) };
auto const flare { std::min( 0.3, 0.25 * ( Guard.to - Guard.from ) ) };
TTrack::rail_fill fill;
fill.web = true;
fill.from = Guard.from;
fill.to = Guard.to;
fill.capfrom = true;
fill.capto = true;
fill.lift = ( Guard.through ? 0.0 : -0.001 );
fill.inner = { { Guard.from, offset - ( Guard.flarefrom ? 0.02 : 0.0 ) }, { Guard.from + flare, offset }, { Guard.to - flare, offset }, { Guard.to, offset - ( Guard.flareto ? 0.02 : 0.0 ) } };
fill.outer = { { Guard.from, Size.web }, { Guard.to, Size.web } };
return fill;
}
bool goes_through( TTrack const &Track, TTrack const &Other ) {
if( Track.name() != Other.name() ) {
@@ -1344,6 +1360,7 @@ TTrack::rail_layout TTrack::plan_rails( bool const Crossings ) {
auto const reach { ( flangeway + railhead + 0.3 ) / std::abs( crossing.into ) };
auto &spans { guards[ crossing.path ][ crossing.side > 0 ] };
TTrack::guard_rail guard { crossing.at - reach, crossing.at + reach };
guard.through = through;
wide( guard.plan, crossing.at, crossing.into, crossing.facing, -other.head, through ? flangeway : flangeway + other.head, guardoffset, guardoffset + railhead );
auto merged { false };
for( auto &span : spans ) {
@@ -1351,6 +1368,7 @@ TTrack::rail_layout TTrack::plan_rails( bool const Crossings ) {
span.from = std::min( span.from, guard.from );
span.to = std::max( span.to, guard.to );
span.plan.cuts.insert( span.plan.cuts.end(), guard.plan.cuts.begin(), guard.plan.cuts.end() );
span.through = ( span.through && guard.through );
merged = true;
break;
}
@@ -1394,6 +1412,13 @@ TTrack::rail_layout TTrack::plan_rails( bool const Crossings ) {
}
}
}
for( int path = 0; path < 2; ++path ) {
for( int side = 0; side < 2; ++side ) {
for( auto const &guard : guards[ path ][ side ] ) {
layout.fills[ path ][ side ].push_back( guard_fill( guard, size ) );
}
}
}
std::sort( corners.begin(), corners.end(), []( frame_corner const &A, frame_corner const &B ) { return A.at < B.at; } );
auto const glued = [&]( frame_corner const &Corner ) {
return Corner.at + ( flangeway + std::max( guardoffset * Corner.facing, ( guardoffset + railhead ) * Corner.facing ) ) / Corner.into; };