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

feat(editor): from the end of the diverging track of a switch the line laid always goes on with the curve of the switch: a straight or a bend the other way after P4 begins with the transition out of the curve of the switch, as after a plain track on a curve, never with a jump of the curvature, whether laid through points, traced, dragged in the straight layout or joined to another free end. The transition is the one for the speed the curve of the switch allows with no cant (about 48 km/h at R 300, so 20 to 30 m), not for the speed of the line. A straight with no bend clicked on from such an end runs on the way the transition leaves, as far as the point clicked, not along the tangent at the end, which left no room for the transition. Where no transition fits, as for a straight shorter than it, nothing is laid and the status says why

This commit is contained in:
maj00r
2026-10-25 17:26:26 +01:00
parent 34bd7c853e
commit a0427bb80b
3 changed files with 46 additions and 22 deletions

View File

@@ -680,7 +680,12 @@ editor_track::easing editor_track::ease_out_of(TTrack const &Neighbour, glm::dve
result.curvature = end->curvature;
if (std::abs(end->curvature) < 1e-4)
return result;
result.length = std::max(20.0, alignment::recommend(Speed, 1.0 / std::abs(end->curvature), Limits).transition);
// the diverging track of a switch has no cant: run no faster than its curve lets with the unbalanced acceleration alone, the
// transition out of it is the one for that speed
auto speed{Speed};
if (Neighbour.eType == tt_Switch)
speed = std::min(Speed, std::sqrt(12.96 * Limits.unbalanced / std::abs(end->curvature)));
result.length = std::max(20.0, alignment::recommend(speed, 1.0 / std::abs(end->curvature), Limits).transition);
lay_transition(result, Joint, end->direction, Grade, end->roll);
return result;
}