import type { Outline } from "./outline.ts"; import type { KyogijoWords } from "./strings.ts"; import type { Sport, SurfaceOptions } from "./types.ts"; /** The zone sets. */ export type ZoneSetId = "field-thirds" | "cricket-ground" | "soccer-positional" | "soccer-thirds" | "soccer-channels" | "soccer-18" | "nba-shot" | "nhl-slot" | "nhl-home-plate" | "baseball-spray" | "baseball-retrosheet" | "football-pass" | "athletics-track" | "skating-track" | "budo-areas" | "curling-house" | "net-court" | "wall-court" | "roundnet-rings" | "pool-lanes" | "water-polo-areas" | "pool-thirds"; type Pt = readonly [number, number]; /** One zone: its shape on the surface and whether a point lies in it. */ export interface ZoneShape { /** A name for the zone in the data (`restricted-area`, `wing-left-3`), the same in every language. */ id: string; /** The name to show, in the drawing's language. */ name: string; /** The zone's outline as a path, in the drawing's frame (feet). */ d: string; /** Where its label goes. */ label: Pt; /** About how wide and how high a label can be without leaving the zone, in feet. */ room?: Pt; /** Which end of the surface it is at, for a set that has a zone at each end. */ end?: "left" | "right"; /** True if the point lies in the zone. */ has(x: number, y: number): boolean; } /** A set of zones. Where zones overlap, the later one is on top, and a point belongs to the last zone that has it. */ export interface ZoneSet { id: ZoneSetId; zones: ZoneShape[]; /** The index of the zone a point belongs to, or -1 when it is in none. */ which(x: number, y: number): number; } /** What a zone set needs to know about the drawing and the layer. */ export interface ZoneContext { o: Pick & Partial>; outline: Outline; /** The way the team attacks as the surface is drawn wide: names the sides and counts the bands from the team's own end. `right` by default. */ direction: "left" | "right"; /** `left` or `right` for one end of a basket-and-goal surface, or both. */ end: "left" | "right" | "both"; /** The line of scrimmage on a football field, as a distance from the left end line in feet. */ los: number | undefined; /** Which side the batter bats from, for the baseball spray zones: `R` (the default) or `L`. `undefined` names the thirds left, centre and right field. */ bats: "L" | "R" | undefined; words: KyogijoWords["layers"]["zones"]; } /** Every zone set, with the sports it is for, the source of its definition and its title. */ export declare const ZONE_SETS: Readonly>; export declare const ZONE_SET_IDS: readonly ZoneSetId[]; /** The distance from home plate along a ray at `angle` (degrees, 0 straight out to centre field, negative to left) to the edge of the infield: the arc 95 feet round the pitcher's plate. */ export declare function infieldReach(angle: number): number; /** The zones of a set on the surface the context describes. Throws for a set that is not for the surface's sport. */ export declare function buildZoneSet(id: ZoneSetId, ctx: ZoneContext): ZoneSet; export {};