diff --git a/models.lock.json b/models.lock.json index 93e6788..2fee4ea 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-22T01:12:43.104Z", + "installedAt": "2026-08-22T04:53:30.952Z", "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-22T01:12:43.073Z", + "installedAt": "2026-08-22T04:53:30.926Z", "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-22T01:12:43.111Z", + "installedAt": "2026-08-22T04:53:30.957Z", "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-22T01:12:43.121Z", + "installedAt": "2026-08-22T04:53:30.965Z", "files": [], "dependencies": [] }, @@ -152,7 +152,7 @@ "address": "@medieval-kit/iron-anvil", "source": "file:my-registry/dist/registry.json", "version": "workspace", - "installedAt": "2026-08-22T01:12:43.085Z", + "installedAt": "2026-08-22T04:53:30.936Z", "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-22T01:12:43.108Z", + "installedAt": "2026-08-22T04:53:30.955Z", "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-22T01:12:43.113Z", + "installedAt": "2026-08-22T04:53:30.959Z", "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-22T01:12:43.114Z", + "installedAt": "2026-08-22T04:53:30.960Z", "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-22T01:12:43.116Z", + "installedAt": "2026-08-22T04:53:30.961Z", "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-22T01:12:43.117Z", + "installedAt": "2026-08-22T04:53:30.963Z", "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-22T01:12:43.119Z", + "installedAt": "2026-08-22T04:53:30.964Z", "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-22T01:12:43.121Z", + "installedAt": "2026-08-22T04:53:30.965Z", "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-22T01:12:43.078Z", + "installedAt": "2026-08-22T04:53:30.930Z", "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-22T01:12:43.092Z", + "installedAt": "2026-08-22T04:53:30.942Z", "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-22T01:12:43.101Z", + "installedAt": "2026-08-22T04:53:30.949Z", "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-22T01:12:43.109Z", + "installedAt": "2026-08-22T04:53:30.956Z", "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-22T01:12:43.083Z", + "installedAt": "2026-08-22T04:53:30.935Z", "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-22T01:12:43.096Z", + "installedAt": "2026-08-22T04:53:30.945Z", "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-22T01:12:43.106Z", + "installedAt": "2026-08-22T04:53:30.954Z", "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-22T01:12:43.091Z", + "installedAt": "2026-08-22T04:53:30.941Z", "files": [ { "path": "src\\models\\medieval-kit\\linen-sack\\model.ts", @@ -392,11 +392,11 @@ "address": "@medieval-kit/oak-tankard", "source": "file:my-registry/dist/registry.json", "version": "workspace", - "installedAt": "2026-08-22T01:12:43.094Z", + "installedAt": "2026-08-22T04:53:30.944Z", "files": [ { "path": "src\\models\\medieval-kit\\oak-tankard\\model.ts", - "sourceHash": "22c46f2233b1f8a80bf7bd2c7c4bdeb7afd791c44a88af07936d4ff7660de5f5" + "sourceHash": "a69881fd29e3dafdedb7786da13892ee69e1be058994eeef9ff27bca6ae4033d" } ], "dependencies": [ @@ -407,7 +407,7 @@ "address": "@medieval-kit/straw-broom", "source": "file:my-registry/dist/registry.json", "version": "workspace", - "installedAt": "2026-08-22T01:12:43.098Z", + "installedAt": "2026-08-22T04:53:30.947Z", "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-22T01:12:43.077Z", + "installedAt": "2026-08-22T04:53:30.929Z", "files": [ { "path": "src\\models\\medieval-kit\\bronze-bell\\model.ts", @@ -437,11 +437,11 @@ "address": "@medieval-kit/iron-lantern", "source": "file:my-registry/dist/registry.json", "version": "workspace", - "installedAt": "2026-08-22T01:12:43.087Z", + "installedAt": "2026-08-22T04:53:30.938Z", "files": [ { "path": "src\\models\\medieval-kit\\iron-lantern\\model.ts", - "sourceHash": "217ed35060890b97ed51e299e217ce9029ffd947a67f406a18c5b7f215cdbda9" + "sourceHash": "8e6f2101e85362a7073bbd0612f28ddd12477679b56310cddc48801f0539db96" } ], "dependencies": [ @@ -452,7 +452,7 @@ "address": "@medieval-kit/tavern-sign", "source": "file:my-registry/dist/registry.json", "version": "workspace", - "installedAt": "2026-08-22T01:12:43.099Z", + "installedAt": "2026-08-22T04:53:30.948Z", "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-22T01:12:43.080Z", + "installedAt": "2026-08-22T04:53:30.932Z", "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-22T01:12:43.082Z", + "installedAt": "2026-08-22T04:53:30.934Z", "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-22T01:12:43.089Z", + "installedAt": "2026-08-22T04:53:30.939Z", "files": [ { "path": "src\\models\\medieval-kit\\leather-book\\model.ts", @@ -512,7 +512,7 @@ "address": "@medieval-kit/wicker-basket", "source": "file:my-registry/dist/registry.json", "version": "workspace", - "installedAt": "2026-08-22T01:12:43.103Z", + "installedAt": "2026-08-22T04:53:30.951Z", "files": [ { "path": "src\\models\\medieval-kit\\wicker-basket\\model.ts", diff --git a/my-registry/models/iron-lantern/model.ts b/my-registry/models/iron-lantern/model.ts index 0cd2f47..a1de43a 100644 --- a/my-registry/models/iron-lantern/model.ts +++ b/my-registry/models/iron-lantern/model.ts @@ -19,6 +19,7 @@ import type { BufferGeometry } from 'three' import { + arcBarGeometry, bandGeometry, boxGeometry, createKitModel, @@ -165,20 +166,41 @@ export function createModel(overrides: Partial = {}) { { colourTop: tint('emberTip', 0.02, 0.35) }), ]) - // --- Carrying hoop ---------------------------------------------------------- - const handle: BufferGeometry[] = [bandGeometry( - config.radius * 0.3, half + config.height * 0.1, bar * 0.9, bar * 0.55, 8, - tint('iron', 0.06, 0.7), { inner: true }, + // --- Carrying bail ---------------------------------------------------------- + // A vertical arch, not a horizontal ring. + // + // What was here was a `bandGeometry` -- a flat hoop lying in the XZ + // plane on top of the flue. That is a suspension eye, and against a + // photograph of a real lantern it reads as a collar rather than as + // anything you could pick the lantern up by. A lantern's defining + // feature is that it is CARRIED: the bail is the first thing the eye + // looks for and the reason the object exists in a scene at all. + // + // `arcBarGeometry` builds in the XY plane, which for a half-circle from + // 0 to PI is already the shape wanted -- ends level, apex overhead -- + // so no rotation is involved. + // The sweep runs PAST half a circle at both ends, by about 20 degrees. + // A clean half-circle put the two ends level with the roof's surface and + // merely tangent to it, which the support check rightly called floating. + // Carrying the arc further round turns each end downwards and outwards, + // so it crosses the roof cone from inside to outside and is genuinely + // embedded -- the same "real carpentry rather than a nudge" rule the + // rest of the kit follows for joints. + const bailRadius = config.radius * 0.78 + const handle: BufferGeometry[] = [arcBarGeometry( + bailRadius, + bar * 1.05, + -0.35, + Math.PI + 0.35, + 11, + [0, half - config.height * 0.145, 0], + tint('iron', 0.06, 0.7), )] - // The tongue joining the hoop to the flue. - handle.push(boxGeometry( - // Wide enough to reach the ring it carries. A tongue the width of the - // bar passed straight through the middle of the ring without touching - // it, so the handle hung above the lantern unattached. - [config.radius * 0.82, config.height * 0.1, bar], - [0, half + config.height * 0.045, 0], - tint('iron', 0.02, 0.7), - )) + // The tongue that used to join the old horizontal ring down to the flue + // is gone with the ring. Left in place it z-fought the new bail: its + // sides sat at z = +-0.00488 against the bail's +-0.00512, a quarter of + // a millimetre apart over the whole apex. A bail that reaches into the + // roof needs no strap to hold it on. return { frame: { diff --git a/my-registry/models/oak-tankard/model.ts b/my-registry/models/oak-tankard/model.ts index 50454e1..a654524 100644 --- a/my-registry/models/oak-tankard/model.ts +++ b/my-registry/models/oak-tankard/model.ts @@ -16,8 +16,8 @@ import type { BufferGeometry } from 'three' import { + arcBarGeometry, bandGeometry, - bendGeometry, boxGeometry, createKitModel, createTinter, @@ -45,8 +45,8 @@ export interface OakTankardConfig { } export const oakTankardDefaults: OakTankardConfig = { - height: 0.175, - radius: 0.047, + height: 0.162, + radius: 0.056, taper: 0.05, staveCount: 10, hoopCount: 2, @@ -109,33 +109,39 @@ export function createModel(overrides: Partial = {}) { // --- Handle -------------------------------------------------------------- let handle: BufferGeometry | undefined if (config.handle >= 0.5) { + // Built as a real arc, not as a bent box. + // + // The previous version made a flat `boxGeometry` strap and put it + // through `bendGeometry`, then pushed it clear of the body by a + // hand-derived offset: `(1 - cos(span/2 * k)) / k`. Measured, the + // result was a handle whose outermost point stood 7 mm proud of a + // body 47 mm in radius, with the rest of it buried in the stave wall. + // There was no finger gap at all -- it read as a plank glued to the + // side, which is exactly what it was. The offset formula did not + // describe what `bendGeometry` actually does to the geometry. + // + // So this does not compute a correction for a curve it cannot see. + // `arcBarGeometry` produces the arc directly, and the arc is specified + // by the two things that actually matter: where its ends land, and how + // far its belly stands off the body. const span = config.height * 0.72 - const strap = boxGeometry( - [config.radius * 0.3, span, thickness * 1.1], + // Ends land INSIDE the stave wall, so the joint is an overlap. + const endDepth = config.radius - thickness * 1.1 + const arcRadius = Math.hypot(span / 2, endDepth) + const halfAngle = Math.atan2(span / 2, endDepth) + const strap = arcBarGeometry( + arcRadius, + thickness * 1.5, + -halfAngle, + halfAngle, + 7, [0, 0, 0], tint('oak', -0.05), ) - // The flat strap curves outwards away from the body. Because the centre - // of the curve is at the origin, both ends come back towards the body — - // that is exactly where the impression of a handle gripping the body - // comes from. - bendGeometry(strap, -2.05 / span) - // The offset is found by calculation, not by eye: the bend leaves the - // midpoint of the arc in place and pulls its ENDS back, so if the - // middle of the handle is not pushed far enough away from the body it - // is not the ends but the MIDDLE that ends up inside the stave. On the - // first attempt the handle was completely invisible. - // - // Half-angle a = (span/2)·k, the ends pull back by (1−cos a)/k. - const drop = (1 - Math.cos(span * 0.5 * (2.05 / span))) / (2.05 / span) - strap.translate(0, 0, config.radius + drop + thickness * 0.6) - // Small pegs so that both ends go INSIDE the body. - const pegs = [1, -1].map((sign) => boxGeometry( - [config.radius * 0.3, thickness * 1.6, config.radius * 0.55], - [0, sign * span * 0.42, config.radius * 0.88], - tint('oak', -0.1), - )) - handle = mergeColoured([strap, ...pegs]) + // The arc is built in the XY plane; -90 degrees about Y carries its + // +X into +Z, standing it up beside the body with its span along Y. + strap.rotateY(-Math.PI / 2) + handle = mergeColoured([strap]) } return { diff --git a/src/models/medieval-kit/iron-lantern/model.ts b/src/models/medieval-kit/iron-lantern/model.ts index 0cd2f47..a1de43a 100644 --- a/src/models/medieval-kit/iron-lantern/model.ts +++ b/src/models/medieval-kit/iron-lantern/model.ts @@ -19,6 +19,7 @@ import type { BufferGeometry } from 'three' import { + arcBarGeometry, bandGeometry, boxGeometry, createKitModel, @@ -165,20 +166,41 @@ export function createModel(overrides: Partial = {}) { { colourTop: tint('emberTip', 0.02, 0.35) }), ]) - // --- Carrying hoop ---------------------------------------------------------- - const handle: BufferGeometry[] = [bandGeometry( - config.radius * 0.3, half + config.height * 0.1, bar * 0.9, bar * 0.55, 8, - tint('iron', 0.06, 0.7), { inner: true }, + // --- Carrying bail ---------------------------------------------------------- + // A vertical arch, not a horizontal ring. + // + // What was here was a `bandGeometry` -- a flat hoop lying in the XZ + // plane on top of the flue. That is a suspension eye, and against a + // photograph of a real lantern it reads as a collar rather than as + // anything you could pick the lantern up by. A lantern's defining + // feature is that it is CARRIED: the bail is the first thing the eye + // looks for and the reason the object exists in a scene at all. + // + // `arcBarGeometry` builds in the XY plane, which for a half-circle from + // 0 to PI is already the shape wanted -- ends level, apex overhead -- + // so no rotation is involved. + // The sweep runs PAST half a circle at both ends, by about 20 degrees. + // A clean half-circle put the two ends level with the roof's surface and + // merely tangent to it, which the support check rightly called floating. + // Carrying the arc further round turns each end downwards and outwards, + // so it crosses the roof cone from inside to outside and is genuinely + // embedded -- the same "real carpentry rather than a nudge" rule the + // rest of the kit follows for joints. + const bailRadius = config.radius * 0.78 + const handle: BufferGeometry[] = [arcBarGeometry( + bailRadius, + bar * 1.05, + -0.35, + Math.PI + 0.35, + 11, + [0, half - config.height * 0.145, 0], + tint('iron', 0.06, 0.7), )] - // The tongue joining the hoop to the flue. - handle.push(boxGeometry( - // Wide enough to reach the ring it carries. A tongue the width of the - // bar passed straight through the middle of the ring without touching - // it, so the handle hung above the lantern unattached. - [config.radius * 0.82, config.height * 0.1, bar], - [0, half + config.height * 0.045, 0], - tint('iron', 0.02, 0.7), - )) + // The tongue that used to join the old horizontal ring down to the flue + // is gone with the ring. Left in place it z-fought the new bail: its + // sides sat at z = +-0.00488 against the bail's +-0.00512, a quarter of + // a millimetre apart over the whole apex. A bail that reaches into the + // roof needs no strap to hold it on. return { frame: { diff --git a/src/models/medieval-kit/oak-tankard/model.ts b/src/models/medieval-kit/oak-tankard/model.ts index 50454e1..a654524 100644 --- a/src/models/medieval-kit/oak-tankard/model.ts +++ b/src/models/medieval-kit/oak-tankard/model.ts @@ -16,8 +16,8 @@ import type { BufferGeometry } from 'three' import { + arcBarGeometry, bandGeometry, - bendGeometry, boxGeometry, createKitModel, createTinter, @@ -45,8 +45,8 @@ export interface OakTankardConfig { } export const oakTankardDefaults: OakTankardConfig = { - height: 0.175, - radius: 0.047, + height: 0.162, + radius: 0.056, taper: 0.05, staveCount: 10, hoopCount: 2, @@ -109,33 +109,39 @@ export function createModel(overrides: Partial = {}) { // --- Handle -------------------------------------------------------------- let handle: BufferGeometry | undefined if (config.handle >= 0.5) { + // Built as a real arc, not as a bent box. + // + // The previous version made a flat `boxGeometry` strap and put it + // through `bendGeometry`, then pushed it clear of the body by a + // hand-derived offset: `(1 - cos(span/2 * k)) / k`. Measured, the + // result was a handle whose outermost point stood 7 mm proud of a + // body 47 mm in radius, with the rest of it buried in the stave wall. + // There was no finger gap at all -- it read as a plank glued to the + // side, which is exactly what it was. The offset formula did not + // describe what `bendGeometry` actually does to the geometry. + // + // So this does not compute a correction for a curve it cannot see. + // `arcBarGeometry` produces the arc directly, and the arc is specified + // by the two things that actually matter: where its ends land, and how + // far its belly stands off the body. const span = config.height * 0.72 - const strap = boxGeometry( - [config.radius * 0.3, span, thickness * 1.1], + // Ends land INSIDE the stave wall, so the joint is an overlap. + const endDepth = config.radius - thickness * 1.1 + const arcRadius = Math.hypot(span / 2, endDepth) + const halfAngle = Math.atan2(span / 2, endDepth) + const strap = arcBarGeometry( + arcRadius, + thickness * 1.5, + -halfAngle, + halfAngle, + 7, [0, 0, 0], tint('oak', -0.05), ) - // The flat strap curves outwards away from the body. Because the centre - // of the curve is at the origin, both ends come back towards the body — - // that is exactly where the impression of a handle gripping the body - // comes from. - bendGeometry(strap, -2.05 / span) - // The offset is found by calculation, not by eye: the bend leaves the - // midpoint of the arc in place and pulls its ENDS back, so if the - // middle of the handle is not pushed far enough away from the body it - // is not the ends but the MIDDLE that ends up inside the stave. On the - // first attempt the handle was completely invisible. - // - // Half-angle a = (span/2)·k, the ends pull back by (1−cos a)/k. - const drop = (1 - Math.cos(span * 0.5 * (2.05 / span))) / (2.05 / span) - strap.translate(0, 0, config.radius + drop + thickness * 0.6) - // Small pegs so that both ends go INSIDE the body. - const pegs = [1, -1].map((sign) => boxGeometry( - [config.radius * 0.3, thickness * 1.6, config.radius * 0.55], - [0, sign * span * 0.42, config.radius * 0.88], - tint('oak', -0.1), - )) - handle = mergeColoured([strap, ...pegs]) + // The arc is built in the XY plane; -90 degrees about Y carries its + // +X into +Z, standing it up beside the body with its span along Y. + strap.rotateY(-Math.PI / 2) + handle = mergeColoured([strap]) } return {