import type { HungBoard } from "./venue.boards.ts"; /** A point or a direction: x, y, z in feet. */ export type V3 = readonly [number, number, number]; /** What a plane is a part of: it is the class of its element (`ky-up-`) and what a test finds it by. */ export type PartKind = "mast" | "post" | "net" | "tape" | "antenna" | "board" | "glass" | "rim" | "stanchion" | "frame" | "goal" | "flag" | "stump" | "leg" | "table" | "pylon" | "wall" | "screen" | "pole" | "ground" | "target" | "seats" | "concourse" | "fascia" | "roof" | "banner" | "platform" | "rail" | "matedge" | "shrine" | "surround" | "chair" | "desk" | "card" | "sign" | "apron" | "bench" | "floor" | "ribbon" | "hung-board" | "block" | "player"; /** One flat rectangle. Its own x runs along `u` (its whole length) and its own y along `v`; `o` is the corner both start from. `svg` is what is drawn on it, in feet along `u` and `v`. */ export interface Plane { /** A name that says what it is and where: `net`, `post-left`, `goal-right-back`. */ id: string; kind: PartKind; o: V3; u: V3; v: V3; svg: string; /** * A plane that turns to face the eye, about the vertical through its middle: a scoreboard is read from wherever the view is. `u` and `v` give its size and its * place as it lies at a yaw of 0; `v` must be vertical. */ billboard?: boolean; /** * A billboard that also leans back to face the eye squarely, as the pitch tips the view: a card that stands upright is seen foreshortened from above, and its type looks squeezed, so a plane that carries type leans * till its face is square to the eye. It is turned only (never stretched): its width and height stay what they are. At an overhead view it lies flat. `v` must be vertical, as for a billboard. */ lean?: boolean; /** * A wall round the surface that gives way when it is between the eye and what it surrounds: the horizontal direction (x, y, a unit vector) that points from the surface out through the * wall. The nearer the eye is to that side, and the lower it is, the more the wall is cut away (see `fadeOf`), so that the court is never hidden behind its own glass. */ shy?: readonly [number, number]; /** * A plane that is the floor's own drawing seen through its rectangle, not a drawing of its own: the top of a raised platform (a dohyƍ's clay with its bales). The floor lies on the ground, so * that the ground round the platform stays low, and this plane lifts the part of it that is the platform's top to the platform's height. Its `u` and `v` must be flat and along x and y. */ crop?: boolean; /** How much of a `shy` plane is left when it is cut away altogether: 0.08 when missing. A plane that others lie over on the screen (the steps of a gallery) takes less, so that they do not add up to a veil. */ fadeTo?: number; /** How low the eye must be for a `shy` plane to begin to give way: the share (of the plane's side being towards the eye, times the sine of the pitch) at which the fade starts; 0.1 when missing. A low barrier takes a high one, so that it stays whole until the eye is nearly level with it. */ fadeAt?: number; /** * A `shy` plane that gives way by the side the eye is on and not by how low it is: every wall on the eye's side of what it surrounds fades the same, at any tilt, and one on the far side stays whole. A see-through building's walls * (a raised room is seen through every wall between it and the eye, at a low angle and from straight above alike). */ fadeSide?: boolean; /** * A roof: it is cut away from above, so that the bowl under it stays visible, and whole from the street. Its opacity falls from whole to `fadeTo` (0.12 when missing) as the eye rises over the building, from a pitch of `CUTAWAY.from` * degrees (the eye at a low angle, outside) to `CUTAWAY.to` (the eye looking down); at the lowest pitches the view allows, an eye at street level, it is whole again whatever its side. In between a roof that is `shy` gives way as * a wall does, by the side the eye is on. */ cut?: boolean; /** * A face of a closed solid that nothing shows through (a building's wall, drawn opaque): the side of it that is the solid's outside, as the way its `u` x `v` points, 1 out of the solid and -1 into it. While the face is turned away * from the eye it is hidden by the solid's own near faces, so a page that asks for it (`layoutOf`'s `cull`) leaves it out of the view until the view turns it round, and spends nothing on it. */ cull?: 1 | -1; /** A plate the other planes of its building stand on (a floor of a building picked out): it is placed by its farthest corner, so that it is drawn under everything on it, whatever way the view turns. */ under?: boolean; /** * The building (a `TurnModel.groups` index) a plane belongs to, in a scene of several that stand apart (a district's): the view draws one building's planes all before another's, by which side of the line between * them the eye is on, and the planes of one building among themselves by depth. */ group?: number; } /** The `group` of a plane that belongs to no building of its scene but stands apart from all of them: a district's surrounding blocks. The view stacks these among themselves by depth and then among the buildings' planes by depth, where the buildings' are stacked building by building. */ export declare const APART = -1; /** What stands on the surface as a thing a reader would name: a net, a basket, a goal, a pair of posts. */ export type UprightKind = "scoreboard" | "net" | "antennae" | "goalposts" | "netposts" | "hoop" | "goal" | "boards" | "stumps" | "pylons" | "flags" | "fence" | "backstop" | "foul-poles" | "table-legs" | "walls" | "starting-blocks" | "backstroke-flags" | "false-start-rope" | "springboards" | "platforms" | "judges-stand" | "hurdles" | "steeplechase" | "high-jump" | "pole-vault" | "cage" | "padding" | "rink-boards" | "mound" | "azuchi" | "targets" | "stands" | "wall-seats" | "roof" | "gallery" | "dais" | "banner" | "shrine" | "mat-edge" | "surrounds" | "officials" | "judges" | "deck" | "cage-fence" | "cage-posts" | "ring-ropes" | "ring-posts" | "ribbon-boards" | "hung-board" | "blocks"; /** A thing that stands on the surface: where, how high, and the planes it is made of. */ export interface Upright { id: string; kind: UprightKind; /** Where it stands on the surface, in feet. */ at: readonly [number, number]; /** The height of its top above the surface, in feet. */ height: number; /** A second height worth saying (a net's height at the centre, a post's crossbar), in feet. */ low?: number; planes: Plane[]; /** What a scoreboard hung over the surface was made from, so that a replay can draw its faces again with the score and the clock of a time (`replayTurnModel`). */ hung?: HungBoard; } /** The four numbers a plane's SVG needs: its length along `u` and along `v`, in feet. */ export declare const size: (p: Pick) => [number, number]; export declare const add: (a: V3, b: V3) => V3; export declare const sub: (a: V3, b: V3) => V3; export declare const times: (a: V3, k: number) => V3; export declare const length: (a: V3) => number; export declare const unit: (a: V3) => V3; export declare const cross: (a: V3, b: V3) => V3; /** A number for markup: millimetres of a foot, no more. */ export declare const n: (value: number) => string; /** A billboard turned to face an eye whose view is turned `yaw` degrees: its width runs along the screen's x, which in the scene is (cos yaw, -sin yaw, 0). */ export declare function facing(p: Plane, yaw: number, pitch?: number): Plane; /** A plane. */ export declare const plane: (id: string, kind: PartKind, o: V3, u: V3, v: V3, svg: string) => Plane; /** * A rectangle standing upright over a line on the surface, from (x0, y0) to (x1, y1), between the heights z0 and z1. Its own y runs down from z1, so * that what is drawn on it hangs from the top as a net does. */ export declare function wall(id: string, kind: PartKind, x0: number, y0: number, x1: number, y1: number, z0: number, z1: number, svg: string): Plane; /** A rectangle lying flat at the height `z`, from (x0, y0) to (x1, y1). */ export declare function flat(id: string, kind: PartKind, x0: number, y0: number, x1: number, y1: number, z: number, svg: string): Plane; /** * A strip of width `w` along the line from `a` to `b`: a post, a crossbar, an arm. A single strip vanishes when the eye is level with it, so it is two, * crossed, one the width of the other's thickness. `paint` draws on each (its length along the line and its width), a plain strip in `cls` if it is missing. */ export declare function bar(id: string, kind: PartKind, a: V3, b: V3, w: number, cls: string, paint?: (long: number, wide: number) => string): Plane[]; /** An upright strip from the surface up to the height `top`. */ export declare const pole: (id: string, kind: PartKind, x: number, y: number, z0: number, z1: number, w: number, cls: string, paint?: (long: number, wide: number) => string) => Plane[]; /** The lines of a net's mesh over a rectangle w by h feet, one every `cell` feet each way: a path. */ export declare function mesh(w: number, h: number, cell: number): string; /** The mesh of a net as a path element: threads a tenth of a cell thick. */ export declare const threads: (d: string, cell: number) => string; /** A closed outline of points, as a path. */ export declare const polygon: (points: readonly (readonly [number, number])[]) => string; /** A point `t` of the way from `a` to `b`. */ export declare const lerp: (a: number, b: number, t: number) => number; /** * The least thickness, in feet, of anything drawn thin on a surface this big: a post of 3 inches on a 500-foot ground would be a hair, so every strip and every * line is at least a thousandth of the surface's diagonal. */ export declare const thinnest: (w: number, h: number) => number; /** A wall plane marked to give way: its outward direction is the way the wall faces away from `centre` (x, y in feet), which is where the surface's middle is. */ export declare function shy(p: Plane, centre: readonly [number, number]): Plane; /** * How much of a wall is left (1 whole, down to 0.08) at a view: none is cut away unless the wall is on the eye's side of the surface, and then more the lower the eye is, because a wall seen * from straight above hides nothing. `yaw` and `pitch` are the view's, in degrees. */ export declare function fadeOf(p: Pick, yaw: number, pitch: number): number; /** The pitches, in degrees, between which a roof is cut away from above (it is whole at `high` and over, and gone to its `fadeTo` at `low` and under), and between which it is whole again at street level. */ export declare const CUTAWAY: { readonly low: 8; readonly high: 38; readonly streetFrom: 74; readonly streetTo: 84; }; /** A rectangle on the surface, in feet: its corners. */ export type Rect = { x0: number; y0: number; x1: number; y1: number; }; /** A rectangle from its corner and its size. */ export declare const rect: (x: number, y: number, w: number, h: number) => Rect; /** A solid box on the floor: four sides up to `z1` and a flat top. `cls` paints the top; the sides are one tone darker (`cls-side`). */ export declare function box(id: string, kind: Plane["kind"], r: Rect, z1: number, cls: string): Plane[];