From eea0900928583406174683d5b21a73e8fa1d2181 Mon Sep 17 00:00:00 2001 From: maj00r Date: Wed, 21 Oct 2026 13:20:47 +0200 Subject: [PATCH] fix(editor): an arc and a straight laid to a point on the circle of the radius aren't refused --- editor/editorTrackShape.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/editor/editorTrackShape.cpp b/editor/editorTrackShape.cpp index 9767a2d7..ff0a2e01 100644 --- a/editor/editorTrackShape.cpp +++ b/editor/editorTrackShape.cpp @@ -81,15 +81,17 @@ std::vector arc_then_straight(glm::dvec3 const &Point, glm::dvec2 turn += 2.0 * glm::pi(); auto const heading{turned(Direction, Side * turn)}; auto const remaining{glm::dot(plan_of(Target) - centre - radial, heading)}; - if (remaining > 0.0 && (rest < 0.0 || turn < angle)) + if (remaining > -1e-3 && (rest < 0.0 || turn < angle)) { - rest = remaining; + rest = std::max(0.0, remaining); angle = turn; } } if (rest < 0.0 || angle > glm::pi()) return {}; auto pieces{arc_pieces(Point, Direction, Grade, Radius, angle, Side)}; + if (rest < 0.01) + return pieces; auto const tail{straight_piece(pieces.back().points[segment_data::point::end], turned(Direction, Side * angle), Grade, rest)}; pieces.insert(pieces.end(), tail.begin(), tail.end()); return pieces;