From bd27ee31d027d977650a5694741742989c585770 Mon Sep 17 00:00:00 2001 From: Hakan Seven Date: Tue, 21 Jul 2026 22:45:28 +0300 Subject: [PATCH] fix(trim): arc-arc intersections tested against wrong circle (#370) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit cc_angles returns angles on the TARGET circle, but the arc-boundary arm of arc_seg_ts filtered them against the BOUNDARY arc's angular span — wrong circle, so arc×arc (and circle×arc, EXTEND-to-arc, bulge-polyline segment) intersections were dropped and TRIM neither highlighted nor cut. Re-express the intersection point as an angle on the boundary circle before the span test, matching line_seg_ts/ellipse_seg_ts. Co-Authored-By: Claude Fable 5 --- src/modules/draw/modify/trim.rs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/modules/draw/modify/trim.rs b/src/modules/draw/modify/trim.rs index 8575e550e..dcc12760f 100644 --- a/src/modules/draw/modify/trim.rs +++ b/src/modules/draw/modify/trim.rs @@ -543,7 +543,14 @@ fn arc_seg_ts( } cc_angles(cx, cy, r, *cx2, *cy2, *r2) .into_iter() - .filter(|&a| in_arc(a, *a02, *a12)) + .filter(|&a| { + // `a` lies on the TARGET circle — re-express the + // intersection point as an angle on the BOUNDARY + // circle before testing that arc's span (#370). + let px = cx + r * a.cos(); + let py = cy + r * a.sin(); + in_arc((py - cy2).atan2(px - cx2), *a02, *a12) + }) .collect() } Geo::Circle {