Use cumulative cell index for at-grade rail sleeper spacing#1016
Conversation
generate_at_grade_rail keyed sleeper placement off bx % 4, which depends on world X. North-south tracks (constant bx) ended up either all sleepers or none, and east-west tracks at a different starting X had a phase shift relative to bridge tracks. Track a cumulative index (tds) across segments so spacing is orientation-independent and matches the generate_rail_bridge convention. skip_first = 1 on segments after the first so a shared OSM-node join isn't double-counted (which would shift the sleeper phase by one cell at every node).
|
⏱️ Benchmark run finished in 0m 55s 📈 Compared against baseline: 27s time, 935 MB memory 🟢 Generation time is unchanged. 📅 Last benchmark: 2026-05-07 18:42:35 UTC You can retrigger the benchmark by commenting |
There was a problem hiding this comment.
Pull request overview
Updates at-grade rail generation so sleeper placement is based on a cumulative per-cell index along the track centerline (across OSM node segments), eliminating orientation/world-X dependency and aligning spacing behavior with rail-bridge generation.
Changes:
- Track a cumulative cell index (
tds) across segments and place sleepers every 4 cells using that index. - Avoid double-counting the shared cell at OSM-node joins by skipping the first point of subsequent segments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
generate_at_grade_rail keyed sleeper placement off bx % 4, which depends on world X. North-south tracks (constant bx) ended up either all sleepers or none, and east-west tracks at a different starting X had a phase shift relative to bridge tracks. Track a cumulative index (tds) across segments so spacing is orientation-independent and matches the generate_rail_bridge convention.
skip_first = 1 on segments after the first so a shared OSM-node join isn't double-counted (which would shift the sleeper phase by one cell at every node).