From 2626c8c86b73ee381b36be6065f9027969078455 Mon Sep 17 00:00:00 2001 From: maj00r Date: Thu, 8 Oct 2026 01:48:41 +0200 Subject: [PATCH] fix(editor): platform edge by the points of a switch keeps the setback of the diverging path, the sample at the points counted with the line leading into the switch --- application/editormodeselftest.cpp | 15 +++++++++++++++ world/Sweep.cpp | 4 ++-- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/application/editormodeselftest.cpp b/application/editormodeselftest.cpp index c25d6726..b84287c2 100644 --- a/application/editormodeselftest.cpp +++ b/application/editormodeselftest.cpp @@ -335,6 +335,21 @@ void editor_mode::selftest_step() } WriteLog("SELFTEST conecheck " + name + ":" + text); } + else if (command == "frames") + { + std::string name; + double from{0.0}, to{0.0}, step{0.1}; + words >> name >> from >> to >> step; + auto *sweep{simulation::Sweeps.find(name)}; + if (sweep == nullptr) + continue; + auto const side{sweep->definition().lateral >= 0.0 ? 1 : 0}; + for (double station = from; station <= to + 1e-9; station += step) + { + auto const at{sweep->frame_at(station)}; + WriteLog(format("SELFTEST frame %s %.2f: %.3f %.3f %.3f widening %.4f cant %.4f setback %.4f", name.c_str(), station, at.position.x, at.position.y, at.position.z, at.widening[side], at.cant[side], sweep->setback(at))); + } + } else if (command == "fouling") { std::map values; diff --git a/world/Sweep.cpp b/world/Sweep.cpp index 42dd07c0..cac36036 100644 --- a/world/Sweep.cpp +++ b/world/Sweep.cpp @@ -611,7 +611,7 @@ void sweep_node::beside_switches(std::vector &Samples) if (heading > 0.0) { for (auto const &sample : Samples) - if (sample.station >= s0 - outer_reach && sample.station < s0 - 1e-3) + if (sample.station >= s0 - outer_reach && sample.station <= s0 + 1e-3) { station = sample.station; chain.push_back(sample); @@ -650,7 +650,7 @@ void sweep_node::beside_switches(std::vector &Samples) nearest = &point; } } - if (nearest == nullptr || closest > sample_spacing) + if (nearest == nullptr || closest > 1.5 * sample_spacing) continue; auto const offset{sign * glm::dot(glm::dvec3{nearest->position.x - here.position.x, 0.0, nearest->position.z - here.position.z}, glm::dvec3{-forward.z, 0.0, forward.x})}; if (offset > 0.05)