Skip to content

Step a short near-straight wall join instead of rejecting its wall graph (WOR-865) - #417

Merged
kcjonson merged 5 commits into
mainfrom
fix/WOR-865-short-near-straight-joins
Nov 15, 2026
Merged

kcjonson merged 5 commits into
mainfrom
fix/WOR-865-short-near-straight-joins

Conversation

@kcjonson

Copy link
Copy Markdown
Owner

WOR-865. A short wall joining a wall of another thickness a few degrees off straight was rejected by the wall offsetter, and its whole connected wall graph with it: the graph drew as bare centrelines, and in navigation every wall in the colony lost its corner junctions.

Why

A near-straight join of two thicknesses is drawn as a step; further from straight it is a miter. Just past the switch, the miter trims both walls by about the apex distance, which is longer than a short wall, so resolveWallBands failed with TrimOverrunsSegment. Measured on main with 500 mm walls (the minimum length): Light to Heavy rejected from 7.3 to 8.8 degrees off straight, Standard to Heavy from 4.8 to 5.9. The property tests all used 2000 mm arms, so none of it was covered.

What changes

resolveWallBands resolves exactly as before. Only when a band fails does it go on: it flags every failed band, then resolves the junctions at those bands' ends once more, drawing a wide wedge as a step when its miter would take at least half of either of its walls (both wedges of a two-wall join). Anything that still fails is rejected as before. resolveJunction on its own is unchanged.

The invariant

Every input main accepts produces identical output: bands, junction polygons, trims, pieces, and outline.

  • WallProperties.NearStraightRetryKeepsEveryAcceptedJoin runs 159,520 inputs (2000 and 500 mm arms, every preset pairing: two-wall joins every 0.1 degrees, bent T junctions, random stars of 3 to 6 arms, short-plus-long runs, chains with short middles, Z chains) through the new code and through a copy of main's resolution and drawing functions kept in the test file. All 155,909 inputs main accepts are identical, compared as integers. 3,216 are rescued; 395 are still rejected.
  • An independent reviewer built main's file and this branch's file as two programs outside the repo and compared them on 2,301 further inputs the sweep lacks (closed rooms with one short bent side, T junctions on splits, chains of short walls, junctions of degree 4 and 5): all 2,198 that main accepts are identical, 102 rescued, and reordering or reversing the walls changes nothing over 9,204 permutations.
  • Junction.ShortMiddleSegmentBetweenSharpCornersRejectsOverrun, a real overrun, still rejects.

Rescued shapes

Rescued inputs pass the existing tiling, piece, outline, and order checks, with one exception the test states and bounds: 18 of the 3,216 (a half-thickness 100 wall into a 150 wall about 3 degrees off straight, with a 75 stem) fail the seam check by a fraction of a millimetre (3.6 mm against a tolerance of 3). They are identical to what main itself draws when it steps that wedge for longer walls; the flaw is main's own and is tracked as WOR-877. The test accepts a failing rescued input only on that exact match, caps such inputs at 1 in 100 of the rescued, and bounds overlap on every rescued input at 5 mm (worst found: 4.0 mm).

How checked

  • Tests: geometry-tests 491 passed, sim-tests 1150 passed, world-sim-tests 50 passed, each whole. New: WallProperties.ShortNearStraightJoinsResolve (1,638 inputs; fails on main with 99 rejections) and NearStraightRetryKeepsEveryAcceptedJoin (about 3.8 s). The pieces comparison was seen to fail with the new drawing function broken; the two bounds were seen to fail when tightened.
  • Not run in the game: this is geometry behind the wall renderer and nav, covered by the sweeps.

Perf: what could move is a construction edit, which re-resolves wall graphs in the render cache and in navigation. An accepted graph does the work it did before, plus keeping each junction's resolution until the graph is assembled and one byte per segment. A graph with a failed band costs at most about one more resolve. Nothing was timed: builds were running on the machine throughout.

Known, filed as WOR-877

  • Door placement (PR 411) reads corner trims from resolveJunction, which still returns the long miter trims for a rescued join, so once both are on main a door is refused on such a wall although the drawn wall has room. It errs toward refusing.
  • Just past the rescued range a 500 mm wall is still main's miter: nearly all corner piece, with a band 1 to 2 mm long. Unchanged here, because changing it changes shapes main accepts.
  • Main's few-millimetre overlap where a stem meets a stepped through-run.
  • Two short Heavy walls at a 30 to 33 degree corner are legal to place and still rejected.

… rejecting the graph (WOR-865)

Just inside the step cut a near-straight miter trims about as far as the
miter bound, longer than a 500 mm wall: Light into Heavy 7.3 to 8.8
degrees off straight and Standard into Heavy 4.8 to 5.9 were rejected,
along with every other wall in the graph. Where a band fails,
resolveWallBands now resolves each junction at its ends once more with a
step in place of the miters beside it that alone take half a band (both
wedges of a degree-2 join), and rejects only what still fails. A graph
whose bands all succeed takes the same path as before; a sweep checks
every input the old resolution accepted comes out bit for bit the same.
@kcjonson
kcjonson marked this pull request as ready for review November 15, 2026 06:40
Copilot AI balanced review requested due to automatic review settings November 15, 2026 06:40

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

@kcjonson
kcjonson merged commit ae0f971 into main Nov 15, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants