fix(task-7): crossings test the exact arc, so a line through a jump's apex counts
flatten_bulges chops a semicircle into an even number of chords (36 for r=50, 12 for r=5), so a flattened vertex lands exactly on the apex — the axis of symmetry, the one place a P&ID line most plausibly meets a crossing jump. segments_cross treats a vertex hit as a junction, so both neighbouring chords dropped it and the arc contributed 0: the (45,0)->(55,0) bulge -1 jump reported crossings 0 at x=50 and 1 at x=50.3 or x=49, the plan's own (0,0)->(100,0) semicircle 0 at x=50, and the mirrored frame (extrusion -Z) 0 at x=-50. count_crossings now takes bulges= (per-chain DXF bulge lists, zero-padded) and tests every bulged edge as its exact arc through the new segment_arc_crossings — circle/segment intersection restricted to the sweep — with the same junction rule as the straight case: a hit within _EPS of the segment's ends, of the arc's own two ends, or a tangent, is not a crossing. Nothing along the sweep is a vertex any more. The arc parametrisation is factored into _arc_of_bulge and shared with flatten_bulges, which keeps its promised signature and its ezdxf pin but no longer feeds the crossing count. draw_line passes the vertices and bulges through unflattened. Pinned in tests: the apex case on the semicircle (x=50, y 20->60), the r=5 jump at x=50 / 50.3 / 49 on +Z and -Z frames, the junction cases (T-touch on the arc, through the arc's endpoint, chord side, tangent along the apex, in-and-out at y=4.9 counts 2), and 4x400 seeded random segment/arc pairs against ezdxf's ConstructionArc.intersect_line (a 20 000-case run in the worktree found 0 mismatches). The eight new assertions fail on the flattened rule and pass on the exact one. Headless finding, headless evidence; no new ActiveX call was written, so the shared live AutoCAD was not touched. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FKFStjEFzpGyLq5bMpWxTd
This commit is contained in:
co-authored by
Claude Opus 5
parent
9cb4bee587
commit
efcc8bbba1
@@ -13,7 +13,6 @@ from .lines import (
|
||||
PID_LINE_LAYERS,
|
||||
aim_points,
|
||||
count_crossings,
|
||||
flatten_bulges,
|
||||
format_line_number,
|
||||
label_placement,
|
||||
marker_positions,
|
||||
@@ -238,7 +237,9 @@ async def draw_line(
|
||||
|
||||
existing = await existing_pid_lines(backend)
|
||||
crossings = count_crossings(
|
||||
path, [flatten_bulges(ln["vertices"], ln["bulges"]) for ln in existing]
|
||||
path,
|
||||
[ln["vertices"] for ln in existing],
|
||||
bulges=[ln["bulges"] for ln in existing],
|
||||
)
|
||||
used: set[tuple[str, str]] = set()
|
||||
max_seq = 0
|
||||
|
||||
Reference in New Issue
Block a user