refactor: split complex junction stages

This commit is contained in:
que01 committed 2026-09-16 17:45:57 +08:00
1 parent 1679d1bfc1
commit 55888e8d91
8 files changed
+1644 -1121

No files matched your search

@@ -54,3 +54,25 @@ Wrong: move a stripe until it touches an arc at one point and declare success
because overlap area is zero. Correct: share the complete crossing short-edge
segment with the island boundary, then derive the green polygon from those
same endpoints and verify non-contact curves separately.
## Generator stage ordering
`src/compile/complex-junction.js` keeps `buildComplexJunctionGeometry` as the
orchestrator. Its private stages own approach selection/stop lines, arm crossing
layout, corner composition, crossing displacement, pavement assembly and
publication. Keep the existing local solvers in their geometry modules.
- `buildArmCrossings` writes the arm's `crosswalkFrame`, `crosswalkRadius` and
evidence before `buildCornerCompositions` consumes them.
- Corner contact solutions collect both endpoint offsets for each shared arm.
Call `applyCrossingDisplacements` once after all corners, before pavement
assembly. It updates stripes, stop lines and the full swept crossing regions;
moving only the visible stripes leaves pavement gaps.
- Preserve the current failure dependency during structural refactors: a failed
corner contact solve also skips that corner's sidewalk. Changing this is a
behavior change requiring a dedicated regression, not a helper extraction.
- Core `approach_headings` uses `arm.representative.heading`, not `arm.heading`:
the representative heading and grouped arm heading can differ.
- Validate refactors against complete generator results, including feature
order, metadata and diagnostics. Run `test/junction-island-offset.js` explicitly
alongside `npm test`; it covers the shared-endpoint displacement path.