Enforce "nothing floats", and rebuild the barrel from a reference photo

Two rules were missing, and each one had been quietly failing for a while.

The first is structural. Every check in this repo asked about surfaces --
winding, coplanarity, triangle counts -- and none of them could see a piece
of a model hanging in the air with nothing holding it up. A chest lid
separated from its chest passed everything we had. scripts/support.ts
voxelises the model, finds the connected components of occupied space and
requires each one to reach the floor; scripts/audit.ts runs that across
default, min, max, both sweep ends, actions and the midpoint of a morph, so
a variation cannot break what the default gets right. That audit started at
22 failing cases: the bell and the sign had no supporting structure at all
and now have a frame and a post, the lantern was in four pieces, the sack's
collar floated above its body, the basket's fruit hung level with the rim
instead of resting on the base, and the ladder's rungs were sized by a
formula that disagreed with where the rails actually were. It now reports 0.

The second is that we had no target. The feedback loop was an offline
render of our own output, which can only answer "is this broken", never
"is this right". Given a reference photograph of a cask, five defects were
obvious in seconds that three rounds of self-review had missed: four hoops
where there should be six, no rivets at all, a chime cut so shallow it did
not read, and a stave count low enough to leave a visibly polygonal
silhouette. All four are fixed here.

Two things the rivets taught us, both kept as comments rather than as
scars: a stud that tapers outward tilts its side normals back towards the
axis, which the radial check correctly reports as reversed winding -- a
real rivet head flares, so the honest shape is also the passing one. And
once seated deep enough to look right, the stud's buried inner cap falls
inside the shell the check inspects, so it is not generated at all, exactly
as bandGeometry already declines to build the inside of a hoop.

27 models, 16973 triangles, all checks pass, 0 floating cases.
This commit is contained in:
CRTkafa 2026-08-21 19:23:11 +07:00
parent 69c40e918f
commit a0659e24ac
25 changed files with 1056 additions and 121 deletions

View file

@ -56,6 +56,24 @@ export function createModel(overrides: Partial<WoodenLadderConfig> = {}) {
// The rails converge towards the top; this single detail stops the ladder
// from being "two boards" and makes it a ladder.
const lean = half * config.taper
/**
* Half-gap between the rails at height fraction `t`.
*
* This exists because the rung length and the rail placement used to be
* two separate expressions that disagreed. The rails are built upright
* and then rotated about Z, so at height y each one sits at
* `side·half − y·sin(θ)`; the rung length assumed `half − lean·t`, which
* narrows where the real rails widen. At the default taper the error was
* small enough to hide. At taper 0.4 on a 5 m ladder the top rungs came
* out half the length of the gap they were supposed to span and floated
* between the rails.
*
* Both now read from here, so they cannot drift apart again.
*/
const railHalfAt = (t: number): number => {
const y = -config.height / 2 + t * config.height
return half - y * Math.sin(lean / config.height)
}
const rails = [-1, 1].map((side) => {
const rail = chamferedBoxGeometry(
[railThickness, railThickness * 1.35],
@ -78,7 +96,7 @@ export function createModel(overrides: Partial<WoodenLadderConfig> = {}) {
const y = -config.height / 2 + t * config.height
// The rung is a little LONGER than the rail gap at that height, so that
// its ends stay inside the rails.
const span = (half - lean * t) * 2 + railThickness * 0.9
const span = railHalfAt(t) * 2 + railThickness * 0.9
rungs.push(chamferedBoxGeometry(
[span, railThickness * 1.05],
[span, railThickness * 1.05],