17
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-11-02 23:16:22 +01:00

feat(editor): a slip Rkp or Rkpd bent into a curve of a side track: dragged on a curve with a slip armed it's laid out on the tangent to the curve where it was pressed and bent onto the curve as a switch laid into one is, editor_mode::frame_path laying a path of a template into the curve for both, its crossing track coming along with its ends free, ahead to the side of the drag, the slip curve of a single slip on that side, the straights of both tracks out to the joints of its template. A crossing goes only where two straights cross, a curve as sharp as the slip curves is refused. As it's dragged the view tells the radii of its tracks and slip curves, its cant and what switch_curve::check_slip says, the 11.4 pkt 4b of ST-T1-A6 among it; laid, the status the same. A slip bent into a curve isn't replaced by one laid out of straights. Selftests switchcurve, bladetips: a Rkpd 49E1-190-1:9 in R 800 m with its slip curves of R 154 and 249 m and the warnings of 11.4 pkt 4b and table 9.2, one of R 300 m in R 800 m with no warning of table 9.2, a Rkp in R 4000 m, the blades from 1.248 m on all of them; refused in R 150 m, a Skrz refused

This commit is contained in:
maj00r
2026-10-27 19:39:38 +01:00
parent 7f6a8736ca
commit 7b11db566e
6 changed files with 538 additions and 179 deletions

View File

@@ -68,6 +68,20 @@ editor_mode::selftest_result editor_mode::selftest_switch(std::string const &com
text += format(", drive %.3f m from the joint", geometry::plan_distance(found->standing.location, start));
else
text += ", no drive";
// how far apart the rail of the blade and the one it lies at are along the path, where the blades of a slip are shaped
if (track->DoubleSlip())
for (int path = 0; path < 2; ++path)
{
auto const &shape{track->blade(path)};
auto const gap = [&](double const At) {
auto const &gauge{shape.gauge};
auto const next{std::find_if(gauge.begin(), gauge.end(), [&](glm::dvec2 const &Sample) { return Sample.x >= At; })};
return next == gauge.end() ? (gauge.empty() ? -1.0 : gauge.back().y) : next->y;
};
text += format(", path %d %s side %d gaps", path, shape.valid ? "shaped" : "not shaped", track->SwitchExtension->RightSwitch == (path == 0) ? 1 : -1);
for (auto const at : {0.354, 1.0, 1.248, 2.0, 4.0, 6.0, 8.0, 9.4})
text += format(" %.1f:%.4f", at, gap(at));
}
WriteLog(text);
}
return selftest_result::handled;
@@ -575,7 +589,29 @@ editor_mode::selftest_result editor_mode::selftest_switch(std::string const &com
tool.frame_tracks = chain.tracks;
tool.curved = true;
tool.along = nearest_station(tool.frame, point);
insert_curved_switch(direction, side);
tool.pressed = tool.along;
// a slip bent into the curve with its crossing track, its paths and its record logged
if (tool.templates[tool.armed].double_slip)
{
insert_curved_slip(direction, side);
if (auto const *part{selected_track()}; part != nullptr && part->DoubleSlip())
if (auto const known{switch_store::named(*part)})
{
WriteLog(format("SELFTEST switchcurve slip %s: %s, %zu parts", known->name.c_str(), switch_store::label(*known).c_str(), known->parts.size()));
for (auto const &name : known->parts)
if (auto const *track{simulation::Paths.find(name)})
for (std::size_t i = 0; i < track->m_paths.size(); ++i)
{
auto const &path{track->m_paths[i]};
auto const &a{path.points[segment_data::point::start]};
auto const &b{path.points[segment_data::point::end]};
WriteLog(format("SELFTEST switchcurve slip path %s/%zu: %.3f %.3f %.3f -> %.3f %.3f %.3f, R %.1f, %zu pieces, rolls %.2f %.2f", name.c_str(), i, a.x, a.y, a.z, b.x, b.y, b.z, static_cast<double>(path.radius), path.pieces.size(),
static_cast<double>(path.rolls[0]), static_cast<double>(path.rolls[1])));
}
}
}
else
insert_curved_switch(direction, side);
}
else
{