Files

4.5 KiB

Junction island contact

Status and scope

Confirmed user requirement, 2026-09-11; implementation pending. Applies to the complex-junction composition with two adjacent arm crossings and one crossing beside the inward-curved hypotenuse. This is not a universal traffic-island definition. Simple junction behavior is unchanged.

Geometry contract

  • A contact is the complete short edge of a crossing rectangle, not an arbitrary white stripe, a point, or only the portion that happens to intersect the island.
  • Each of the three crossings contributes one contact segment and two endpoints. All three complete segments must be shared with the island outer boundary.
  • Contact positions are geometry-dependent. The two perpendicular leg lengths are solved from the contacts and available space; twice crossing depth is not a hard constraint.
  • Preserve six distinct contact endpoints in boundary order. Connecting them forms the green hexagon on the island. Its three contact edges coincide with the crossing contacts; its other three edges connect adjacent contacts. The green region and rounded island outer boundary are distinct geometries.
  • Rounded corners and inward curves occupy non-contact boundary portions. A straight contact edge must remain straight over its full length, including the hypotenuse-side landing. Rounding must not trim away contact endpoints.
  • Solve in local metric coordinates and reuse coordinates across consumers. Preserve consistent stripe dimensions and spacing, avoid positive-area crossing/island intersection, and maintain stop-line separation.
  • If the available space cannot satisfy the composition, report the object and failed constraint. Do not shorten a crossing, detach it, or report the partial composition as valid.

Required validation

For each complete contact segment S and published island boundary B, measure the length of S covered by B, not polygon intersection area alone. Require uncovered length and endpoint-to-boundary distance <= 0.01 m; this tolerance is numerical, not a design gap. Also check interior samples to catch an arc touching only at the endpoints.

The six green vertices must equal the six contact endpoints within metric tolerance, with each used once; the ring must be simple, have positive area, lie inside the outer island, and retain all three full contact edges. An independently fitted polygon or a hull dropping vertices fails this contract.

Required cases: orthogonal base case; unequal contact offsets and crossing depths; translated/rotated equivalents; changed available space; roundovers that would cut into contacts; and an infeasible composition. On the current real OSM, verify all contacts and all six vertices for every published island, not just feature counts or a hand-picked corner. Retain image evidence showing the outer boundary, green hexagon, complete crossing rectangles and stop lines.

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.