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

feat(editor): the track laid on the terrain gets its grade line from the profile solver

In place of a line bent every ten metres to keep within 0.1 m of every bump,
the grades and the vertical curves are fitted to the ground the way the
profile fits them. Where the formation is made in the terrain model the line
keeps to the radius of the norms and cuts and fills; over the ground left as
it is it bends as sharply as it has to. The joints keep the height and the
grade of the track joined, no grade is capped and no piece is under 5 m.
This commit is contained in:
maj00r
2026-10-21 13:20:47 +02:00
parent eea0900928
commit d2d06817bc
5 changed files with 120 additions and 48 deletions

View File

@@ -13,6 +13,7 @@ http://mozilla.org/MPL/2.0/.
#include <vector>
#include <glm/glm.hpp>
#include "editor/editorProfile.hpp"
#include "world/Segment.h"
namespace ground_follow
@@ -37,11 +38,18 @@ struct knot_line
double grade1{0.0};
void refresh();
void insert(double const Chainage, double const Height);
double at(double const Chainage, double &Grade) const;
bool room(double const Chainage, double const Spacing) const;
};
void follow(std::vector<segment_data> &Pieces, ends const &Ends, bed_query const &Bed);
// the grade line the track is laid on where there's ground under it: the solver of the grade lines fits it to the ground
struct grading
{
profile::line settings; // the speed and the norms of the line
profile::ground_fit fit; // how closely it keeps to the ground
double reach{100.0}; // m, how far the ground may part from the line and still be followed
};
// where Bed finds no ground, the heights lead from one end to the other
void follow(std::vector<segment_data> &Pieces, ends const &Ends, bed_query const &Bed, grading const &Grading = {});
} // namespace ground_follow