diff --git a/models.lock.json b/models.lock.json index 2fee4ea..d98289a 100644 --- a/models.lock.json +++ b/models.lock.json @@ -67,7 +67,7 @@ "address": "@medieval-kit/wooden-barrel", "source": "file:my-registry/dist/registry.json", "version": "workspace", - "installedAt": "2026-08-22T04:53:30.952Z", + "installedAt": "2026-08-22T05:07:43.803Z", "files": [ { "path": "src\\models\\medieval-kit\\wooden-barrel\\model.ts", @@ -82,7 +82,7 @@ "address": "@medieval-kit/core", "source": "file:my-registry/dist/registry.json", "version": "workspace", - "installedAt": "2026-08-22T04:53:30.926Z", + "installedAt": "2026-08-22T05:07:43.779Z", "files": [ { "path": "src\\models\\medieval-kit\\core\\geometry.ts", @@ -129,7 +129,7 @@ "address": "@medieval-kit/wooden-crate", "source": "file:my-registry/dist/registry.json", "version": "workspace", - "installedAt": "2026-08-22T04:53:30.957Z", + "installedAt": "2026-08-22T05:07:43.809Z", "files": [ { "path": "src\\models\\medieval-kit\\wooden-crate\\model.ts", @@ -144,7 +144,7 @@ "address": "@medieval-kit/kit", "source": "file:my-registry/dist/registry.json", "version": "workspace", - "installedAt": "2026-08-22T04:53:30.965Z", + "installedAt": "2026-08-22T05:07:43.817Z", "files": [], "dependencies": [] }, @@ -152,7 +152,7 @@ "address": "@medieval-kit/iron-anvil", "source": "file:my-registry/dist/registry.json", "version": "workspace", - "installedAt": "2026-08-22T04:53:30.936Z", + "installedAt": "2026-08-22T05:07:43.788Z", "files": [ { "path": "src\\models\\medieval-kit\\iron-anvil\\model.ts", @@ -167,7 +167,7 @@ "address": "@medieval-kit/wooden-bucket", "source": "file:my-registry/dist/registry.json", "version": "workspace", - "installedAt": "2026-08-22T04:53:30.955Z", + "installedAt": "2026-08-22T05:07:43.806Z", "files": [ { "path": "src\\models\\medieval-kit\\wooden-bucket\\model.ts", @@ -182,7 +182,7 @@ "address": "@medieval-kit/wooden-fence", "source": "file:my-registry/dist/registry.json", "version": "workspace", - "installedAt": "2026-08-22T04:53:30.959Z", + "installedAt": "2026-08-22T05:07:43.810Z", "files": [ { "path": "src\\models\\medieval-kit\\wooden-fence\\model.ts", @@ -197,7 +197,7 @@ "address": "@medieval-kit/wooden-hoe", "source": "file:my-registry/dist/registry.json", "version": "workspace", - "installedAt": "2026-08-22T04:53:30.960Z", + "installedAt": "2026-08-22T05:07:43.811Z", "files": [ { "path": "src\\models\\medieval-kit\\wooden-hoe\\model.ts", @@ -212,7 +212,7 @@ "address": "@medieval-kit/wooden-ladder", "source": "file:my-registry/dist/registry.json", "version": "workspace", - "installedAt": "2026-08-22T04:53:30.961Z", + "installedAt": "2026-08-22T05:07:43.813Z", "files": [ { "path": "src\\models\\medieval-kit\\wooden-ladder\\model.ts", @@ -227,7 +227,7 @@ "address": "@medieval-kit/wooden-pitchfork", "source": "file:my-registry/dist/registry.json", "version": "workspace", - "installedAt": "2026-08-22T04:53:30.963Z", + "installedAt": "2026-08-22T05:07:43.814Z", "files": [ { "path": "src\\models\\medieval-kit\\wooden-pitchfork\\model.ts", @@ -242,7 +242,7 @@ "address": "@medieval-kit/wooden-shovel", "source": "file:my-registry/dist/registry.json", "version": "workspace", - "installedAt": "2026-08-22T04:53:30.964Z", + "installedAt": "2026-08-22T05:07:43.815Z", "files": [ { "path": "src\\models\\medieval-kit\\wooden-shovel\\model.ts", @@ -257,7 +257,7 @@ "address": "@medieval-kit/wooden-stool", "source": "file:my-registry/dist/registry.json", "version": "workspace", - "installedAt": "2026-08-22T04:53:30.965Z", + "installedAt": "2026-08-22T05:07:43.817Z", "files": [ { "path": "src\\models\\medieval-kit\\wooden-stool\\model.ts", @@ -272,7 +272,7 @@ "address": "@medieval-kit/cart-wheel", "source": "file:my-registry/dist/registry.json", "version": "workspace", - "installedAt": "2026-08-22T04:53:30.930Z", + "installedAt": "2026-08-22T05:07:43.783Z", "files": [ { "path": "src\\models\\medieval-kit\\cart-wheel\\model.ts", @@ -287,7 +287,7 @@ "address": "@medieval-kit/log-pile", "source": "file:my-registry/dist/registry.json", "version": "workspace", - "installedAt": "2026-08-22T04:53:30.942Z", + "installedAt": "2026-08-22T05:07:43.794Z", "files": [ { "path": "src\\models\\medieval-kit\\log-pile\\model.ts", @@ -302,7 +302,7 @@ "address": "@medieval-kit/trestle-table", "source": "file:my-registry/dist/registry.json", "version": "workspace", - "installedAt": "2026-08-22T04:53:30.949Z", + "installedAt": "2026-08-22T05:07:43.800Z", "files": [ { "path": "src\\models\\medieval-kit\\trestle-table\\model.ts", @@ -317,7 +317,7 @@ "address": "@medieval-kit/wooden-chest", "source": "file:my-registry/dist/registry.json", "version": "workspace", - "installedAt": "2026-08-22T04:53:30.956Z", + "installedAt": "2026-08-22T05:07:43.807Z", "files": [ { "path": "src\\models\\medieval-kit\\wooden-chest\\model.ts", @@ -332,7 +332,7 @@ "address": "@medieval-kit/hay-bale", "source": "file:my-registry/dist/registry.json", "version": "workspace", - "installedAt": "2026-08-22T04:53:30.935Z", + "installedAt": "2026-08-22T05:07:43.787Z", "files": [ { "path": "src\\models\\medieval-kit\\hay-bale\\model.ts", @@ -347,7 +347,7 @@ "address": "@medieval-kit/pitch-torch", "source": "file:my-registry/dist/registry.json", "version": "workspace", - "installedAt": "2026-08-22T04:53:30.945Z", + "installedAt": "2026-08-22T05:07:43.796Z", "files": [ { "path": "src\\models\\medieval-kit\\pitch-torch\\model.ts", @@ -362,7 +362,7 @@ "address": "@medieval-kit/wooden-bench", "source": "file:my-registry/dist/registry.json", "version": "workspace", - "installedAt": "2026-08-22T04:53:30.954Z", + "installedAt": "2026-08-22T05:07:43.805Z", "files": [ { "path": "src\\models\\medieval-kit\\wooden-bench\\model.ts", @@ -377,7 +377,7 @@ "address": "@medieval-kit/linen-sack", "source": "file:my-registry/dist/registry.json", "version": "workspace", - "installedAt": "2026-08-22T04:53:30.941Z", + "installedAt": "2026-08-22T05:07:43.792Z", "files": [ { "path": "src\\models\\medieval-kit\\linen-sack\\model.ts", @@ -392,7 +392,7 @@ "address": "@medieval-kit/oak-tankard", "source": "file:my-registry/dist/registry.json", "version": "workspace", - "installedAt": "2026-08-22T04:53:30.944Z", + "installedAt": "2026-08-22T05:07:43.795Z", "files": [ { "path": "src\\models\\medieval-kit\\oak-tankard\\model.ts", @@ -407,7 +407,7 @@ "address": "@medieval-kit/straw-broom", "source": "file:my-registry/dist/registry.json", "version": "workspace", - "installedAt": "2026-08-22T04:53:30.947Z", + "installedAt": "2026-08-22T05:07:43.798Z", "files": [ { "path": "src\\models\\medieval-kit\\straw-broom\\model.ts", @@ -422,7 +422,7 @@ "address": "@medieval-kit/bronze-bell", "source": "file:my-registry/dist/registry.json", "version": "workspace", - "installedAt": "2026-08-22T04:53:30.929Z", + "installedAt": "2026-08-22T05:07:43.781Z", "files": [ { "path": "src\\models\\medieval-kit\\bronze-bell\\model.ts", @@ -437,7 +437,7 @@ "address": "@medieval-kit/iron-lantern", "source": "file:my-registry/dist/registry.json", "version": "workspace", - "installedAt": "2026-08-22T04:53:30.938Z", + "installedAt": "2026-08-22T05:07:43.790Z", "files": [ { "path": "src\\models\\medieval-kit\\iron-lantern\\model.ts", @@ -452,7 +452,7 @@ "address": "@medieval-kit/tavern-sign", "source": "file:my-registry/dist/registry.json", "version": "workspace", - "installedAt": "2026-08-22T04:53:30.948Z", + "installedAt": "2026-08-22T05:07:43.799Z", "files": [ { "path": "src\\models\\medieval-kit\\tavern-sign\\model.ts", @@ -467,7 +467,7 @@ "address": "@medieval-kit/coin-pouch", "source": "file:my-registry/dist/registry.json", "version": "workspace", - "installedAt": "2026-08-22T04:53:30.932Z", + "installedAt": "2026-08-22T05:07:43.784Z", "files": [ { "path": "src\\models\\medieval-kit\\coin-pouch\\model.ts", @@ -482,7 +482,7 @@ "address": "@medieval-kit/glass-phial", "source": "file:my-registry/dist/registry.json", "version": "workspace", - "installedAt": "2026-08-22T04:53:30.934Z", + "installedAt": "2026-08-22T05:07:43.786Z", "files": [ { "path": "src\\models\\medieval-kit\\glass-phial\\model.ts", @@ -497,7 +497,7 @@ "address": "@medieval-kit/leather-book", "source": "file:my-registry/dist/registry.json", "version": "workspace", - "installedAt": "2026-08-22T04:53:30.939Z", + "installedAt": "2026-08-22T05:07:43.791Z", "files": [ { "path": "src\\models\\medieval-kit\\leather-book\\model.ts", @@ -512,11 +512,11 @@ "address": "@medieval-kit/wicker-basket", "source": "file:my-registry/dist/registry.json", "version": "workspace", - "installedAt": "2026-08-22T04:53:30.951Z", + "installedAt": "2026-08-22T05:07:43.802Z", "files": [ { "path": "src\\models\\medieval-kit\\wicker-basket\\model.ts", - "sourceHash": "842204f7e1b98e273270655e47c6e3a21fa52d3d57d1c8901f28b546b4f6ba47" + "sourceHash": "596b709436ce9ab344fd43143f6ba954dac400f38c2ec0389cafcdfc3896199a" } ], "dependencies": [ diff --git a/my-registry/meta.ts b/my-registry/meta.ts index 246cca5..94849ca 100644 --- a/my-registry/meta.ts +++ b/my-registry/meta.ts @@ -431,7 +431,7 @@ export const MODEL_META: Readonly> = { hue: { type: 'number', label: 'Produce hue', min: 0, max: 1, step: 0.01 }, seed: { type: 'number', label: 'Variation seed', min: 1, max: 64, step: 1 }, }, - materialSlots: ['straw', 'produce'], + materialSlots: ['oak', 'produce'], parts: ['weave', 'rim', 'contents'], }, 'wooden-ladder': { diff --git a/my-registry/models/wicker-basket/model.ts b/my-registry/models/wicker-basket/model.ts index 967b18a..3982e61 100644 --- a/my-registry/models/wicker-basket/model.ts +++ b/my-registry/models/wicker-basket/model.ts @@ -56,12 +56,15 @@ export interface WickerBasketConfig { } export const wickerBasketDefaults: WickerBasketConfig = { - height: 0.21, + // Shallower and fuller. The reference is a bowl wider than it is deep, + // heaped until the fruit mounds over the rim -- which is the only state a + // fruit basket is ever drawn in. + height: 0.16, radius: 0.17, taper: 0.26, stakes: 11, rows: 6, - produce: 9, + produce: 15, hue: 0.02, seed: 97, } @@ -69,10 +72,10 @@ export const wickerBasketDefaults: WickerBasketConfig = { export type WickerBasketParts = 'weave' | 'rim' | 'contents' export function createModel(overrides: Partial = {}) { - return createKitModel({ + return createKitModel({ id: 'wicker-basket', defaults: wickerBasketDefaults, - slots: ['straw', 'produce'], + slots: ['oak', 'produce'], build: ({ config, random }) => { const tint = createTinter(random) const half = config.height / 2 @@ -114,7 +117,7 @@ export function createModel(overrides: Partial = {}) { const angle = (i / stakes) * Math.PI * 2 const stake = prismGeometry( withy * 0.42, withy * 0.36, config.height * 1.02, 4, - [0, 0, 0], tint('straw', -0.09, 1.2), + [0, 0, 0], tint('oak', -0.09 + 0.04, 1.2), ) // Bend first, move second: in a tapering basket the stakes lean too. stake.rotateX(Math.atan2(config.radius - bottomRadius, config.height)) @@ -124,6 +127,25 @@ export function createModel(overrides: Partial = {}) { pieces.push(stake) } + // Willow, not straw. + // + // The basket drew its colour from the `straw` palette entry and rendered + // at hue 41 with saturation 0.59; a photograph of a wicker basket sits at + // hue 29, saturation 0.50. It read as bright yellow plastic. The tuned + // `oak` entry is hue 26 / saturation 0.53 -- almost exactly the + // measurement -- and willow IS a wood, so the material slot moves with + // the colour. The lift keeps it at the pale, peeled end of oak rather + // than the dark structural end. + // + // The lift is 0.04 and that is nearly arbitrary: sweeping it over 0.00, + // 0.04 and 0.08 moved the measured hue and saturation by at most 0.01. + // It was first set to 0.12 on the reasoning that willow is paler than + // structural oak, which is true and which made the basket salmon pink -- + // raising HSL lightness holds saturation, so a saturated brown climbs + // towards peach rather than towards weathered willow. Against the + // reference the straw entry was off by 12 degrees of hue and 0.09 + // saturation; oak is off by 7 and 0.03. + // --- Horizontal weave ---------------------------------------------------- // TWO segments per vertical stake: `cos(stakes·θ)` is sampled exactly once // positive and once negative on every stake, so the wave is fully resolved @@ -135,12 +157,35 @@ export function createModel(overrides: Partial = {}) { // single-piece inner liner (below): six separate inner surfaces for six // hoops cost ~800 triangles, the liner costs 44, and from the inside the // difference is invisible. + // The weave stops BELOW the rim. Once the rows were made tall enough to + // meet each other they grew into the rim's band, and the outermost point + // of the undulation met the rim's inner facets in the same plane. The + // rim is a separate, thicker rod laid over the finished weave, so the + // weave ending under it is how the object is actually made. + const weaveSpan = config.height * 0.9 for (let r = 0; r < rows; r += 1) { const t = (r + 0.5) / rows - const y = -half + config.height * t + const y = -half + weaveSpan * t + // The band height is derived from the row count so that rows always + // MEET. It used to be a flat 0.11 of the height while the spacing + // between rows is 1/rows -- 0.167 at the default six -- which left a + // 12 mm gap you could see straight through to the contents. That is a + // slatted crate, not a weave. Rows now overlap slightly; they do not + // z-fight because consecutive rows are undulated half a wave apart, so + // where one bulges out its neighbour is tucked in. + // Alternate rows sit slightly proud of and slightly behind each other. + // This is how a weave really goes together -- the weaver's rod passes + // outside one stake and inside the next, so no two rows lie on the + // same cylinder -- and it is also what makes the overlap above safe. + // Undulating consecutive rows in antiphase is not enough on its own: + // a sine crosses zero, and at those nodes both rows returned to + // exactly `radiusAt(t)`. With a cylindrical basket (taper 0) every row + // shares that radius, so the overlapping bands met in coplanar faces + // at every node. + const lean = r % 2 === 0 ? withy * 0.2 : -withy * 0.2 const ring = bandGeometry( - radiusAt(t), y, config.height * 0.11, withy * 0.8, stakes * 2, - tint('straw', jitter(random, 0.07), 1.2), + radiusAt(t) + lean, y, (weaveSpan / rows) * 1.06, withy * 0.8, stakes * 2, + tint('oak', 0.04 + jitter(random, 0.07), 1.2), ) // The phase shifts by half a wave on every row: the next row going in // where the previous one came out is what makes a weave a weave. @@ -152,7 +197,7 @@ export function createModel(overrides: Partial = {}) { pieces.push(flipGeometry(latheGeometry([ { y: -half + config.height * 0.03, radius: bottomRadius * (1 - amplitude) }, { y: half - config.height * 0.02, radius: config.radius * (1 - amplitude) }, - ], stakes * 2, [0, 0, 0], tint('straw', -0.2, 1.1), { + ], stakes * 2, [0, 0, 0], tint('oak', 0.06, 1.1), { capTop: false, capBottom: false, }))) @@ -161,15 +206,24 @@ export function createModel(overrides: Partial = {}) { pieces.push(latheGeometry([ { y: -half - config.height * 0.01, radius: bottomRadius * 0.94 }, { y: -half + config.height * 0.05, radius: bottomRadius * 0.99 }, - ], stakes * 2, [0, 0, 0], tint('straw', -0.14, 1.2), { capTop: true })) + ], stakes * 2, [0, 0, 0], tint('oak', -0.14 + 0.04, 1.2), { capTop: true })) // --- Rim ----------------------------------------------------------------- // The thick bend that finishes the weave. It is the most visible detail on // the basket, and without it the edge looks "cut off". const rim = mergeColoured([ + // Thickness withy*2.1, not 1.5, and the reason is arithmetic rather + // than taste. At 1.5 the rim's inner surface landed at + // radius*1.015 - withy*1.5 = 0.16055, and the inner liner sits at + // radius*(1 - amplitude) = 0.16065 -- a tenth of a millimetre apart, + // by coincidence. On a cylindrical basket (taper 0) those are the same + // 22-sided prism and every facet of it z-fought. The thicker rod + // carries the inner face clearly past the liner, and it is the truer + // shape anyway: the rim is the heaviest rod in a basket, bent over the + // finished weave, and it stands proud on both sides. bandGeometry(config.radius * 1.015, half - config.height * 0.03, - config.height * 0.1, withy * 1.5, stakes * 2, - tint('straw', 0.07, 1.2), { inner: true }), + config.height * 0.1, withy * 2.1, stakes * 2, + tint('oak', 0.07 + 0.04, 1.2), { inner: true }), ]) // --- Contents ------------------------------------------------------------ @@ -203,13 +257,23 @@ export function createModel(overrides: Partial = {}) { const ring = Math.sqrt((i + 0.4) / count) const inner = Math.max(size, bottomRadius * 0.92 - size * 0.6) const spread = inner * ring - const layer = Math.floor(i / Math.max(3, Math.round(count * 0.55))) + // Fewer fruit per layer means MORE layers, and it is the layer count + // that decides whether the heap ever reaches the mouth. At 0.55 the + // default nine apples formed two layers topping out 12 cm below a rim + // 10 cm up: correctly resting on the base, and completely invisible. + // Resting on the base was the fix for an earlier bug where the produce + // hung level with the rim over a gap; the fix was right and the + // consequence -- that a deep basket then needs enough fruit to fill it + // -- was not followed through. + const layer = Math.floor(i / Math.max(3, Math.round(count * 0.38))) fruit.rotateX(jitter(random, 0.6)) fruit.rotateZ(jitter(random, 0.6)) fruit.translate( Math.sin(angle) * spread, // Base top + one radius = resting on the floor of the basket. - -half + config.height * 0.05 + size * (0.92 + layer * 1.5) + // Layers nest at 0.95 of a diameter, not 1.5: stacked fruit settles + // into the gaps of the layer below rather than sitting on top of it. + -half + config.height * 0.05 + size * (0.92 + layer * 0.95) - ring * size * 0.28 + jitter(random, size * 0.08), Math.cos(angle) * spread, ) @@ -217,8 +281,8 @@ export function createModel(overrides: Partial = {}) { } return { - weave: { slot: 'straw' as const, geometry: mergeColoured(pieces) }, - rim: { slot: 'straw' as const, geometry: rim }, + weave: { slot: 'oak' as const, geometry: mergeColoured(pieces) }, + rim: { slot: 'oak' as const, geometry: rim }, contents: contents.length > 0 ? { slot: 'produce' as const, geometry: mergeColoured(contents) } : undefined, diff --git a/scripts/verify-model.ts b/scripts/verify-model.ts index 1669ddb..5c6d3b7 100644 --- a/scripts/verify-model.ts +++ b/scripts/verify-model.ts @@ -382,7 +382,7 @@ const CASES: readonly Case[] = [ shellRatio: 0.8, variants: [{ coins: 0 }, { fill: 1 }, { coinRadius: 0.02 }], maxSize: [0.32, 0.14, 0.32] }, { id: 'wicker-basket', make: as(createBasket), patch: { stakes: 14, rows: 9 }, - parts: 3, ownSlot: 'produce', borrowSlot: 'straw', radial: true, radialPart: 'rim', + parts: 3, ownSlot: 'produce', borrowSlot: 'oak', radial: true, radialPart: 'rim', variants: [{ produce: 0 }, { taper: 0 }, { rows: 2 }], maxSize: [0.42, 0.32, 0.42] }, { id: 'log-pile', make: as(createLogPile), patch: { rows: 4, perRow: 7, variation: 0.4 }, diff --git a/src/models/medieval-kit/wicker-basket/model.ts b/src/models/medieval-kit/wicker-basket/model.ts index 967b18a..3982e61 100644 --- a/src/models/medieval-kit/wicker-basket/model.ts +++ b/src/models/medieval-kit/wicker-basket/model.ts @@ -56,12 +56,15 @@ export interface WickerBasketConfig { } export const wickerBasketDefaults: WickerBasketConfig = { - height: 0.21, + // Shallower and fuller. The reference is a bowl wider than it is deep, + // heaped until the fruit mounds over the rim -- which is the only state a + // fruit basket is ever drawn in. + height: 0.16, radius: 0.17, taper: 0.26, stakes: 11, rows: 6, - produce: 9, + produce: 15, hue: 0.02, seed: 97, } @@ -69,10 +72,10 @@ export const wickerBasketDefaults: WickerBasketConfig = { export type WickerBasketParts = 'weave' | 'rim' | 'contents' export function createModel(overrides: Partial = {}) { - return createKitModel({ + return createKitModel({ id: 'wicker-basket', defaults: wickerBasketDefaults, - slots: ['straw', 'produce'], + slots: ['oak', 'produce'], build: ({ config, random }) => { const tint = createTinter(random) const half = config.height / 2 @@ -114,7 +117,7 @@ export function createModel(overrides: Partial = {}) { const angle = (i / stakes) * Math.PI * 2 const stake = prismGeometry( withy * 0.42, withy * 0.36, config.height * 1.02, 4, - [0, 0, 0], tint('straw', -0.09, 1.2), + [0, 0, 0], tint('oak', -0.09 + 0.04, 1.2), ) // Bend first, move second: in a tapering basket the stakes lean too. stake.rotateX(Math.atan2(config.radius - bottomRadius, config.height)) @@ -124,6 +127,25 @@ export function createModel(overrides: Partial = {}) { pieces.push(stake) } + // Willow, not straw. + // + // The basket drew its colour from the `straw` palette entry and rendered + // at hue 41 with saturation 0.59; a photograph of a wicker basket sits at + // hue 29, saturation 0.50. It read as bright yellow plastic. The tuned + // `oak` entry is hue 26 / saturation 0.53 -- almost exactly the + // measurement -- and willow IS a wood, so the material slot moves with + // the colour. The lift keeps it at the pale, peeled end of oak rather + // than the dark structural end. + // + // The lift is 0.04 and that is nearly arbitrary: sweeping it over 0.00, + // 0.04 and 0.08 moved the measured hue and saturation by at most 0.01. + // It was first set to 0.12 on the reasoning that willow is paler than + // structural oak, which is true and which made the basket salmon pink -- + // raising HSL lightness holds saturation, so a saturated brown climbs + // towards peach rather than towards weathered willow. Against the + // reference the straw entry was off by 12 degrees of hue and 0.09 + // saturation; oak is off by 7 and 0.03. + // --- Horizontal weave ---------------------------------------------------- // TWO segments per vertical stake: `cos(stakes·θ)` is sampled exactly once // positive and once negative on every stake, so the wave is fully resolved @@ -135,12 +157,35 @@ export function createModel(overrides: Partial = {}) { // single-piece inner liner (below): six separate inner surfaces for six // hoops cost ~800 triangles, the liner costs 44, and from the inside the // difference is invisible. + // The weave stops BELOW the rim. Once the rows were made tall enough to + // meet each other they grew into the rim's band, and the outermost point + // of the undulation met the rim's inner facets in the same plane. The + // rim is a separate, thicker rod laid over the finished weave, so the + // weave ending under it is how the object is actually made. + const weaveSpan = config.height * 0.9 for (let r = 0; r < rows; r += 1) { const t = (r + 0.5) / rows - const y = -half + config.height * t + const y = -half + weaveSpan * t + // The band height is derived from the row count so that rows always + // MEET. It used to be a flat 0.11 of the height while the spacing + // between rows is 1/rows -- 0.167 at the default six -- which left a + // 12 mm gap you could see straight through to the contents. That is a + // slatted crate, not a weave. Rows now overlap slightly; they do not + // z-fight because consecutive rows are undulated half a wave apart, so + // where one bulges out its neighbour is tucked in. + // Alternate rows sit slightly proud of and slightly behind each other. + // This is how a weave really goes together -- the weaver's rod passes + // outside one stake and inside the next, so no two rows lie on the + // same cylinder -- and it is also what makes the overlap above safe. + // Undulating consecutive rows in antiphase is not enough on its own: + // a sine crosses zero, and at those nodes both rows returned to + // exactly `radiusAt(t)`. With a cylindrical basket (taper 0) every row + // shares that radius, so the overlapping bands met in coplanar faces + // at every node. + const lean = r % 2 === 0 ? withy * 0.2 : -withy * 0.2 const ring = bandGeometry( - radiusAt(t), y, config.height * 0.11, withy * 0.8, stakes * 2, - tint('straw', jitter(random, 0.07), 1.2), + radiusAt(t) + lean, y, (weaveSpan / rows) * 1.06, withy * 0.8, stakes * 2, + tint('oak', 0.04 + jitter(random, 0.07), 1.2), ) // The phase shifts by half a wave on every row: the next row going in // where the previous one came out is what makes a weave a weave. @@ -152,7 +197,7 @@ export function createModel(overrides: Partial = {}) { pieces.push(flipGeometry(latheGeometry([ { y: -half + config.height * 0.03, radius: bottomRadius * (1 - amplitude) }, { y: half - config.height * 0.02, radius: config.radius * (1 - amplitude) }, - ], stakes * 2, [0, 0, 0], tint('straw', -0.2, 1.1), { + ], stakes * 2, [0, 0, 0], tint('oak', 0.06, 1.1), { capTop: false, capBottom: false, }))) @@ -161,15 +206,24 @@ export function createModel(overrides: Partial = {}) { pieces.push(latheGeometry([ { y: -half - config.height * 0.01, radius: bottomRadius * 0.94 }, { y: -half + config.height * 0.05, radius: bottomRadius * 0.99 }, - ], stakes * 2, [0, 0, 0], tint('straw', -0.14, 1.2), { capTop: true })) + ], stakes * 2, [0, 0, 0], tint('oak', -0.14 + 0.04, 1.2), { capTop: true })) // --- Rim ----------------------------------------------------------------- // The thick bend that finishes the weave. It is the most visible detail on // the basket, and without it the edge looks "cut off". const rim = mergeColoured([ + // Thickness withy*2.1, not 1.5, and the reason is arithmetic rather + // than taste. At 1.5 the rim's inner surface landed at + // radius*1.015 - withy*1.5 = 0.16055, and the inner liner sits at + // radius*(1 - amplitude) = 0.16065 -- a tenth of a millimetre apart, + // by coincidence. On a cylindrical basket (taper 0) those are the same + // 22-sided prism and every facet of it z-fought. The thicker rod + // carries the inner face clearly past the liner, and it is the truer + // shape anyway: the rim is the heaviest rod in a basket, bent over the + // finished weave, and it stands proud on both sides. bandGeometry(config.radius * 1.015, half - config.height * 0.03, - config.height * 0.1, withy * 1.5, stakes * 2, - tint('straw', 0.07, 1.2), { inner: true }), + config.height * 0.1, withy * 2.1, stakes * 2, + tint('oak', 0.07 + 0.04, 1.2), { inner: true }), ]) // --- Contents ------------------------------------------------------------ @@ -203,13 +257,23 @@ export function createModel(overrides: Partial = {}) { const ring = Math.sqrt((i + 0.4) / count) const inner = Math.max(size, bottomRadius * 0.92 - size * 0.6) const spread = inner * ring - const layer = Math.floor(i / Math.max(3, Math.round(count * 0.55))) + // Fewer fruit per layer means MORE layers, and it is the layer count + // that decides whether the heap ever reaches the mouth. At 0.55 the + // default nine apples formed two layers topping out 12 cm below a rim + // 10 cm up: correctly resting on the base, and completely invisible. + // Resting on the base was the fix for an earlier bug where the produce + // hung level with the rim over a gap; the fix was right and the + // consequence -- that a deep basket then needs enough fruit to fill it + // -- was not followed through. + const layer = Math.floor(i / Math.max(3, Math.round(count * 0.38))) fruit.rotateX(jitter(random, 0.6)) fruit.rotateZ(jitter(random, 0.6)) fruit.translate( Math.sin(angle) * spread, // Base top + one radius = resting on the floor of the basket. - -half + config.height * 0.05 + size * (0.92 + layer * 1.5) + // Layers nest at 0.95 of a diameter, not 1.5: stacked fruit settles + // into the gaps of the layer below rather than sitting on top of it. + -half + config.height * 0.05 + size * (0.92 + layer * 0.95) - ring * size * 0.28 + jitter(random, size * 0.08), Math.cos(angle) * spread, ) @@ -217,8 +281,8 @@ export function createModel(overrides: Partial = {}) { } return { - weave: { slot: 'straw' as const, geometry: mergeColoured(pieces) }, - rim: { slot: 'straw' as const, geometry: rim }, + weave: { slot: 'oak' as const, geometry: mergeColoured(pieces) }, + rim: { slot: 'oak' as const, geometry: rim }, contents: contents.length > 0 ? { slot: 'produce' as const, geometry: mergeColoured(contents) } : undefined,