import type { LoadedRuntime } from './simulateRuntime'; type Json = Record; type V3 = [number, number, number]; export type CabinStatus = 'PASS' | 'WARN' | 'FAIL' | 'NOT_MEASURED'; /** Every threshold the check judges against, metres. Exported so the report and the docs quote the same numbers. */ export declare const CABIN_CHECK_THRESHOLDS: { /** H-point above the floor under the feet: below this the occupant sits on the floor (FAIL); the runtime asks for 0.34 m, a sports coupe lives near 0.2. */ readonly hipAboveFloorFailM: 0.08; readonly hipAboveFloorWarnM: 0.15; /** Crown to the roof lining: the same floor as the occupant gate (`headGapMinM`), warn inside 3 cm. */ readonly headFailM: 0.01; readonly headWarnM: 0.03; /** A seat the runtime moved (or refused): the preview's `cabin_fit` rule. */ readonly fitMoveFailM: 0.03; /** A canonical limb (cloth radius) deeper than this into the body is a visible clip. */ readonly limbFailM: -0.015; /** ...and under the daylight the runtime itself asks of every part of the leg (`LEG_CLEARANCE_M`, 15 mm) is tight enough to warn. */ readonly limbWarnM: 0.015; /** The driver's legs against the wheel / column / dash, the runtime's `driverLeg.clearanceM`. */ readonly driverLegFailM: -0.03; readonly driverLegWarnM: 0; /** The rim against the skin above it. */ readonly rimFailM: 0; readonly rimWarnM: 0.02; /** Free height over a planted foot under the seat ahead (the ball of the foot is 9 cm thick). */ readonly footGapFailM: 0; readonly footGapWarnM: 0.02; /** A mannequin leg's penetration is judged on the cloth, so the shoe sole's contact with the floor pan is not a clash. */ readonly floorContactM: 0.03; }; export type LimbPart = 'knee' | 'shin' | 'ankle' | 'ball' | 'toe'; export interface LimbSample { part: LimbPart; y: number; z: number; r: number; /** 0 at the hip, 1 at the foot: where along the hip -> foot lateral line. */ t: number; } /** The seated leg for a foot rest `reachM` ahead of the H-point and `restY` under it (seat-local). Thigh samples are omitted: the thigh lies on the cushion. */ /** * The runtime's seated foot (`seats.ts` `seatedFootPose`, humanoid-character >= 0.3.214): the ankle and the ball relative to the flat * foot rest (up, forward), for a foot pitched `pitchDeg` toe-up onto a toe board about its heel. Zero pitch is the flat foot. */ export declare function seatedFootPose(pitchDeg: number, footLengthM?: number): { ankleUp: number; ankleFwd: number; ballUp: number; ballFwd: number; }; export declare function seatedLegSamples(reachM: number, restY: number, pitchDeg?: number): LimbSample[]; /** * A DRIVER's leg: the ball of the foot is ON the pedal pad (`reachM`/`restY` are the pad's place off the H-point), whatever the foot pitch. * A pitched passenger foot keeps its heel on the floor and its ball moves up the board; a driver's ball stays on the pad and the ankle * moves instead, so the rest the leg is built from is the pad with the pitched ball's offset taken back out. */ export declare function driverLegSamples(reachM: number, padY: number, pitchDeg?: number): LimbSample[]; /** The body's triangles in the cabin frame: 9 numbers each, plus the mesh each came from. */ export interface Soup { tris: Float32Array; mesh: Uint16Array; names: string[]; } export declare function soupSize(s: Soup): number; /** Distance from `p` to triangle (a, b, c) — Ericson, "Real-Time Collision Detection" 5.1.5. */ export declare function pointTriangleDistance(p: V3, a: V3, b: V3, c: V3): number; /** First hit of a ray (two-sided Möller–Trumbore) among the triangles `accept` allows: the distance along `dir` (unit), or null. */ export declare function rayFirstHit(s: Soup, origin: V3, dir: V3, accept?: (i: number) => boolean, maxT?: number): number | null; /** What a triangle is, for naming what a limb clips: a seat ahead, the tunnel / console, or other bodywork. */ export type SurfaceClass = 'front_seat' | 'tunnel' | 'other'; export interface SeatZone { id: string; row: number; hip: V3; } /** Class of a triangle relative to the occupant at `self`: inside the footprint of a seat in an earlier row (and not above its head), else a lateral wall near the centre line, else other. Pure. */ export declare function classifyTriangle(centroid: V3, normal: V3, self: SeatZone, seats: readonly SeatZone[]): { cls: SurfaceClass; seat?: string; }; export interface LimbReading { part: LimbPart; side: 'l' | 'r'; at: V3; /** Distance to the nearest body surface minus the limb's radius: negative = inside the body. */ clearanceM: number; /** Nearest clearance per surface class. */ byClass: Record; mesh: string | null; against: SurfaceClass | null; againstSeat: string | null; } /** * Distance of one limb sphere to the body, per class. Surfaces the sphere stands on are not clashes: a roughly horizontal * triangle at or under the sphere's middle is the floor, a sill or a cushion it rests on (the foot IK plants the sole on the * floor; the canonical leg and the drawn floor differ by a centimetre or two). Triangles inside the occupant's own seat * (cushion, back, base) are skipped for the same reason. */ export declare function measureLimb(s: Soup, p: V3, r: number, self: SeatZone, seats: readonly SeatZone[], ownSeat: (c: V3) => boolean): Omit; export interface CabinRow { id: string; status: CabinStatus; /** The headline figure, metres (null where the row is not a distance). */ valueM: number | null; detail: string; threshold: string; } /** Higher is better: FAIL below `fail`, WARN below `warn`. */ export declare function judgeAtLeast(valueM: number, fail: number, warn: number): CabinStatus; export declare function worstStatus(statuses: readonly CabinStatus[]): CabinStatus; /** Judge a set of limb readings as one row (`id`), named for what they are closest to. */ export declare function limbRow(id: string, label: string, readings: readonly LimbReading[], pick: (r: LimbReading) => number, named?: (r: LimbReading) => string): CabinRow; export interface SeatFitFacts { id: string; role: string; row: number; /** Declared in the package's seat table (`specialty.module.seatVars`): can be boarded. */ declared: boolean; /** The H-point came from a `seat_*` socket (package or GLB), not derived from the hull's bounding box. */ measured: boolean; hip: V3; authoredHip: V3 | null; accepted: boolean; reason: string | null; movedAftM: number; loweredM: number; hipAboveFloorM: number | null; crownClearanceM: number | null; headroomM: number | null; occupantMeasured: boolean; driverLeg: { clearanceM: number; part: string | null; against: string | null; limitedBy: string | null; } | null; legroom: { reachM: number; clearanceM: number; limitedBy: string | null; } | null; } export interface CabinSeatReport { id: string; role: string; row: number; declared: boolean; hPoint: V3; status: CabinStatus | 'SKIPPED'; rows: CabinRow[]; note?: string; } /** The non-geometric rows of a seat, from the runtime's fit. Pure. */ export declare function fitRows(f: SeatFitFacts): CabinRow[]; /** The leg rows of a passenger seat from its readings. Pure over the readings. */ /** One pedal's foot and lower leg, measured against the body. */ export interface DriverPedalRead { id: string; pad: V3; hinge: V3; reachM: number; readings: LimbReading[]; } /** The driver's feet on the pedals, judged as one row: the worst of toe / ball / ankle / shin over every pedal, named by pedal and part, with the per-pedal figures. */ export declare function driverFootRow(reads: readonly DriverPedalRead[]): CabinRow; export declare function legRows(readings: readonly LimbReading[], hasSeatAhead: boolean): CabinRow[]; interface LoadedScene { root: unknown; scene: unknown; json: Json; exclude: unknown[]; } /** Read a GLB into a three.js scene (geometry and node transforms only): no GPU, no textures. */ export declare function loadGlbScene(glb: Buffer, THREE: Record): Promise; /** The body's triangles in the cabin frame, wheels left out (the runtime's fit excludes its wheel nodes the same way). */ export declare function bodySoup(THREE: Record, root: any, exclude: readonly unknown[]): Soup; /** What `VehicleEntity.attachInterior` does when the drawn model is not where the descriptor's nominal frame puts it. */ export declare function translateCabin(cabin: Json, delta: V3): Json; export interface CabinCheckReport { ok: boolean; /** 0 pass or warn only, 1 any FAIL. */ exitCode: 0 | 1; engine: { version: string; source: string; }; glb: { bytes: number; triangles: number; }; car: string | null; seats: CabinSeatReport[]; steering: { worstClearanceM: number | null; status: CabinStatus; detail: string; } | null; /** The runtime's own warnings from the fit (verbatim). */ runtimeWarnings: string[]; notes: string[]; millis: number; } export interface CabinCheckInput { pkg: unknown; glb: Buffer; name?: string; } /** Run the check. Throws only when the runtime cannot resolve the car at all (the package or model is unreadable). */ export declare function checkCabin(input: CabinCheckInput, runtime: LoadedRuntime): Promise; export declare function formatCabinReport(r: CabinCheckReport): string; /** Read a package directory (`vehicle-package.json` + `model.glb`, or the one `.glb`) or a package JSON beside its model. */ export declare function readCabinInput(dirOrPackage: string, glbOverride?: string): { pkg: unknown; glb: Buffer; dir: string; packageFile: string; glbFile: string; }; /** A published vehicle's package and drawn model (public reads; the CDN refuses a bare client, so the request carries a browser user agent). */ export declare function fetchPublishedCabinInput(apiUrl: string, itemId: string, fetchImpl?: typeof fetch): Promise<{ pkg: unknown; glb: Buffer; name: string; modelUrl: string; }>; export {};