{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "gatehouse",
  "type": "registry:component",
  "title": "Gatehouse with boom barrier",
  "description": "Site security gatehouse on a kerbed island with striped ends. The glazed guard hut has solid lower panels, mullions, a part-glazed door, a flat roof with a canopy over the lane, a SECURITY fascia and an inside counter with monitors and a chair. Outside are a wall-mounted AC condenser, a CCTV and floodlight pole, an automatic boom barrier cabinet with bollards and earth bond, a red and white boom with a rubber skirt, a rest post across the lane, a stop line and a road hump. `open` raises the boom.",
  "dependencies": [
    "three",
    "@react-three/fiber",
    "@react-three/drei"
  ],
  "registryDependencies": [
    "https://deck-twin-library.demoareeb.workers.dev/r/core.json"
  ],
  "files": [
    {
      "path": "onshore/gatehouse.tsx",
      "type": "registry:file",
      "target": "components/deck-twin/onshore/gatehouse.tsx",
      "content": "// Site gatehouse: glazed guard hut on a kerbed island with flat roof canopy, plus an automatic boom barrier with rest post. EN 12453, EN 13241.\nimport * as THREE from 'three'\nimport type { Kit } from '../lib/kit'\nimport { KitMesh, useKit, type GroupProps } from '../lib/mesh'\nimport { tagPlate } from '../lib/parts'\nimport { paint } from '../lib/materials'\nimport { hazardStripeMaterial, textMaterial } from '../lib/textures'\nimport { anchorBolt, clamp, earthBond } from './_onshore'\n\nexport interface GatehouseProps {\n  /** clear lane width spanned by the boom, m */\n  laneWidth?: number\n  /** boom, 0 down … 1 raised */\n  open?: number\n  tag?: string\n}\n\nexport const defaults = { laneWidth: 5, open: 0, tag: '' }\n\nconst HUT = { x: 3.2, z: 2.4, h: 2.7 }\nconst ISL = { x: 6.0, z: 3.4, h: 0.15 }\n\nexport function Gatehouse(props: GatehouseProps & GroupProps) {\n  const { laneWidth, open, tag, ...group } = { ...defaults, ...props }\n  const lw = clamp(laneWidth, 3, 8)\n  const fixed = useKit((k) => build(k, lw, tag), [lw, tag])\n  const boom = useKit((k) => buildBoom(k, lw), [lw])\n  const pivot: [number, number, number] = [1.9, ISL.h + 1.0, ISL.z / 2 - 0.25]\n  return (\n    <group {...group}>\n      <KitMesh data={fixed} />\n      <group position={pivot} rotation-x={-(clamp(open, 0, 1) * Math.PI) / 2}>\n        <KitMesh data={boom} />\n      </group>\n    </group>\n  )\n}\n\nexport default Gatehouse\n\nfunction buildBoom(k: Kit, lw: number) {\n  // white aluminium boom with red bands, rubber skirt edge, pivot hub\n  const L = lw + 0.5\n  const red = paint('#c3221a', { clearcoat: 0.4 })\n  k.cyl('stainless', 0.09, 0.12, [0, 0, 0], 'x', 20)\n  const n = Math.round(L / 0.5)\n  for (let i = 0; i < n; i++) k.box(i % 2 ? red : paint('#f2f2ee', { clearcoat: 0.4 }), [0.07, 0.11, L / n], [0.07, 0, 0.1 + (i + 0.5) * (L / n)])\n  k.box('rubberBlack', [0.05, 0.03, L], [0.07, -0.07, 0.1 + L / 2])\n  k.cyl('lampLens', 0.02, 0.02, [0.11, 0.0, L * 0.5], 'x', 10)\n}\n\nfunction build(k: Kit, lw: number, tag: string) {\n  const top = ISL.h\n  // kerbed island with striped ends\n  k.box('concrete', [ISL.x, top, ISL.z], [0, top / 2, 0])\n  for (const s of [-1, 1]) {\n    const g = new THREE.BoxGeometry(0.3, top + 0.002, ISL.z + 0.002)\n    const uv = g.getAttribute('uv') as THREE.BufferAttribute\n    for (let j = 0; j < uv.count; j++) uv.setXY(j, uv.getX(j) * 6, uv.getY(j) * 0.4)\n    k.add(hazardStripeMaterial(), g, new THREE.Matrix4().makeTranslation(s * (ISL.x / 2 - 0.15), top / 2, 0))\n  }\n  // hut: plinth, solid lower panels, full-height glazing with mullions, door on the -X side\n  const hx = -0.9\n  const wall = paint('#e3e4df', { metalness: 0.2, roughness: 0.5 })\n  const frame = paint('#3e4a52', { metalness: 0.3, roughness: 0.5 })\n  const y0 = top\n  const h = HUT.h\n  const t = 0.1\n  const sill = 1.0\n  const sides: [number, number, number, number][] = [\n    [hx, HUT.z / 2 - t / 2, HUT.x, 0],\n    [hx, -HUT.z / 2 + t / 2, HUT.x, 0],\n    [hx + HUT.x / 2 - t / 2, 0, HUT.z, 1],\n    [hx - HUT.x / 2 + t / 2, 0, HUT.z, 1],\n  ]\n  for (const [cx, cz, len, alongZ] of sides) {\n    const size = (a: number, hh: number): [number, number, number] => (alongZ ? [t, hh, a] : [a, hh, t])\n    const isDoor = alongZ && cx < hx\n    if (isDoor) {\n      // door leaf and side panel\n      k.box(wall, size(len - 1.0, sill), [cx, y0 + sill / 2, cz + 0.5])\n      k.box('glass', size(len - 1.0, 2.2 - sill), [cx, y0 + sill + (2.2 - sill) / 2, cz + 0.5])\n      k.box(paint('#7a8a96'), size(0.95, 2.1), [cx - 0.01, y0 + 1.05, cz - len / 2 + 0.5])\n      k.box('glass', size(0.6, 0.8), [cx - 0.04, y0 + 1.45, cz - len / 2 + 0.5])\n      k.box('stainless', [0.04, 0.03, 0.14], [cx - 0.08, y0 + 1.0, cz - len / 2 + 0.85])\n    } else {\n      k.box(wall, size(len, sill), [cx, y0 + sill / 2, cz])\n      k.box('glass', size(len, 2.3 - sill), [cx, y0 + sill + (2.3 - sill) / 2, cz])\n      const nm = Math.max(1, Math.round(len / 1.0))\n      for (let i = 0; i <= nm; i++) {\n        const o = -len / 2 + (i * len) / nm\n        k.box(frame, alongZ ? [t + 0.02, 2.3 - sill, 0.05] : [0.05, 2.3 - sill, t + 0.02], alongZ ? [cx, y0 + sill + (2.3 - sill) / 2, cz + o] : [cx + o, y0 + sill + (2.3 - sill) / 2, cz])\n      }\n    }\n    k.box(wall, size(len, h - 2.3), [cx, y0 + 2.3 + (h - 2.3) / 2, cz])\n    k.box(frame, size(len + 0.02, 0.05), [cx, y0 + sill, cz])\n  }\n  k.box(paint('#9a9c97'), [HUT.x - 2 * t, 0.02, HUT.z - 2 * t], [hx, y0 + 0.01, 0])\n  // flat roof with canopy overhang over the lane side, fascia, rain outlets\n  k.box(wall, [HUT.x + 1.0, 0.25, HUT.z + 1.4], [hx, y0 + h + 0.125, 0.2])\n  k.box(frame, [HUT.x + 1.04, 0.08, HUT.z + 1.44], [hx, y0 + h + 0.29, 0.2])\n  k.plane(textMaterial('SECURITY', '#1f4e9a', '#ffffff', 512, 96), 1.6, 0.22, [hx, y0 + h + 0.125, HUT.z / 2 + 0.9 + 0.001])\n  k.cyl(frame, 0.04, h + 0.1, [hx - HUT.x / 2 - 0.3, y0 + (h + 0.1) / 2, HUT.z / 2 + 0.6], 'y', 10)\n  // interior: counter along the lane window, monitors, chair\n  k.box(paint('#cfc7b6'), [HUT.x - 0.5, 0.05, 0.6], [hx + 0.1, y0 + 0.78, HUT.z / 2 - 0.4])\n  k.box(paint('#8e8e88'), [HUT.x - 0.5, 0.75, 0.04], [hx + 0.1, y0 + 0.375, HUT.z / 2 - 0.68])\n  for (const dx of [-0.4, 0.3]) {\n    k.box(paint('#1b1d20'), [0.5, 0.32, 0.03], [hx + dx, y0 + 1.05, HUT.z / 2 - 0.45])\n    k.box(paint('#1b1d20'), [0.05, 0.12, 0.05], [hx + dx, y0 + 0.86, HUT.z / 2 - 0.45])\n  }\n  k.cyl(paint('#2c2f33'), 0.22, 0.06, [hx, y0 + 0.48, HUT.z / 2 - 1.0], 'y', 16)\n  k.cyl('stainless', 0.025, 0.45, [hx, y0 + 0.23, HUT.z / 2 - 1.0], 'y', 8)\n  // wall-mounted AC condenser at the rear, CCTV camera and floodlight on a pole\n  k.rbox(paint('#e6e7e3'), [0.8, 0.55, 0.3], 0.02, [hx, y0 + 0.7, -HUT.z / 2 - 0.2])\n  k.cyl(paint('#3a3f44'), 0.2, 0.01, [hx - 0.12, y0 + 0.7, -HUT.z / 2 - 0.05 + 0.0], 'z', 24)\n  const px = ISL.x / 2 - 0.6\n  const pz = -ISL.z / 2 + 0.4\n  k.box('galvanised', [0.3, 0.02, 0.3], [px, top + 0.01, pz])\n  for (const a of [-1, 1]) for (const b of [-1, 1]) anchorBolt(k, [px + a * 0.11, top + 0.02, pz + b * 0.11], 0.016)\n  k.cyl('galvanised', 0.06, 5.0, [px, top + 2.52, pz], 'y', 12)\n  k.rbox(paint('#e6e7e3'), [0.3, 0.12, 0.12], 0.02, [px - 0.1, top + 4.6, pz + 0.1])\n  k.rbox('aluminium', [0.4, 0.08, 0.3], 0.02, [px, top + 5.0, pz + 0.15])\n  k.box('lampLens', [0.35, 0.01, 0.25], [px, top + 4.955, pz + 0.15])\n  // boom barrier cabinet with bollards, rest post across the lane, stop line and road hump\n  const bx = 1.9\n  const bz = ISL.z / 2 - 0.25\n  k.rbox(paint('#e5b114', { clearcoat: 0.4 }), [0.32, 1.0, 0.34], 0.03, [bx + 0.18, top + 0.5, bz])\n  k.box('stainless', [0.3, 0.02, 0.32], [bx + 0.18, top + 1.01, bz])\n  k.box('nut', [0.36, 0.08, 0.4], [bx + 0.18, top + 0.04, bz])\n  earthBond(k, [bx + 0.34, top + 0.2, bz], [1, 0, 0], top, 0.25)\n  for (const dx of [-0.35, 0.7]) {\n    k.cyl(paint('#e5b114'), 0.08, 1.0, [bx + dx, top + 0.5, bz - 0.1], 'y', 14)\n    k.dome(paint('#e5b114'), 0.08, [bx + dx, top + 1.0, bz - 0.1], 'y')\n  }\n  const rz = ISL.z / 2 + lw + 0.25\n  k.box('concrete', [0.4, 0.1, 0.4], [bx, 0.05, rz])\n  k.box(paint('#f2f2ee'), [0.08, 0.95, 0.08], [bx + 0.07, 0.1 + 0.475, rz])\n  k.box(paint('#c3221a'), [0.1, 0.12, 0.1], [bx + 0.07, 0.85, rz])\n  for (const s of [-1, 1]) k.box('rubberBlack', [0.03, 0.15, 0.04], [bx + 0.07 + s * 0.06, 1.1, rz])\n  k.box(paint('#f2f2ee', { metalness: 0, roughness: 0.8, clearcoat: 0 }), [0.3, 0.004, lw], [bx - 1.2, 0.002, ISL.z / 2 + lw / 2])\n  const hump = new THREE.BoxGeometry(0.6, 0.06, lw)\n  const uv = hump.getAttribute('uv') as THREE.BufferAttribute\n  for (let j = 0; j < uv.count; j++) uv.setXY(j, uv.getX(j) * 1, uv.getY(j) * lw * 2)\n  k.add(hazardStripeMaterial(), hump, new THREE.Matrix4().makeTranslation(-4.2, 0.03, ISL.z / 2 + lw / 2))\n  k.plane(textMaterial('STOP', '#c3221a', '#ffffff', 256, 128), 0.6, 0.3, [bx + 0.18, top + 0.8, bz + 0.171])\n  if (tag) tagPlate(k, tag, [hx + HUT.x / 2 + 0.001, top + 0.6, 0], 'x', 0.3)\n}\n"
    },
    {
      "path": "onshore/_onshore.ts",
      "type": "registry:file",
      "target": "components/deck-twin/onshore/_onshore.ts",
      "content": "// Shared onshore parts: plinths, anchor bolts, earth bonds, ISO 14122 stairs, shedded insulators, lattice steel and swivel joints.\nimport * as THREE from 'three'\nimport { axisVec, type Axis, type Kit, type MatKey, type V3 } from '../lib/kit'\nimport { paint } from '../lib/materials'\nimport { grating, handrail, member } from '../lib/parts'\nimport { stairFlight } from '../lib/standards'\n\nexport const add = (a: V3, b: V3, s = 1): V3 => [a[0] + b[0] * s, a[1] + b[1] * s, a[2] + b[2] * s]\nexport const deg = (d: number) => (d * Math.PI) / 180\nexport const clamp = (v: number, a: number, b: number) => Math.min(b, Math.max(a, v))\n\nexport const porcelain = () => paint('#6e3420', { metalness: 0.05, roughness: 0.12, clearcoat: 0.9, clearcoatRoughness: 0.1, weather: 0 })\nexport const silicone = () => paint('#8b9399', { metalness: 0, roughness: 0.55, clearcoat: 0.2, clearcoatRoughness: 0.5, weather: 0.3 })\nexport const earthLead = () => paint('#5c9e33', { metalness: 0, roughness: 0.6, clearcoat: 0, weather: 0 })\nexport const lightGrey = () => paint('#cfd2cf', { metalness: 0.2, roughness: 0.5, clearcoat: 0.25, weather: 1 })\n\n/** Concrete plinth from y0 up to y0 + h with a small arris, centred on (cx, cz). */\nexport function plinth(k: Kit, cx: number, cz: number, sx: number, sz: number, h: number, y0 = 0) {\n  const c = Math.min(0.025, h * 0.2)\n  k.box('concrete', [sx, h - c, sz], [cx, y0 + (h - c) / 2, cz])\n  k.box('concrete', [sx - 2 * c, c, sz - 2 * c], [cx, y0 + h - c / 2, cz])\n}\n\n/** Cast-in anchor bolt standing on a surface at p: washer, double nut, projecting thread. */\nexport function anchorBolt(k: Kit, p: V3, dia = 0.024) {\n  k.cyl('galvanised', dia * 1.1, 0.005, [p[0], p[1] + 0.0025, p[2]], 'y', 12)\n  k.hex('nut', dia * 1.85, dia * 0.9, [p[0], p[1] + 0.005 + dia * 0.45, p[2]])\n  k.hex('nut', dia * 1.85, dia * 0.9, [p[0], p[1] + 0.005 + dia * 1.4, p[2]])\n  k.cyl('boltXylan', dia / 2, dia * 2.6, [p[0], p[1] + dia * 1.3, p[2]], 'y', 8)\n}\n\n/** Steel base plate with its top at y, on a grout bed, anchored near each corner. */\nexport function basePlate(k: Kit, cx: number, y: number, cz: number, sx: number, sz: number, t = 0.025, dia = 0.024, mat: MatKey = 'galvanised') {\n  k.box(mat, [sx, t, sz], [cx, y - t / 2, cz])\n  const ix = sx / 2 - dia * 2.2\n  const iz = sz / 2 - dia * 2.2\n  for (const a of [-1, 1]) for (const b of [-1, 1]) anchorBolt(k, [cx + a * ix, y, cz + b * iz], dia)\n}\n\n/** Earth boss with a bolted lug and a green/yellow bonding lead down to an inspection pit at grade. */\nexport function earthBond(k: Kit, pos: V3, out: V3, ground = 0, pitOffset = 0.3) {\n  const o = new THREE.Vector3(...out).normalize().toArray() as V3\n  k.cyl('brass', 0.017, 0.03, add(pos, o, 0.015), o, 10)\n  k.box('copper', [0.03, 0.05, 0.004], add(add(pos, o, 0.032), [0, -0.012, 0]), o)\n  k.hex('nut', 0.022, 0.012, add(pos, o, 0.04), o)\n  const lug = add(add(pos, o, 0.035), [0, -0.035, 0])\n  const pit: V3 = [pos[0] + o[0] * pitOffset, ground, pos[2] + o[2] * pitOffset]\n  if (pos[1] - ground > 0.12) {\n    k.spline(earthLead(), [lug, add(lug, [0, -0.08, 0]), add([pit[0], ground + 0.25, pit[2]], o, -pitOffset * 0.3), [pit[0], ground + 0.1, pit[2]], [pit[0], ground + 0.03, pit[2]]], 0.0065, 6, 24)\n    k.cyl('concrete', 0.14, 0.05, [pit[0], ground + 0.025, pit[2]], 'y', 16)\n    k.cyl('castIron', 0.1, 0.008, [pit[0], ground + 0.054, pit[2]], 'y', 16)\n  }\n}\n\n/** ISO 14122-3 straight stair: first riser at `foot`, climbing along `dir` by `rise`. Channel stringers, grating treads, handrails. Returns the horizontal run. */\nexport function stair(k: Kit, foot: V3, dir: Axis, rise: number, width = 0.9, rails: 'both' | 'left' | 'right' | 'none' = 'both') {\n  const f = stairFlight(rise)\n  const n = f.steps\n  const g = f.going\n  const q = new THREE.Quaternion().setFromUnitVectors(new THREE.Vector3(1, 0, 0), axisVec(dir).setY(0).normalize())\n  const w = width / 2\n  const slope = f.riser / g\n  k.with(new THREE.Matrix4().compose(new THREE.Vector3(...foot), q, new THREE.Vector3(1, 1, 1)), () => {\n    const sd = 0.18\n    const yAt = (x: number) => f.riser + x * slope - 0.07\n    const x0 = (sd * 0.45 + 0.07 - f.riser) / slope\n    const run = (n - 1) * g\n    for (const s of [-1, 1]) {\n      const z = s * (w + 0.04)\n      member(k, [x0, yAt(x0), z], [run, yAt(run), z], 'UPN 180', 'galvanised', [-slope, 1, 0])\n      k.box('galvanised', [0.22, 0.015, 0.16], [x0 + 0.06, 0.0075, z])\n    }\n    for (let i = 1; i < n; i++) {\n      const y = i * f.riser\n      grating(k, [(i - 1) * g + g / 2 + 0.0125, y, 0], g + 0.025, width)\n      k.box('safetyYellow', [0.03, 0.032, width], [(i - 1) * g + 0.015, y - 0.016, 0])\n    }\n    const pts = (z: number): V3[] => [[0, f.riser * 0.5, z], [run, rise, z]]\n    if (rails === 'both' || rails === 'left') handrail(k, pts(w + 0.04), 'safetyYellow')\n    if (rails === 'both' || rails === 'right') handrail(k, pts(-w - 0.04), 'safetyYellow')\n  })\n  return (n - 1) * g\n}\n\n/** Shedded post insulator from `base` along `axis` for L: galvanised end caps, alternating sheds of radius ~2.2 r. */\nexport function insulator(k: Kit, base: V3, L: number, r: number, mat: MatKey, axis: Axis = 'y') {\n  const v = axisVec(axis).toArray() as V3\n  const cap = Math.min(0.08, L * 0.08)\n  const prof: [number, number][] = [[0, cap], [r, cap]]\n  const body = L - 2 * cap\n  const n = Math.max(3, Math.round(body / Math.max(0.045, r * 0.75)))\n  const pitch = body / n\n  let y = cap\n  for (let i = 0; i < n; i++) {\n    const big = i % 2 === 0 ? 2.3 : 1.85\n    prof.push([r * 1.05, y + pitch * 0.15], [r * big, y + pitch * 0.42], [r * (big - 0.1), y + pitch * 0.55], [r, y + pitch * 0.62])\n    y += pitch\n    prof.push([r, y])\n  }\n  prof.push([0, L - cap])\n  k.lathe(mat, prof, base, v, 20)\n  for (const t of [cap / 2, L - cap / 2]) k.cyl('galvanised', r * 1.25, cap, add(base, v, t), v, 18)\n  for (const t of [0.006, L - 0.006]) k.cyl('galvanised', r * 1.9, 0.012, add(base, v, t), v, 18)\n}\n\n/** Square lattice column of four angle legs with zig-zag bracing on every face, (cx, cz) centre, from y0 to y1. */\nexport function latticeColumn(k: Kit, cx: number, cz: number, y0: number, y1: number, w: number, leg = 'L100x100x10', brace = 'L50x50x5', mat: MatKey = 'galvanised') {\n  const h = w / 2\n  const c: [number, number][] = [[-h, -h], [h, -h], [h, h], [-h, h]]\n  for (const [x, z] of c) member(k, [cx + x, y0, cz + z], [cx + x, y1, cz + z], leg, mat, [-x, 0, -z])\n  const H = y1 - y0\n  const nb = Math.max(1, Math.round(H / w))\n  const dy = H / nb\n  for (let f = 0; f < 4; f++) {\n    const [ax, az] = c[f]\n    const [bx, bz] = c[(f + 1) % 4]\n    for (let i = 0; i < nb; i++) {\n      const ya = y0 + i * dy\n      const flip = (i + f) % 2 === 0\n      const p0: V3 = [cx + (flip ? ax : bx), ya, cz + (flip ? az : bz)]\n      const p1: V3 = [cx + (flip ? bx : ax), ya + dy, cz + (flip ? bz : az)]\n      member(k, p0, p1, brace, mat, [ax + bx, 0, az + bz])\n    }\n    member(k, [cx + ax, y1 - 0.03, cz + az], [cx + bx, y1 - 0.03, cz + bz], brace, mat)\n  }\n}\n\n/** Swivel joint between a and b: two ball-race housings, seal ring, grease nipples and plug bolts. od = pipe OD. */\nexport function swivel(k: Kit, a: V3, b: V3, od: number, mat: MatKey = 'flangeSteel') {\n  const A = new THREE.Vector3(...a)\n  const d = new THREE.Vector3(...b).sub(A)\n  const L = d.length()\n  d.normalize()\n  const v = d.toArray() as V3\n  const at = (t: number) => A.clone().addScaledVector(d, t).toArray() as V3\n  const R = od * 0.82\n  const ri = od * 0.44\n  ring(k, mat, ri, od * 0.56, L, at(L / 2), v)\n  k.cyl('pipeBore', ri, L, at(L / 2), v, 32, undefined, true)\n  ring(k, mat, od * 0.55, R, L * 0.36, at(L * 0.3), v)\n  ring(k, 'machined', od * 0.55, R * 0.96, L * 0.04, at(L * 0.5), v)\n  ring(k, mat, od * 0.55, R * 0.92, L * 0.3, at(L * 0.69), v)\n  for (const t of [0.12, 0.88]) ring(k, mat, od * 0.55, od * 0.7, L * 0.06, at(L * t), v)\n  const [u, w] = perpOf(d)\n  for (let i = 0; i < 6; i++) {\n    const ang = (i / 6) * Math.PI * 2\n    const r = new THREE.Vector3().addScaledVector(u, Math.cos(ang) * R).addScaledVector(w, Math.sin(ang) * R)\n    const p = new THREE.Vector3(...at(L * 0.3)).add(r)\n    k.hex('nut', Math.max(0.018, od * 0.06), 0.012, p.toArray() as V3, r.clone().normalize().toArray() as V3)\n  }\n  const gp = new THREE.Vector3(...at(L * 0.69)).addScaledVector(u, R * 0.92)\n  k.cyl('brass', Math.max(0.006, od * 0.02), 0.03, gp.clone().addScaledVector(u, 0.012).toArray() as V3, u.toArray() as V3, 8)\n}\n\nfunction perpOf(d: THREE.Vector3): [THREE.Vector3, THREE.Vector3] {\n  const ref = Math.abs(d.y) > 0.9 ? new THREE.Vector3(1, 0, 0) : new THREE.Vector3(0, 1, 0)\n  const u = new THREE.Vector3().crossVectors(d, ref).normalize()\n  return [u, new THREE.Vector3().crossVectors(d, u).normalize()]\n}\n\n/** Annular ring (hollow short cylinder) centred on pos along axis, open through the middle. */\nexport function ring(k: Kit, mat: MatKey, ri: number, ro: number, h: number, pos: V3, axis: Axis = 'y', seg = 36) {\n  const v = axisVec(axis)\n  const base = new THREE.Vector3(...pos).addScaledVector(v, -h / 2).toArray() as V3\n  k.lathe(mat, [[ro, 0], [ro, h], [ri, h], [ri, 0], [ro, 0]], base, v.toArray() as V3, seg)\n}\n\n/** Hydraulic cylinder from a (barrel end clevis) to b (rod eye). */\nexport function hydraulicCylinder(k: Kit, a: V3, b: V3, bore: number, mat: MatKey = 'actuatorBlue') {\n  const A = new THREE.Vector3(...a)\n  const B = new THREE.Vector3(...b)\n  const L = A.distanceTo(B)\n  if (L < 1e-3) return\n  const d = B.clone().sub(A).normalize()\n  const bl = Math.min(L * 0.62, L - 0.1)\n  const p = (t: number) => A.clone().addScaledVector(d, t).toArray() as V3\n  k.rod(mat, p(0.04), p(bl), bore / 2, 16)\n  k.rod(mat, p(0.04), p(0.1), bore * 0.62, 16)\n  k.rod(mat, p(bl - 0.06), p(bl), bore * 0.62, 16)\n  k.rod('stainless', p(bl), p(L - 0.04), bore * 0.28, 12)\n  const side = Math.abs(d.x) > 0.9 ? 'z' : 'x'\n  for (const t of [0.02, L - 0.02]) k.cyl('flangeSteel', bore * 0.45, bore * 0.6, p(t), side, 12)\n  k.rod('tubing', add(p(0.12), [0, bore * 0.6, 0]), add(p(bl - 0.08), [0, bore * 0.6, 0]), 0.006, 6)\n}\n\n/**\n * Trapezoidal profiled sheet (wall or roof cladding): profile runs along `u` for `length`, ribs stand out along `n`,\n * extruded `height` along `w`; `origin` is the (0, 0, 0) corner. Typical 35 mm rib at 200 mm pitch.\n */\nexport function profiledSheet(k: Kit, mat: MatKey, length: number, height: number, origin: V3, u: V3, n: V3, w: V3, pitch = 0.2, depth = 0.035) {\n  const top = pitch * 0.2\n  const slope = pitch * 0.15\n  const pts: [number, number][] = [[0, 0]]\n  const ribs = Math.max(1, Math.round(length / pitch))\n  const sc = length / (ribs * pitch)\n  for (let i = 0; i < ribs; i++) {\n    const a = i * pitch * sc\n    const m = a + (pitch * sc) / 2\n    pts.push([m - (top / 2 + slope) * sc, 0], [m - (top / 2) * sc, depth], [m + (top / 2) * sc, depth], [m + (top / 2 + slope) * sc, 0])\n  }\n  pts.push([length, 0])\n  const sh = new THREE.Shape()\n  pts.forEach(([x, y], i) => (i ? sh.lineTo(x, y) : sh.moveTo(x, y)))\n  for (let i = pts.length - 1; i >= 0; i--) sh.lineTo(pts[i][0], pts[i][1] - 0.0015)\n  sh.closePath()\n  const m = new THREE.Matrix4().makeBasis(new THREE.Vector3(...u), new THREE.Vector3(...n), new THREE.Vector3(...w)).setPosition(...origin)\n  k.extrude(mat, sh, height, m, 1)\n}\n"
    }
  ],
  "categories": [
    "onshore"
  ],
  "meta": {
    "export": "Gatehouse",
    "anchor": "base",
    "standards": [
      "EN 12453",
      "EN 13241",
      "EN 12635"
    ]
  }
}