/** 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 = "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"; /** 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 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]; /** 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; } /** 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"; /** 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[]; } /** 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): 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;