Nothing stands proud of a surface you sit on or stand under

Reported for the third time, and the first two answers were wrong in the same
way: I treated "it should not be visible" as a number to reduce rather than a
rule to satisfy. The bench's through-tenons went 42 mm proud, then 3 mm, and
3 mm is still a raised patch with a lit edge on it — visible in the render,
and the thing being complained about. The market stall then reproduced it
exactly: four post heads through the awning, like tacks.

Both were pushed proud DELIBERATELY, to keep two faces out of one plane and
away from the z-fight check. That trade is false, and this is the sentence
worth keeping: a piece that must not show ends INSIDE the solid it enters. A
buried face cannot be coplanar with a surface and cannot be seen. Level with
the surface is the only genuinely bad option, and it was the one I kept
treating as the alternative.

  - The bench's tenon is now housed an eighth of the seat's thickness below
    the top. That is a real joint rather than a compromise: a stub tenon into
    the underside of a board is how a bench is made when the top is thick
    enough to take it, which at 0.135 of the height it is. What is lost is the
    panel of end grain; what is gained is a seat.
  - The stall's posts stop ON the cloth's mid surface, with half its thickness
    over them, and the cloth went from 0.2 of a board to 0.42 so there is
    something to bury them in. The heads now sit 25 mm under the top surface.

And the brief is a check now, because a rule I keep is worth less than a rule
the build keeps. `nothingAbove` names the part nothing else may rise above —
the seat, the counter, the awning — and it reports the offender and the
millimetres. Mutation-tested: pushing the tenon back to 3 mm proud fails it
with "PROUD: legs by 3.0mm".

38 models, all checks pass, 0 floating cases, documentation in step.
This commit is contained in:
CRTkafa 2026-08-27 13:52:08 +07:00
parent 672041cceb
commit 4730973fbd
8 changed files with 123 additions and 38 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 139 KiB

After

Width:  |  Height:  |  Size: 139 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 475 KiB

After

Width:  |  Height:  |  Size: 476 KiB

Before After
Before After

View file

@ -82,7 +82,7 @@
"address": "@medieval-kit/core", "address": "@medieval-kit/core",
"source": "file:my-registry/dist/registry.json", "source": "file:my-registry/dist/registry.json",
"version": "workspace", "version": "workspace",
"installedAt": "2026-08-26T20:14:45.008Z", "installedAt": "2026-08-27T06:50:20.568Z",
"files": [ "files": [
{ {
"path": "src\\models\\medieval-kit\\core\\geometry.ts", "path": "src\\models\\medieval-kit\\core\\geometry.ts",
@ -362,11 +362,11 @@
"address": "@medieval-kit/wooden-bench", "address": "@medieval-kit/wooden-bench",
"source": "file:my-registry/dist/registry.json", "source": "file:my-registry/dist/registry.json",
"version": "workspace", "version": "workspace",
"installedAt": "2026-08-26T19:00:27.478Z", "installedAt": "2026-08-27T06:50:20.571Z",
"files": [ "files": [
{ {
"path": "src\\models\\medieval-kit\\wooden-bench\\model.ts", "path": "src\\models\\medieval-kit\\wooden-bench\\model.ts",
"sourceHash": "bb0aa806250a40e1bb52da17a79ba2c969327ef82a7b74d55b0819f9751e7d2c" "sourceHash": "ddba6c89ac114bf2cc31c6e8df1631ec97a0dae79ad2b06de4cbdbdbc78c556e"
} }
], ],
"dependencies": [ "dependencies": [
@ -677,11 +677,11 @@
"address": "@medieval-kit/market-stall", "address": "@medieval-kit/market-stall",
"source": "file:my-registry/dist/registry.json", "source": "file:my-registry/dist/registry.json",
"version": "workspace", "version": "workspace",
"installedAt": "2026-08-26T20:14:45.011Z", "installedAt": "2026-08-27T06:46:34.436Z",
"files": [ "files": [
{ {
"path": "src\\models\\medieval-kit\\market-stall\\model.ts", "path": "src\\models\\medieval-kit\\market-stall\\model.ts",
"sourceHash": "31fa88ff1df342465177b5b95b5814575f5691b255fcea5e75e591fc1fd3740e" "sourceHash": "1068f90351fae381f337fb2fc9e424ac1b96cb8d96c659e32219fe0e383a5adb"
} }
], ],
"dependencies": [ "dependencies": [

View file

@ -231,8 +231,14 @@ export function createModel(overrides: Partial<MarketStallConfig> = {}) {
for (const sx of [-1, 1] as const) { for (const sx of [-1, 1] as const) {
for (const sz of [-1, 1] as const) { for (const sz of [-1, 1] as const) {
// A shade past the cloth's mid surface, so the head is buried in it. // ON the cloth's mid surface, so half its thickness covers the head.
const head = clothY(sx * postX, sz * legZ) + boardT * 0.15 //
// A shade PAST it was the first version, and four dark post heads
// came through the awning like tacks — the same fault as the bench's
// tenons and made for the same reason: pushed proud to keep two
// faces out of one plane. Buried does that too, and cannot be seen
// doing it.
const head = clothY(sx * postX, sz * legZ)
// Down PAST the rail and finishing as a stub below it, which is both // Down PAST the rail and finishing as a stub below it, which is both
// the reference's detail and the fix for a real fault: stopped at the // the reference's detail and the fix for a real fault: stopped at the
// rail's underside, the post's foot lay in the same plane as it, // rail's underside, the post's foot lay in the same plane as it,
@ -269,7 +275,10 @@ export function createModel(overrides: Partial<MarketStallConfig> = {}) {
levels.push({ levels.push({
y: halfDepth * (f * 2 - 1), y: halfDepth * (f * 2 - 1),
halfWidth: halfLength, halfWidth: halfLength,
thickness: boardT * 0.2, // Thick enough to hide a post head in. At 0.2 of a board there was
// barely three millimetres of cloth either side of the mid surface,
// which is not enough to bury anything in with confidence.
thickness: boardT * 0.42,
// Deeper at the front than the back. Cloth pulled over a ridge and // Deeper at the front than the back. Cloth pulled over a ridge and
// left loose at the eaves does not hang symmetrically. // left loose at the eaves does not hang symmetrically.
curve: sag * (0.72 + f * 0.55), curve: sag * (0.72 + f * 0.55),

View file

@ -160,25 +160,39 @@ export function createModel(overrides: Partial<WoodenBenchConfig> = {}) {
)) ))
} }
// Tenon: the end of the leg running THROUGH the seat and showing on /**
// top of it as a panel of end grain. It is the most recognisable * Tenon: HOUSED in the seat, stopping short of its top face.
// detail of a medieval bench -- and it is nearly FLUSH. *
// * It was a through-tenon and it was reported twice. First at 42 mm
// At 1.9 seat thicknesses it stood 42 mm proud of the seat: a block of * proud, a block of oak the size of a thumb standing out of the
// oak the size of a thumb sticking straight up out of the surface you * surface you sit on; I planed it to 3 mm and called it done, and 3 mm
// are meant to sit on. A real through-tenon is wedged and then planed * is still a raised patch with a lit edge on it, still visible in the
// back, so what shows is the grain and a hairline of shoulder, not a * render, and still the thing being complained about. The brief is
// peg. Three millimetres proud, ten millimetres housed below. * that nothing on the seat shows, and 3 mm is not nothing — it is
const proud = seatThickness * 0.05 * small.
*
* So it ends INSIDE the slab, an eighth of the seat's thickness below
* the top. That is a real joint and not a compromise: a stub tenon
* into the underside of a board is how a bench is made when the top is
* thick enough to take it, which at 0.135 of the height it is. What is
* lost is the panel of end grain on top; what is gained is a seat.
*
* Ending it LEVEL with the top face was never an option, which is what
* sent me to 3 mm proud in the first place: two upward faces in one
* plane is the z-fight the checker exists to find. Buried has neither
* problem — a face inside a solid cannot fight anything and cannot be
* seen.
*/
const buried = seatThickness * 0.12
const housed = seatThickness * 0.16 const housed = seatThickness * 0.16
legPieces.push(chamferedBoxGeometry( legPieces.push(chamferedBoxGeometry(
[legWidth * 0.34, timber * 0.85], [legWidth * 0.34, timber * 0.85],
[legWidth * 0.32, timber * 0.8], [legWidth * 0.32, timber * 0.8],
seatThickness + proud + housed, seatThickness - buried + housed,
timber * 0.16, timber * 0.16,
[ [
side * legX, side * legX,
seatBottom + (seatThickness + proud - housed) / 2, seatBottom + (seatThickness - buried - housed) / 2,
jitter(random, timber * 0.1), jitter(random, timber * 0.1),
], ],
tint('oak', 0.09), tint('oak', 0.09),

View file

@ -295,6 +295,24 @@ interface Case {
* shot 0.23 m forward, the model grew to 0.42 m deep, and no test objected. * shot 0.23 m forward, the model grew to 0.42 m deep, and no test objected.
*/ */
readonly maxSize?: readonly [number, number, number] readonly maxSize?: readonly [number, number, number]
/**
* The part nothing else may rise above.
*
* "It should not be visible at all" is a real brief and it was given twice
* about the same bench, because the first time I answered it with a number
* instead of a rule: the through-tenons went from 42 mm proud to 3 mm, and
* 3 mm is still a raised patch with a lit edge on it. The market stall then
* repeated it exactly — four post heads through the awning — and for the
* same reason, which is the interesting part: both were pushed proud
* deliberately, to keep two faces out of one plane and away from the
* z-fight check.
*
* That trade is false. A piece that must not show ends INSIDE the solid it
* enters: a buried face cannot be coplanar with a surface and cannot be
* seen. This turns the brief into arithmetic — on a seat, on a counter, on
* an awning, nothing stands above the surface a person meets.
*/
readonly nothingAbove?: string
} }
const as = <T>(make: (o?: never) => T) => (o?: Record<string, number>): KitModel => const as = <T>(make: (o?: never) => T) => (o?: Record<string, number>): KitModel =>
@ -318,7 +336,7 @@ const CASES: readonly Case[] = [
parts: 3, ownSlot: 'leather', borrowSlot: 'oak', parts: 3, ownSlot: 'leather', borrowSlot: 'oak',
variants: [{ planks: 3 }, { lean: 0 }, { rivets: 0 }], variants: [{ planks: 3 }, { lean: 0 }, { rivets: 0 }],
maxSize: [1.3, 1.3, 0.9] }, maxSize: [1.3, 1.3, 0.9] },
{ id: 'market-stall', make: as(createStall), patch: { planks: 9, sag: 0.3 }, { id: 'market-stall', make: as(createStall), nothingAbove: 'awning', patch: { planks: 9, sag: 0.3 },
parts: 4, ownSlot: 'cloth', borrowSlot: 'oak', parts: 4, ownSlot: 'cloth', borrowSlot: 'oak',
variants: [{ sag: 0 }, { planks: 2 }, { length: 2.6 }, { awning: 1.4 }], variants: [{ sag: 0 }, { planks: 2 }, { length: 2.6 }, { awning: 1.4 }],
maxSize: [3.2, 2.5, 1.6] }, maxSize: [3.2, 2.5, 1.6] },
@ -373,7 +391,7 @@ const CASES: readonly Case[] = [
{ id: 'wooden-pitchfork', make: as(createPitchfork), patch: { tineCount: 5, spread: 0.3 }, { id: 'wooden-pitchfork', make: as(createPitchfork), patch: { tineCount: 5, spread: 0.3 },
parts: 3, ownSlot: 'iron', borrowSlot: 'oak', parts: 3, ownSlot: 'iron', borrowSlot: 'oak',
variants: [{ tineCount: 2 }, { spread: 0 }, { tineCount: 6 }] , maxSize: [0.4, 1.9, 0.2] }, variants: [{ tineCount: 2 }, { spread: 0 }, { tineCount: 6 }] , maxSize: [0.4, 1.9, 0.2] },
{ id: 'trestle-table', make: as(createTable), patch: { plankCount: 6, splay: 0.35 }, { id: 'trestle-table', make: as(createTable), nothingAbove: 'top', patch: { plankCount: 6, splay: 0.35 },
parts: 3, ownSlot: 'oak', borrowSlot: 'oak', closed: true, maxSize: [2.2, 0.9, 1.3], parts: 3, ownSlot: 'oak', borrowSlot: 'oak', closed: true, maxSize: [2.2, 0.9, 1.3],
variants: [{ plankCount: 2 }, { splay: 0 }] }, variants: [{ plankCount: 2 }, { splay: 0 }] },
{ id: 'cart-wheel', make: as(createWheel), patch: { spokeCount: 14, tyre: 0.07 }, { id: 'cart-wheel', make: as(createWheel), patch: { spokeCount: 14, tyre: 0.07 },
@ -382,7 +400,7 @@ const CASES: readonly Case[] = [
{ id: 'wooden-chest', make: as(createChest), patch: { bandCount: 4, width: 1.1 }, { id: 'wooden-chest', make: as(createChest), patch: { bandCount: 4, width: 1.1 },
parts: 4, ownSlot: 'iron', borrowSlot: 'oak', closed: true, parts: 4, ownSlot: 'iron', borrowSlot: 'oak', closed: true,
variants: [{ bandCount: 0 }, { bandCount: 1 }, { depth: 0.7 }] , maxSize: [1, 0.62, 0.62] }, variants: [{ bandCount: 0 }, { bandCount: 1 }, { depth: 0.7 }] , maxSize: [1, 0.62, 0.62] },
{ id: 'wooden-bench', make: as(createBench), patch: { length: 2.1, splay: 0.4 }, { id: 'wooden-bench', make: as(createBench), nothingAbove: 'seat', patch: { length: 2.1, splay: 0.4 },
parts: 3, ownSlot: 'oak', borrowSlot: 'oak', closed: true, parts: 3, ownSlot: 'oak', borrowSlot: 'oak', closed: true,
variants: [{ splay: 0 }, { inset: 0.02 }, { width: 0.45 }] , maxSize: [1.7, 0.5, 0.35] }, variants: [{ splay: 0 }, { inset: 0.02 }, { width: 0.45 }] , maxSize: [1.7, 0.5, 0.35] },
{ id: 'pitch-torch', make: as(createTorch), patch: { wrapLength: 0.42, flameHeight: 2.2 }, { id: 'pitch-torch', make: as(createTorch), patch: { wrapLength: 0.42, flameHeight: 2.2 },
@ -477,6 +495,27 @@ for (const testCase of CASES) {
expect('no NaN/Infinity vertices', report.nonFinite === 0) expect('no NaN/Infinity vertices', report.nonFinite === 0)
expect('bounds finite', report.size.every(Number.isFinite)) expect('bounds finite', report.size.every(Number.isFinite))
expect('within lowpoly budget (< 2500 triangles)', report.triangles < 2500) expect('within lowpoly budget (< 2500 triangles)', report.triangles < 2500)
if (testCase.nothingAbove) {
const top = model.parts[testCase.nothingAbove]
const above: string[] = []
if (top) {
const ceiling = new Box3().setFromObject(top.anchor).max.y
for (const [name, handle] of Object.entries(model.parts)) {
if (name === testCase.nothingAbove || !handle) continue
const peak = new Box3().setFromObject((handle as { anchor: Object3D }).anchor).max.y
// A tenth of a millimetre, because a surface is allowed to be rough.
if (peak > ceiling + 0.0001) {
above.push(`${name} by ${((peak - ceiling) * 1000).toFixed(1)}mm`)
}
}
}
expect(
`nothing stands proud of ${testCase.nothingAbove}`
+ (above.length ? ` — PROUD: ${above.join(', ')}` : ''),
top !== undefined && above.length === 0,
)
}
if (testCase.maxSize) { if (testCase.maxSize) {
const over = report.size const over = report.size
.map((value, i) => (value > testCase.maxSize![i]! ? `${'xyz'[i]}=${value}>${testCase.maxSize![i]}` : '')) .map((value, i) => (value > testCase.maxSize![i]! ? `${'xyz'[i]}=${value}>${testCase.maxSize![i]}` : ''))

View file

@ -231,8 +231,14 @@ export function createModel(overrides: Partial<MarketStallConfig> = {}) {
for (const sx of [-1, 1] as const) { for (const sx of [-1, 1] as const) {
for (const sz of [-1, 1] as const) { for (const sz of [-1, 1] as const) {
// A shade past the cloth's mid surface, so the head is buried in it. // ON the cloth's mid surface, so half its thickness covers the head.
const head = clothY(sx * postX, sz * legZ) + boardT * 0.15 //
// A shade PAST it was the first version, and four dark post heads
// came through the awning like tacks — the same fault as the bench's
// tenons and made for the same reason: pushed proud to keep two
// faces out of one plane. Buried does that too, and cannot be seen
// doing it.
const head = clothY(sx * postX, sz * legZ)
// Down PAST the rail and finishing as a stub below it, which is both // Down PAST the rail and finishing as a stub below it, which is both
// the reference's detail and the fix for a real fault: stopped at the // the reference's detail and the fix for a real fault: stopped at the
// rail's underside, the post's foot lay in the same plane as it, // rail's underside, the post's foot lay in the same plane as it,
@ -269,7 +275,10 @@ export function createModel(overrides: Partial<MarketStallConfig> = {}) {
levels.push({ levels.push({
y: halfDepth * (f * 2 - 1), y: halfDepth * (f * 2 - 1),
halfWidth: halfLength, halfWidth: halfLength,
thickness: boardT * 0.2, // Thick enough to hide a post head in. At 0.2 of a board there was
// barely three millimetres of cloth either side of the mid surface,
// which is not enough to bury anything in with confidence.
thickness: boardT * 0.42,
// Deeper at the front than the back. Cloth pulled over a ridge and // Deeper at the front than the back. Cloth pulled over a ridge and
// left loose at the eaves does not hang symmetrically. // left loose at the eaves does not hang symmetrically.
curve: sag * (0.72 + f * 0.55), curve: sag * (0.72 + f * 0.55),

View file

@ -160,25 +160,39 @@ export function createModel(overrides: Partial<WoodenBenchConfig> = {}) {
)) ))
} }
// Tenon: the end of the leg running THROUGH the seat and showing on /**
// top of it as a panel of end grain. It is the most recognisable * Tenon: HOUSED in the seat, stopping short of its top face.
// detail of a medieval bench -- and it is nearly FLUSH. *
// * It was a through-tenon and it was reported twice. First at 42 mm
// At 1.9 seat thicknesses it stood 42 mm proud of the seat: a block of * proud, a block of oak the size of a thumb standing out of the
// oak the size of a thumb sticking straight up out of the surface you * surface you sit on; I planed it to 3 mm and called it done, and 3 mm
// are meant to sit on. A real through-tenon is wedged and then planed * is still a raised patch with a lit edge on it, still visible in the
// back, so what shows is the grain and a hairline of shoulder, not a * render, and still the thing being complained about. The brief is
// peg. Three millimetres proud, ten millimetres housed below. * that nothing on the seat shows, and 3 mm is not nothing — it is
const proud = seatThickness * 0.05 * small.
*
* So it ends INSIDE the slab, an eighth of the seat's thickness below
* the top. That is a real joint and not a compromise: a stub tenon
* into the underside of a board is how a bench is made when the top is
* thick enough to take it, which at 0.135 of the height it is. What is
* lost is the panel of end grain on top; what is gained is a seat.
*
* Ending it LEVEL with the top face was never an option, which is what
* sent me to 3 mm proud in the first place: two upward faces in one
* plane is the z-fight the checker exists to find. Buried has neither
* problem — a face inside a solid cannot fight anything and cannot be
* seen.
*/
const buried = seatThickness * 0.12
const housed = seatThickness * 0.16 const housed = seatThickness * 0.16
legPieces.push(chamferedBoxGeometry( legPieces.push(chamferedBoxGeometry(
[legWidth * 0.34, timber * 0.85], [legWidth * 0.34, timber * 0.85],
[legWidth * 0.32, timber * 0.8], [legWidth * 0.32, timber * 0.8],
seatThickness + proud + housed, seatThickness - buried + housed,
timber * 0.16, timber * 0.16,
[ [
side * legX, side * legX,
seatBottom + (seatThickness + proud - housed) / 2, seatBottom + (seatThickness - buried - housed) / 2,
jitter(random, timber * 0.1), jitter(random, timber * 0.1),
], ],
tint('oak', 0.09), tint('oak', 0.09),