import type { Cs2RoadEdge, Cs2RoadNode } from './types'; export type SignRoadClass = 'motorway' | 'large' | 'medium' | 'small' | 'minor' | 'other' | 'none'; /** * Per road class: rank (a junction's minor approaches rank lower than its greatest), and where the game puts a junction sign on it, * measured on Pacifica's yield signs (median over each class): `gapM` past the outermost inbound lane centre, `alongM` along the * approach from the lane ends (negative: into the junction), `liftM` over the lane end (a kerb). */ export declare const SIGN_ROAD_CLASSES: Readonly>; /** * Pure: a road prefab's class by name (the game's own road prefab names; a custom asset is `other`). `none` is not a street: a lot's * invisible car and road paths (Pacifica: 9,900 of its car edges), harbour and quay roads, water and air ways, the lane editor's * containers, a dam's crest and a pedestrian street (its car lanes are for service and emergency vehicles; nobody drives up to a * stop sign on it). Their edges are left out of the graph, so a lot entrance or a plaza's mouth never makes a junction. */ export declare function signRoadClass(prefab: string): SignRoadClass; /** One road end at a junction: the mean of its car lanes' ends there, its direction away from the junction and its lanes across it. */ export interface SignApproach { edge: number; roadClass: SignRoadClass; /** Mean of the car-lane ends at the junction (scene frame before the sea shift). */ point: [number, number, number]; /** Unit, horizontal, from the junction into the road. */ tangent: [number, number]; /** Lateral offsets (metres along `right = (-tz, tx)`) of the lanes driving into the junction, and out of it. */ inbound: number[]; outbound: number[]; /** Car-lane length of this edge, metres (the chord of its lanes). */ lengthM: number; /** * The junction's pedestrian crossing over this approach: the along-distance (metres from `point`, positive into the road) of its * edge nearer the oncoming driver. Null when the junction has no crossing over it. */ crossingM: number | null; } export interface SignJunction { node: number; entityId: number; point: [number, number, number]; approaches: SignApproach[]; /** The game controls it already: a traffic signal, a yield or a stop sign of its own. */ controlled: boolean; roundabout: boolean; } export interface SignRoadGraphInput { edges: ReadonlyArray>; nodes: ReadonlyArray>; prefabNames: readonly string[]; /** Road curves, stride 13 (four control points, width) and lanes, stride 7 (kind, flags, ...), one curve per lane. */ curves: Float32Array; lanes: Uint32Array; /** Node entities the game already controls (owns a traffic light, yield or stop sign). */ controlledNodes: ReadonlySet; } /** Pure: every road node with its approaches (street edges with car lanes, not `none`). Nodes without one are left out. */ export declare function signRoadGraph(input: SignRoadGraphInput): SignJunction[]; /** * Pure: the near edge of the node's pedestrian crossing over `approach` (`SignApproach.crossingM`): the node's own pedestrian lanes * running across the approach, by their middle and width. The game draws a junction's crossings, zebra or unmarked, as such lanes (on * Pacifica, 1.3 m into the junction from the lane ends, 2 m wide). */ export declare function crossingOver(input: Pick, node: Pick, approach: Omit): number | null; /** Pure: the end of edge `ei` nearest `centre`, or null when it has no car lane. */ export declare function signApproach(input: Pick, ei: number, centre: readonly number[]): Omit | null; /** * Pure: which side of an approach the driver's side is, from the graph's two-way approaches: -1 when their inbound lanes lie at * negative `right` (right-hand traffic, as every North American city), +1 for left-hand traffic. */ export declare function driverSide(junctions: readonly SignJunction[]): -1 | 1; /** Pure: a yaw quaternion [x, y, z, w] turning the sign's local -Z (its face, as the game authors NA signs) along `tangent`. */ export declare function signFacing(tangent: readonly [number, number]): [number, number, number, number]; /** * Pure: where the game would stand a junction sign on `approach` (driver's side, its class's gap, lift and setback), facing the driver. * `alongM` overrides the class's setback (metres from the lane ends, positive into the road). */ export declare function junctionSignTransform(approach: Omit, side: -1 | 1, alongM?: number): { position: [number, number, number]; quaternion: [number, number, number, number]; }; /** A stop sign stands this far before the near edge of the crossing over its approach (MUTCD's 4 ft stop line, plus the post's half). */ export declare const STOP_BEFORE_CROSSING_M = 1.5; /** Pure: a stop sign on `approach`: the junction sign's place, moved back before the junction's crossing over it when there is one. */ export declare function stopSignTransform(approach: SignApproach, side: -1 | 1): { position: [number, number, number]; quaternion: [number, number, number, number]; }; /** Approaches shorter than this are a junction's own stubs (a slip or a median break), not a road a driver stops on. */ export declare const STOP_MIN_APPROACH_M = 8; /** * Pure: the approaches of `junction` that get a stop sign, by the rule in the header. Empty for a controlled junction, a roundabout, * a bend (fewer than three approaches) or a motorway junction. */ export declare function stopApproaches(junction: SignJunction): SignApproach[]; export interface RuleSign { prefab: string; position: [number, number, number]; quaternion: [number, number, number, number]; node: number; edge: number; } /** The game's own stop sign, which the rule places. */ export declare const STOP_SIGN_PREFAB = "NA_StopSign01"; /** A rule sign this close (horizontally) to a placed pole of the game's own is left out: it would stand inside it. */ export declare const RULE_SIGN_CLEARANCE_M = 0.6; /** * Pure: stop signs for every uncontrolled junction of `junctions`, scene frame before the sea shift. `occupied` answers whether a * pole of the game's own already stands within `RULE_SIGN_CLEARANCE_M` of a point (x, z). */ export declare function stopSignsByRule(junctions: readonly SignJunction[], occupied?: (x: number, z: number) => boolean): RuleSign[]; /** Pure: a point grid for `occupied`: true within `radius` of any point. */ export declare function pointGrid(points: ReadonlyArray, radius?: number): (x: number, z: number) => boolean;