mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-11-02 23:16:22 +01:00
fix(editor): a stretch traced is two curves only where both turn and fit between the straights at radii short of the ends of the ones tried, not a long one with a kink; the line of a stretch sampled every 4 m at most while it's fitted, the fit some times quicker
This commit is contained in:
@@ -2987,7 +2987,14 @@ trace_stretch fit_trace_stretch(design const &Base, std::vector<glm::dvec2> cons
|
|||||||
{
|
{
|
||||||
for (auto &curve : two.vertices)
|
for (auto &curve : two.vertices)
|
||||||
plain_curve(curve, std::max(kTraceRadiusMin, std::round(curve.radius)), std::round(curve.transition_in), speed, two.norms);
|
plain_curve(curve, std::max(kTraceRadiusMin, std::round(curve.radius)), std::round(curve.transition_in), speed, two.norms);
|
||||||
take(stretch_of(two, Points));
|
// none where a curve ran to the end of the radii tried, turns hardly at all, or doesn't fit between the straights: the
|
||||||
|
// points made the fit find two curves where they show one
|
||||||
|
auto const laid{compute(two)};
|
||||||
|
auto const sound{laid.valid && laid.radius_warnings.empty() && laid.curves.size() == 2 && std::all_of(laid.curves.begin(), laid.curves.end(), [](curve_report const &Curve) {
|
||||||
|
return Curve.radius > 1.05 * kTraceRadiusMin && Curve.radius < 0.95 * kTraceRadiusMax && Curve.deflection > 0.25 * kPi / 180.0;
|
||||||
|
})};
|
||||||
|
if (sound)
|
||||||
|
take(stretch_of(two, Points));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return chosen;
|
return chosen;
|
||||||
|
|||||||
Reference in New Issue
Block a user