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

feat(editor): the curves of the laying from the photo in the design of the lines: a vertex of two transition curves meeting at its radius, with no arc and no cant, kept in the scenery files; the bends of straights eased with them at a radius from 6000 down to 3000 m, or larger where they'd be too short for the speed, else with an arc of the norms as large as fits, the straights between two bends shared, the bends staying where they were clicked and a curve below the norms kept with its warnings; a stretch traced on the photo fitted with a straight, a curve with its radius and the length of its transitions, a compound one, or two curves with a straight between them, on a thread of its own while the cursor moves; the heights from point to point through all the points clicked. Unit tests of the design of the lines

This commit is contained in:
maj00r
2026-10-24 20:57:59 +02:00
parent 9855de74b4
commit 500f068297
8 changed files with 1102 additions and 22 deletions

View File

@@ -45,7 +45,8 @@ bool g_loaded{false};
// ends <start direction x z> <end direction x z> <start grade> <end grade> <start R> <end R>
// norms <gauge> <unbalanced> <cant max> <cant rate> <ramp factor> <jerk> <straight between curves, s> <arc min> <arc min factor>
// pieces <pieces of a transition> <angle of an arc piece>
// vertex <x> <z> <offset> <R> <L in> <L out> <cant> <reverse 0/1> <compound 0/1> <share> <arcs> [<R> <L> <share>]...
// vertex <x> <z> <offset> <R> <L in> <L out> <cant> <reverse 0/1> <compound 0/1> <share> <arcs> [<R> <L> <share>]... [spirals 1]
// spirals: two transition curves with no arc between them, their lengths following from R
// element <straight|transition|arc> <vertex> <chainage> <length> <R at the start> <R at the end> <cant> <start x> <start z> <direction x> <direction z>
// radii signed with the turn, 0 for no curvature
// end
@@ -136,6 +137,8 @@ void mark(scene::layer_handle const Layer)
vertex.share, vertex.arcs.size())};
for (auto const &arc : vertex.arcs)
text += format(" %.3f %.3f %.9f", arc.radius, arc.transition, arc.share);
if (vertex.spirals)
text += " spirals 1";
lines.push_back(text);
}
for (auto const &e : entry.result.elements)
@@ -307,6 +310,10 @@ std::optional<alignment::vertex> read_vertex(std::istringstream &Line, scene::la
}
if (Line.fail())
return std::nullopt;
// written since the bends of the straights are eased with two transition curves, the lines of before end with the arcs
for (std::string word; Line >> word;)
if (int value{0}; word == "spirals" && Line >> value)
vertex.spirals = (value != 0);
position = Context.to_world(position);
vertex.position = {position.x, position.z};
vertex.reverse_turn = (reverse != 0);