build.ts

src/scene/build.ts
// Authoring helpers — build the typed `Scene` from intuitive, EDGE/BOUNDS-based
// inputs instead of center+size. The renderer consumes the same `Scene` types,
// so these only change how scenes are *written*, never how they *draw*.
//
// Everything is in INCHES. Origin at the interior NW corner; +x east, +y south,
// +z up. See sample.ts for the layout and a worked authoring guide.
import type { Fixture, Opening, Room, Scene, Vec2, Wall } from './schema';
/** Inclusive [edge, edge] extent on one axis. Order doesn't matter. */
export type Span = [number, number];
const lo = (s: Span) => Math.min(s[0], s[1]);
const hi = (s: Span) => Math.max(s[0], s[1]);
const mid = (s: Span) => (s[0] + s[1]) / 2;
const len = (s: Span) => Math.abs(s[1] - s[0]);
// ── Scene assembler ──────────────────────────────────────────────────────────
/** Assemble a full Scene from its parts (fills units + wraps the single level). */
export function scene(opts: {

Showing the first 20 lines.

Get full code

Support

Talk to the developers of this project to learn more

We have been building professional websites for big clients for over 15 years. Gallop templates and blocks is our best foundation for SEO websites and web apps.

© 2026 Web Plant Media, LLC