engine: sideFloors comment says the corner hangs MAX_HANG + footGap at most and that the level switch steps the bottom where a floor straddles it; test pins 3.7 mm (just inside the switch) still tilting (review)

This commit is contained in:
matthewtrahan authored and Matthew Trahan committed 2026-10-05 07:46:28 -05:00
1 parent d13846d886
commit 6c85238098
2 files changed
+13 -7

No files matched your search

+8 -4
View File
@@ -204,8 +204,12 @@ Deno.test('part foot: at a ledge edge over a step within MAX_DROP the bottom sti
Deno.test('part foot: a floor just past MAX_DROP keeps the capped tilt, its corner just over it', () => {
// 3.25 mm down (MAX_DROP 2.75 + 0.5): a steep slope, not an open edge -- levelled,
// the corner sat 3 mm over it (bore_bracket x30y60's bore)
const r = drawnWall([-30, 0, 35], [30, 0, 35], ledge(5 - 3.25), 0);
assert(r.ok, `wall failed: ${r.reason}`);
const z = Math.min(...r.tris.map((p) => p[2]));
assert(Math.abs(z - (5 - 2.75 + PROP.footGap)) < 1e-6, `lowest point ${z.toFixed(3)}, expected ${5 - 2.75 + PROP.footGap} (tilted MAX_DROP)`);
// (and 3.7, just inside MAX_DROP + MAX_HANG 3.75, still tilts)
for (const down of [3.25, 3.7]) {
const r = drawnWall([-30, 0, 35], [30, 0, 35], ledge(5 - down), 0);
assert(r.ok, `wall failed (${down} down): ${r.reason}`);
const z = Math.min(...r.tris.map((p) => p[2]));
assert(Math.abs(z - (5 - 2.75 + PROP.footGap)) < 1e-6,
`${down} down: lowest point ${z.toFixed(3)}, expected ${5 - 2.75 + PROP.footGap} (tilted MAX_DROP)`);
}
});
+5 -3
View File
@@ -81,9 +81,11 @@ export function floorLine(topLine, tris, margin = 1.0, mold = false) {
* under it and footGap past it; if the part bulges up between them, both rise
* until the straight bottom edge clears it -- but never past the highest floor:
* then the high side pins there and only the low one tilts. The tilt reaches at most
* MAX_DROP across th (~70deg), leaving that corner at most MAX_HANG over its floor; a
* side whose floor is further down stays level, so a wall on the brink of a ledge
* doesn't reach down its face into the air.
* MAX_DROP across th (~70deg), leaving that corner at most MAX_HANG (+ footGap) over
* its floor; a side whose floor is further down stays level, so a wall on the brink
* of a ledge doesn't reach down its face into the air. That is a switch, not a fade:
* where a side floor straddles MAX_DROP + MAX_HANG along the wall, the bottom steps
* MAX_DROP between neighbouring stations (each piece capped or level, both safe).
* Returns [zNeg, zPos] for the -w and +w sides (the across-wall `sx` sign).
*/
const MAX_DROP = 2.75, MAX_HANG = 1.0;