From f27ed682c0400d5a8bfb995843ef2c0a242917e2 Mon Sep 17 00:00:00 2001 From: maj00r Date: Wed, 14 Oct 2026 10:53:28 +0200 Subject: [PATCH] feat(track): the guard rails of a crossing at a wide angle reach a metre past the rails of the other track instead of 0.3 m and open their flangeway over 0.6 m at the ends, the way the guard arms of the corners of a diamond run out on real crossings, the reach and the flare are the constants guard_reach and guard_flare shared by the plan and the layer --- world/RailLayer.cpp | 2 +- world/RailLayout.h | 2 ++ world/RailPlan.cpp | 4 ++-- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/world/RailLayer.cpp b/world/RailLayer.cpp index 6aec8a62..9c3f2bbb 100644 --- a/world/RailLayer.cpp +++ b/world/RailLayer.cpp @@ -563,7 +563,7 @@ void TTrack::rail_layer::lay_guards() { auto const outside { Miter.x + Miter.y * ( top + m_guardoffset ) }; return Latest ? std::max( inside, outside ) : std::min( inside, outside ); }; for( auto const &guard : ours( m_layout.guards ) ) { - auto const offsets { flared( guard.from, guard.to, std::min( 0.3, 0.25 * ( guard.to - guard.from ) ), m_guardoffset, guard.flarefrom ? 0.02 : 0.0, guard.flareto ? 0.02 : 0.0 ) }; + auto const offsets { flared( guard.from, guard.to, std::min( guard_flare, 0.25 * ( guard.to - guard.from ) ), m_guardoffset, guard.flarefrom ? 0.02 : 0.0, guard.flareto ? 0.02 : 0.0 ) }; auto cuts { guard.plan.cuts }; sort_cuts( cuts ); auto start { guard.from }; diff --git a/world/RailLayout.h b/world/RailLayout.h index b56859c7..25fc56d5 100644 --- a/world/RailLayout.h +++ b/world/RailLayout.h @@ -28,6 +28,8 @@ double constexpr rolled_band { wheel_width - ( 1.435 - back_to_back ) / 2.0 }; double constexpr nose_tip { 0.012 }; double constexpr middle_angle { 0.35 }; double constexpr wide_angle { 0.785 }; +double constexpr guard_reach { 1.0 }; +double constexpr guard_flare { 0.6 }; // where the inner rails of the two paths of a switch cross, found from their gauge lines behind the blades struct switch_frog { diff --git a/world/RailPlan.cpp b/world/RailPlan.cpp index 2bae47c6..313491f4 100644 --- a/world/RailPlan.cpp +++ b/world/RailPlan.cpp @@ -150,7 +150,7 @@ std::vector glue_line( std::vector const &Outline, doubl track_rails::rail_fill guard_fill( track_rails::guard_rail const &Guard, track_rails::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 ) ) }; + auto const flare { std::min( guard_flare, 0.25 * ( Guard.to - Guard.from ) ) }; track_rails::rail_fill fill; fill.web = true; fill.from = Guard.from; @@ -448,7 +448,7 @@ void TTrack::rail_planner::cross_wide( rail_crossing const &Crossing, rail_size if( through ) { add_tread( Crossing.path, Crossing.side, shared_span( Crossing, Other ), *Crossing.track, Crossing.otherpath ); } - auto const reach { ( flangeway + m_size.head + 0.3 ) / std::abs( Crossing.into ) }; + auto const reach { ( flangeway + m_size.head + guard_reach ) / std::abs( Crossing.into ) }; track_rails::guard_rail guard { Crossing.at - reach, Crossing.at + reach }; guard.through = through; wide( guard.plan, Crossing, { -Other.head, through ? flangeway : flangeway + Other.head, m_guardoffset, m_guardoffset + m_size.head, glue_line( Other.field, 0.0 ), through ? knots::line {} : glue_line( Other.gauge, flangeway + Other.head ) } );