mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-11-02 22:06:21 +01:00
feat(editor): each arc of a compound curve has a cant of its own, set in the Plan by each radius ("Cant of R1 (mm)"...), ramped along the transition curves between the arcs; until it's set, the cant of the curve in proportion to the curvature of the arc, as before, "auto" taking it back to that and "Apply recommended for V" all of them. The transitions between the arcs of the norms follow the cants set; warnings where the cant of an arc exceeds the norms, where the unbalanced acceleration does on any arc, and where a transition curve, at the ends or between the arcs, is shorter than the change of the curvature and of the cant along it needs. The labels of the curves show the cants of the arcs where they differ. Stored with the vertex as "cants", reversed with the curve; a unit test
This commit is contained in:
@@ -47,6 +47,7 @@ bool g_loaded{false};
|
||||
// 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>]... [spirals 1]
|
||||
// spirals: two transition curves with no arc between them, their lengths following from R
|
||||
// [cants <first> <arc>...]: the cants of the radii of a compound curve set one by one, below 0 the cant in proportion to the curvature
|
||||
// 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
|
||||
@@ -139,6 +140,12 @@ void mark(scene::layer_handle const Layer)
|
||||
text += format(" %.3f %.3f %.9f", arc.radius, arc.transition, arc.share);
|
||||
if (vertex.spirals)
|
||||
text += " spirals 1";
|
||||
if (vertex.first_cant >= 0.0 || std::any_of(vertex.arcs.begin(), vertex.arcs.end(), [](alignment::compound_arc const &Arc) { return Arc.cant >= 0.0; }))
|
||||
{
|
||||
text += format(" cants %.1f", vertex.first_cant);
|
||||
for (auto const &arc : vertex.arcs)
|
||||
text += format(" %.1f", arc.cant);
|
||||
}
|
||||
lines.push_back(text);
|
||||
}
|
||||
for (auto const &e : entry.result.elements)
|
||||
@@ -165,15 +172,17 @@ alignment::vertex reversed_vertex(alignment::vertex Vertex)
|
||||
double radius;
|
||||
double share;
|
||||
double transition;
|
||||
double cant;
|
||||
};
|
||||
std::vector<part> parts{{Vertex.radius, Vertex.share, 0.0}};
|
||||
std::vector<part> parts{{Vertex.radius, Vertex.share, 0.0, Vertex.first_cant}};
|
||||
for (auto const &arc : Vertex.arcs)
|
||||
parts.push_back({arc.radius, arc.share, arc.transition});
|
||||
parts.push_back({arc.radius, arc.share, arc.transition, arc.cant});
|
||||
auto const count{parts.size()};
|
||||
Vertex.radius = parts.back().radius;
|
||||
Vertex.share = parts.back().share;
|
||||
Vertex.first_cant = parts.back().cant;
|
||||
for (std::size_t j = 1; j < count; ++j)
|
||||
Vertex.arcs[j - 1] = {parts[count - 1 - j].radius, parts[count - j].transition, parts[count - 1 - j].share};
|
||||
Vertex.arcs[j - 1] = {parts[count - 1 - j].radius, parts[count - j].transition, parts[count - 1 - j].share, parts[count - 1 - j].cant};
|
||||
}
|
||||
return Vertex;
|
||||
}
|
||||
@@ -312,8 +321,17 @@ std::optional<alignment::vertex> read_vertex(std::istringstream &Line, scene::la
|
||||
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);
|
||||
// the cants of the arcs of a compound curve, set one by one: of the first arc and of the ones after it, below 0 in proportion
|
||||
if (word == "cants")
|
||||
{
|
||||
Line >> vertex.first_cant;
|
||||
for (auto &arc : vertex.arcs)
|
||||
Line >> arc.cant;
|
||||
}
|
||||
}
|
||||
position = Context.to_world(position);
|
||||
vertex.position = {position.x, position.z};
|
||||
vertex.reverse_turn = (reverse != 0);
|
||||
|
||||
Reference in New Issue
Block a user