17
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-10-18 16:09:19 +02:00

feat(editor): digitizing reads more of the old tracks: curves of the same hand meeting through their transitions with no straight between are separate vertices, a run turning over 150 degrees is split into vertices at track joints, a curve made of two transitions with no arc is read with the radius at their joint; digitizing tries both transition shapes, then without the minimum arc length when a short curve would lose its transitions; the reason names the track left by how much at any distance

This commit is contained in:
maj00r
2026-10-12 03:45:12 +02:00
parent f5895abfa8
commit 096122bcc3
4 changed files with 74 additions and 6 deletions

View File

@@ -1868,9 +1868,15 @@ bool editor_mode::digitize_chain(editor_track::chain const &Chain, std::string *
double closest{std::numeric_limits<double>::max()};
TTrack *farthest{nullptr};
bool fits{false};
for (auto const shape : {preferred, other})
for (auto const attempt : {0, 1, 2, 3})
{
auto const shape{attempt % 2 == 0 ? preferred : other};
design.shape = shape;
if (attempt == 2)
{
design.norms.arc_min = 0.0;
design.norms.arc_min_factor = 0.0;
}
design.vertices.clear();
for (auto const &entry : editor_track::recognize_line(Chain, m_straights.tolerance, design.norms.gauge, shape))
{
@@ -1905,7 +1911,7 @@ bool editor_mode::digitize_chain(editor_track::chain const &Chain, std::string *
if (false == fits)
{
if (Reason != nullptr)
*Reason = closest < 1000.0 ? format(STR_C("the curves read from the paths leave path %s by %.2f m"), name(farthest).c_str(), closest) : std::string{STR_C("the paths don't make a line of straights, arcs and transition curves")};
*Reason = closest < std::numeric_limits<double>::max() ? format(STR_C("the curves read from the paths leave path %s by %.2f m"), name(farthest).c_str(), closest) : std::string{STR_C("the paths don't make a line of straights, arcs and transition curves")};
return false;
}
auto const &records{alignment_store::records()};