import { type AthleticsFigures } from "../leagues/athletics.ts"; import { type Parts, type StraightPlan } from "./oval.ts"; import { type Oval } from "./track.ts"; import type { RaceInfo } from "./types.ts"; /** Where a lane's start line stands. */ export interface StartPlacement { lane: number; /** The distance of the start along the lane's running line from the finish line, forward. */ s: number; /** Where the lane's running line crosses the start line, and the way the athlete faces there. */ x: number; y: number; heading: number; /** How far ahead of lane 1's start it is, on the running line. */ stagger: number; } /** A point of the plan. */ export type Pt = [number, number]; /** One race's marks as data, for the description, the replay and the tests. */ export interface RaceMarks { race: RaceInfo; /** The distance of lane 1's start line from the finish line along its running line: the least that is round whole laps to the distance of the race. */ s1: number; /** The start line of each lane (a staggered start's, or a straight's: `x` is then the line's). Empty for a curved start. */ starts: StartPlacement[]; /** The curved start line from the kerb out across the track. */ curve?: Pt[]; /** The outer group's curved start line. */ group?: Pt[]; /** The breakline, from lane 2's inside to the outer edge. */ breakline?: Pt[]; /** The takeover zones: for each lane and change, where the zone starts and ends and the scratch line stands, as distances along the lane. */ zones?: { lane: number; change: number; start: number; scratch: number; end: number; }[]; /** The hurdles: for each lane, the distances along its running line (or, on the straight, the x) of the marks. */ hurdles?: { lane: number; at: number[]; }[]; /** What is drawn. */ parts: Parts; } /** What the marks of a race are made in. */ export interface RaceContext { oval: Oval; fig: AthleticsFigures; /** The oval's lanes that are used, and the straight's. */ lanes: number; straight: StraightPlan | undefined; /** True to put the lane numbers on the track behind each start line. */ numbers: boolean; /** The height of those numbers. */ numberHeight: number; } /** The unit normal of a heading, pointing out from the middle of the track: to the right of the athlete. */ export declare const outward: (heading: number) => Pt; /** The unit vector of a heading. */ export declare const ahead: (heading: number) => Pt; /** The ends of the line across lane `n` at distance `s` of its running line, from radius `ra` to radius `rb` (measured as the track's radii are: outward from the middle of a bend). */ export declare function across(o: Oval, n: number, s: number, ra: number, rb: number): [Pt, Pt]; /** Where a point `back` metres behind `s` on lane `n` is, and the unit vector out from the middle there. */ export declare function atLane(o: Oval, n: number, s: number, side?: number): { x: number; y: number; heading: number; }; /** The inside and the outside radius of the paintable width of lane `n`: between the line on its left and the line on its right (1.17 m of a 1.22 m lane). */ export declare function laneSpan(o: Oval, n: number): [number, number]; /** The distance of lane 1's start from the finish line for a race of `distance` metres: the least start that is a whole number of laps before the finish line, round to the distance (Rule 14.3). */ export declare function firstStart(o: Oval, distance: number, nominal?: number): number; /** The stagger of lane `n` for a race run in lanes round `bends` bends, with the breakline's correction where the race has one (Manual Tables 2.2.1.6a and 2.2.1.6b). */ export declare function staggerOf(o: Oval, n: number, bends: number, breakline: boolean, fig: AthleticsFigures): number; /** Where a curved start line begins on a circle of radius `a`, from its distance `s` along that circle's running line: the bend it is on or runs into, the angle there, and the wire already unwound. */ export declare function curveOrigin(o: Oval, a: number, s: number): { side: "right" | "left"; f0: number; wire: number; }; /** * A curved start line, or a breakline, as points: the involute of the circle of radius `a` (see `involutePoint`) that starts where `origin` says, from `rIn` out to `rOut` (radii about the bend's * centre; a start line on the straight is the same curve). Where `rIn` is less than `a` a short run in to the kerb along the line across the track joins it. */ export declare function curveAcross(o: Oval, origin: { side: "right" | "left"; f0: number; wire: number; }, a: number, rIn: number, rOut: number, steps?: number): Pt[]; /** The marks of one race on the oval or the straight. */ export declare function markRace(ctx: RaceContext, race: RaceInfo): RaceMarks; /** Every point that makes the start of a race: the ends of each lane's start line, the curved lines, the breakline. For a close-up's window. */ export declare function startPoints(o: Oval, marks: RaceMarks, straight: StraightPlan | undefined): Pt[]; /** The pivot of a start's close-up: where the view is turned about, and the way the athletes face there. */ export declare function startPivot(o: Oval, marks: RaceMarks): { x: number; y: number; heading: number; };