17
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-11-02 06:59:13 +01:00

fix(editor): a point taken out of a grade line leaves its neighbours with the radius of the limits, and paths meeting at a sharp break keep their own grades

The points of a grade line read from the tracks keep the radius measured there; once a point between them was taken out, the
breaks of its neighbours changed while their radii stayed, so a break without a curve read as 0.4 per mille became one of
9 per mille with no curve, and the tracks took it as a kink. The neighbours of the point taken out follow the limits now,
with the button, Del and the self-test alike (profile_remove_point).

Applying a line with a break without a curve gave the path which ends at the break the grade of the element after it, so
its Hermite heights bowed 0.12 m off the line over 100 m before the break; each path takes the grade on its own side now.

Self-test commands vprofilerun, vprofiledel and vprofileput.
This commit is contained in:
maj00r
2026-10-21 17:25:17 +02:00
parent d2d06817bc
commit e86a536a9d
4 changed files with 78 additions and 10 deletions

View File

@@ -2559,7 +2559,9 @@ std::vector<editor_track::height_gap> editor_track::apply_profile(route &Route,
auto const endchainage{span.forward ? span.to : span.from};
auto const sign{span.forward ? 1.0 : -1.0};
auto &path{span.track->m_paths[span.path]};
set_heights(path, Elevation(startchainage), Elevation(endchainage), Grade(startchainage) * sign, Grade(endchainage) * sign);
// at a break of the grade without a curve each path takes the grade on its own side of it
auto const inward = [&](double const Chainage, double const Other) { return Grade(Chainage + std::min(1e-3, std::abs(Other - Chainage) * 0.5) * (Other > Chainage ? 1.0 : -1.0)); };
set_heights(path, Elevation(startchainage), Elevation(endchainage), inward(startchainage, endchainage) * sign, inward(endchainage, startchainage) * sign);
// the pieces of a path made of several curves follow the grade line along them, else the path would part from them and lose them
std::vector<double> lengths;
double total{0.0};
@@ -2576,7 +2578,7 @@ std::vector<editor_track::height_gap> editor_track::apply_profile(route &Route,
{
auto const first{at(along)};
auto const last{at(along + lengths[k])};
set_heights(path.pieces[k], Elevation(first), Elevation(last), Grade(first) * sign, Grade(last) * sign);
set_heights(path.pieces[k], Elevation(first), Elevation(last), inward(first, last) * sign, inward(last, first) * sign);
along += lengths[k];
}
}