mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-10-27 18:47:29 +01:00
fix(editor): a compound curve of more than three radii, made of bends clicked close along a curve or traced, has the transition curves of the norms between its arcs too: its radii found with the arcs meeting directly, then fitted again with the transitions between them; in abc the curve keeps within 0.12 m of the points clicked with them
This commit is contained in:
@@ -3181,9 +3181,11 @@ std::optional<trace_stretch> fit_arcs(design const &Single, std::vector<glm::dve
|
||||
else
|
||||
curve.arcs.push_back({radius, 0.0, share});
|
||||
}
|
||||
// arcs meeting with no transitions between them: the points of a curve clicked by hand ask for the radius to change
|
||||
// quicker than the transitions of the norms let it
|
||||
// the radii found with the arcs meeting directly, which follows the points easily, then with the transitions of the norms
|
||||
// between the arcs, fitted again from there
|
||||
fit_compound(shaped, 0, Points, false);
|
||||
recommend_between(shaped.vertices.front(), Single.speed, Single.norms);
|
||||
fit_compound(shaped, 0, Points, true);
|
||||
// none of an arc too short to be one: a kink the points made
|
||||
auto const fitted{compute(shaped)};
|
||||
auto const kinked{std::any_of(fitted.elements.begin(), fitted.elements.end(), [](element const &Element) {
|
||||
|
||||
@@ -286,5 +286,12 @@ TEST_CASE("alignment: bends clicked close along a curve make one compound curve,
|
||||
// the straight before the curve and the one after it
|
||||
CHECK(straights <= 2);
|
||||
CHECK(line.curves.size() <= 2);
|
||||
// the arcs of a compound curve meet through transition curves, the curvature not jumping from one radius to another
|
||||
for (std::size_t i = 0; i + 1 < line.elements.size(); ++i) {
|
||||
auto const &a{line.elements[i]};
|
||||
auto const &b{line.elements[i + 1]};
|
||||
if (a.kind == alignment::element_kind::spiral && b.kind == alignment::element_kind::spiral && a.vertex == b.vertex)
|
||||
CHECK(a.curvature_end == doctest::Approx(b.curvature_start).epsilon(1e-6));
|
||||
}
|
||||
CHECK(design.vertices.size() < 12);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user