Take the shoulder off the bench's feet

Reported twice. The first time I planed the through-tenons from 42 mm proud to
3 and called it done, which answered the tenons rather than the question — the
tenons were never it. Measured again now: nothing stands more than 3.9 mm above
the seat at any slider setting, and the thing that was catching was on the
LEGS.

The leg board widens on the way down; that is the splay. The two feet, cut out
of its bottom edge by the arch, were built at `footWidth` — the board's width
at the FLOOR. But a foot starts at the top of the arch, a third of the way up,
where the board has not widened that far yet. So every foot stood proud of the
board it hangs from, on both sides, as a hard shoulder at shin height: 14 mm by
default, 20 mm on a wide bench, 32 mm at full splay. Setting the splay to zero
made it vanish, which is what finally named the cause.

The leg's outer edge is a straight line from `footWidth / 2` at the floor to
`legWidth / 2` under the seat, and a foot's outer face has to lie ON that line
rather than run vertically up from its own base. A tapered box narrows about
its centre, so taking twice the taper off the top width moves the outer face in
by exactly the taper — and moves the inner face out by the same, narrowing the
arch as it rises, which is also what a splayed leg does. 14.2 mm becomes 0.2,
32.3 becomes 0.4, and 0.2 mm is the sampling resolution rather than a step.

`scripts/probe-bench.ts` is how it was found and it took two wrong versions to
get there, both failing the same way — by measuring something and reporting a
number that was not the answer:

  - The first sampled vertices into height bands. A tapered box has corners
    only at its top and bottom, so the bands between them came out empty, were
    skipped, and it reported a confident 0.0 mm step for a leg with a 17 mm
    shoulder on it. It now slices the actual triangles, which gives a width at
    any height whether a corner is there or not.
  - The second scanned the full height of the leg part and found its biggest
    drop at 86% — exactly where the board ends and only the tenon carries on
    into the seat. That is what a tenon IS. A real fault of 14 mm was sitting
    underneath a 66 mm reading that was not a fault at all, so the scan now
    stops at the seat's underside.

Both media images regenerated, since the bench is in each of them.
This commit is contained in:
CRTkafa 2026-08-27 02:02:35 +07:00
parent a48431ca9c
commit 30c7c4863a
6 changed files with 199 additions and 5 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 129 KiB

After

Width:  |  Height:  |  Size: 129 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 430 KiB

After

Width:  |  Height:  |  Size: 430 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-23T12:45:30.043Z", "installedAt": "2026-08-26T19:00:27.476Z",
"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-23T09:56:44.514Z", "installedAt": "2026-08-26T19:00:27.478Z",
"files": [ "files": [
{ {
"path": "src\\models\\medieval-kit\\wooden-bench\\model.ts", "path": "src\\models\\medieval-kit\\wooden-bench\\model.ts",
"sourceHash": "3b3468721c72911d1fd9eb54da61828cdc666c1b5a86871c5c5997ab9cc37533" "sourceHash": "bb0aa806250a40e1bb52da17a79ba2c969327ef82a7b74d55b0819f9751e7d2c"
} }
], ],
"dependencies": [ "dependencies": [

View file

@ -122,10 +122,34 @@ export function createModel(overrides: Partial<WoodenBenchConfig> = {}) {
// so the joint is an overlap rather than two faces meeting. // so the joint is an overlap rather than two faces meeting.
const footThickness = footWidth * 0.3 const footThickness = footWidth * 0.3
const footRise = archHeight + legHeight * 0.07 const footRise = archHeight + legHeight * 0.07
/**
* Each foot narrows on the way UP by exactly the board's own taper.
*
* This is the protrusion, and it was reported twice before I found it:
* the first time I planed the through-tenons and answered the wrong
* question. The feet were built at `footWidth`, the board's width at
* the GROUND -- but a foot starts at the top of the arch, a third of
* the way up, where the board has not widened that far yet. So every
* foot stood proud of the board it hangs from, on both sides, as a
* hard shoulder at shin height: 14 mm by default and 32 mm at full
* splay. Setting the splay to zero made it vanish, which is what
* finally named the cause.
*
* The leg's outer edge is a straight line from `footWidth / 2` at the
* floor to `legWidth / 2` under the seat, and the foot's outer face
* has to lie ON that line rather than run vertically up from its foot.
* A tapered box narrows about its own centre, so taking twice the
* taper off the top width moves the outer face in by exactly the taper
* -- and moves the inner face out by the same, which narrows the arch
* as it rises, which is also what a splayed leg does.
*/
const footTaper = spread * (footRise / legHeight)
const footTop = Math.max(footThickness * 0.3, footThickness - footTaper * 2)
for (const foot of [-1, 1]) { for (const foot of [-1, 1]) {
legPieces.push(taperedBoxGeometry( legPieces.push(taperedBoxGeometry(
[footThickness, timber * 1.35], [footThickness, timber * 1.35],
[footThickness * 0.92, timber * 1.35], [footTop, timber * 1.35],
footRise, footRise,
[ [
side * legX + foot * (footWidth - footThickness) / 2, side * legX + foot * (footWidth - footThickness) / 2,

146
scripts/probe-bench.ts Normal file
View file

@ -0,0 +1,146 @@
/**
* Measures what stands proud of the bench, and where.
*
* "There is something sticking out of the bench again" is a real report and an
* unmeasurable one. The first time it came in I planed the through-tenons from
* 42 mm to 3 and called it done — which answered the tenons rather than the
* question. The question is: over the whole thing a person sits on and swings
* their legs past, what stands proud, and by how much?
*
* Two measurements, because there turned out to be two kinds:
*
* 1. Above the SEAT. The tenons, and anything else ending up over the
* surface. 3 mm is a plane's shaving; 10 mm you feel; 40 mm you sit on.
* 2. A STEP in the leg's silhouette. A leg board that widens smoothly on the
* way down is a splayed leg; one that suddenly juts outward is a shoulder
* at shin height, and that is what was actually wrong.
*
* Both are swept across the sliders, because a bench that is smooth at one
* setting and studded at another is still a bench you would not sit on.
*/
import { Mesh, type Object3D } from 'three/webgpu'
import { createModel } from '@/models/medieval-kit/wooden-bench/model.ts'
/** Every triangle of a part as nine numbers. */
function triangles(part: Object3D): number[][] {
const out: number[][] = []
part.updateWorldMatrix(true, true)
part.traverse((child) => {
const mesh = child as Mesh
if (!mesh.isMesh) return
const pos = mesh.geometry.getAttribute('position')
for (let i = 0; i < pos.count; i += 3) {
const t: number[] = []
for (let k = 0; k < 3; k += 1) {
t.push(pos.getX(i + k), pos.getY(i + k), pos.getZ(i + k))
}
out.push(t)
}
})
return out
}
/**
* The silhouette's half-width at a height, by SLICING the triangles.
*
* The first version of this sampled vertices into height bands and reported a
* 0.0 mm step for a leg carrying a 17 mm shoulder. A tapered box has corners
* only at its top and its bottom, so every band between them came out empty,
* got skipped, and the comparison that would have caught the fault never ran —
* the same failure as a check that passes by not running. Cutting the actual
* triangles gives a width at any height, whether a corner happens to be there
* or not.
*/
function halfWidthAt(tris: number[][], y: number): number {
let widest = 0
for (const t of tris) {
for (let e = 0; e < 3; e += 1) {
const a = e * 3
const b = ((e + 1) % 3) * 3
const ya = t[a + 1]!
const yb = t[b + 1]!
if (ya === yb) continue
if ((ya - y) * (yb - y) > 0) continue
const f = (y - ya) / (yb - ya)
widest = Math.max(widest, Math.abs(t[a]! + (t[b]! - t[a]!) * f))
}
}
return widest
}
const CASES: Array<[string, Record<string, number>]> = [
['default', {}],
['short', { length: 0.9 }],
['long', { length: 2.4 }],
['low', { height: 0.32 }],
['tall', { height: 0.58 }],
['narrow', { width: 0.2 }],
['wide', { width: 0.42 }],
['splayed', { splay: 0.5 }],
['upright', { splay: 0 }],
['inset out', { inset: 0.04 }],
['inset in', { inset: 0.24 }],
]
console.log('case above the seat worst step in the leg silhouette')
let worstProud = 0
let worstStep = 0
for (const [label, patch] of CASES) {
const model = createModel(patch as never)
const seatTris = triangles(model.parts.seat.anchor)
const seatTop = Math.max(...seatTris.flatMap((t) => [t[1]!, t[4]!, t[7]!]))
const legTris = triangles(model.parts.legs.anchor)
const other = [
...legTris,
...(model.parts.stretcher ? triangles(model.parts.stretcher.anchor) : []),
]
const peak = Math.max(...other.flatMap((t) => [t[1]!, t[4]!, t[7]!]))
const proud = peak - seatTop
worstProud = Math.max(worstProud, proud)
/**
* Walk up the leg BELOW THE SEAT. A shoulder shows as the width dropping.
*
* Stopping at the seat's underside is not a convenience, it is the
* difference between measuring the fault and measuring the design. Scanned
* to the full height of the part, the biggest drop is 66 mm at 86% of the
* way up — which is precisely where the leg board ends and only the through
* tenon carries on into the seat. That is what a tenon IS. Reporting it as a
* shoulder buries the real one, at the feet, under a bigger number that is
* not a fault at all.
*/
const seatBottom = Math.min(...seatTris.flatMap((t) => [t[1]!, t[4]!, t[7]!]))
const ys = legTris.flatMap((t) => [t[1]!, t[4]!, t[7]!])
const low = Math.min(...ys)
const high = seatBottom
const steps = 220
let drop = 0
let at = 0
let previous = halfWidthAt(legTris, low + (high - low) * 0.004)
for (let i = 1; i <= steps; i += 1) {
const f = 0.004 + (i / steps) * 0.98
const w = halfWidthAt(legTris, low + (high - low) * f)
if (w > 0 && previous > 0 && previous - w > drop) {
drop = previous - w
at = f * 100
}
if (w > 0) previous = w
}
worstStep = Math.max(worstStep, drop)
console.log(
`${label.padEnd(12)} ${(proud * 1000).toFixed(1).padStart(6)} mm `
+ `${(drop * 1000).toFixed(1).padStart(6)} mm at ${at.toFixed(0).padStart(2)}% of the leg`,
)
model.dispose()
}
console.log('')
console.log(`worst proud of the seat : ${(worstProud * 1000).toFixed(1)} mm`)
console.log(`worst shoulder on a leg : ${(worstStep * 1000).toFixed(1)} mm`)
if (worstProud > 0.006 || worstStep > 0.004) {
console.log('FAIL — you would feel that.')
process.exit(1)
}
console.log('Nothing on this bench catches.')

View file

@ -122,10 +122,34 @@ export function createModel(overrides: Partial<WoodenBenchConfig> = {}) {
// so the joint is an overlap rather than two faces meeting. // so the joint is an overlap rather than two faces meeting.
const footThickness = footWidth * 0.3 const footThickness = footWidth * 0.3
const footRise = archHeight + legHeight * 0.07 const footRise = archHeight + legHeight * 0.07
/**
* Each foot narrows on the way UP by exactly the board's own taper.
*
* This is the protrusion, and it was reported twice before I found it:
* the first time I planed the through-tenons and answered the wrong
* question. The feet were built at `footWidth`, the board's width at
* the GROUND -- but a foot starts at the top of the arch, a third of
* the way up, where the board has not widened that far yet. So every
* foot stood proud of the board it hangs from, on both sides, as a
* hard shoulder at shin height: 14 mm by default and 32 mm at full
* splay. Setting the splay to zero made it vanish, which is what
* finally named the cause.
*
* The leg's outer edge is a straight line from `footWidth / 2` at the
* floor to `legWidth / 2` under the seat, and the foot's outer face
* has to lie ON that line rather than run vertically up from its foot.
* A tapered box narrows about its own centre, so taking twice the
* taper off the top width moves the outer face in by exactly the taper
* -- and moves the inner face out by the same, which narrows the arch
* as it rises, which is also what a splayed leg does.
*/
const footTaper = spread * (footRise / legHeight)
const footTop = Math.max(footThickness * 0.3, footThickness - footTaper * 2)
for (const foot of [-1, 1]) { for (const foot of [-1, 1]) {
legPieces.push(taperedBoxGeometry( legPieces.push(taperedBoxGeometry(
[footThickness, timber * 1.35], [footThickness, timber * 1.35],
[footThickness * 0.92, timber * 1.35], [footTop, timber * 1.35],
footRise, footRise,
[ [
side * legX + foot * (footWidth - footThickness) / 2, side * legX + foot * (footWidth - footThickness) / 2,