/** * River Generation Module * * Generates rivers using flow accumulation algorithm. * Inspired by Azgaar's river system (reference/AZGAAR_SNAPSHOT.md Section 4). * * Algorithm: * 1. Calculate flow accumulation from precipitation * 2. Identify high-flux cells as river sources * 3. Trace river paths downhill to ocean/lake * 4. Track confluences where rivers merge * * Key properties: * - Deterministic (seedable PRNG) * - Rivers always flow downhill * - Acyclic network (DAG structure) * - Flux increases downstream * - Memory optimized using TypedArrays */ /** * Point in 2D grid */ export interface Point { x: number; y: number; } /** * Single river with path and flow data */ export interface River { id: string; /** River path from source to mouth */ path: Point[]; /** Water flux at each point in path */ flux: number[]; /** Points where tributaries join this river */ confluences: Point[]; } /** * Complete river system for a world */ export interface RiverSystem { rivers: River[]; /** Flow accumulation map */ flowMap: number[][]; } /** * River generation options */ export interface RiverGenerationOptions { /** Deterministic seed */ seed: string; width: number; height: number; /** Elevation map (Uint8Array) */ elevation: Uint8Array; /** Precipitation map (optional, defaults to uniform) */ precipitation?: Float32Array; /** Sea level (default 20) */ seaLevel?: number; /** Minimum flux to form a river (default 100) */ minFlux?: number; } export declare const toIndex: (x: number, y: number, width: number) => number; export declare const fromIndex: (index: number, width: number) => { x: number; y: number; }; /** * Generate river system */ export declare function generateRivers(options: RiverGenerationOptions): RiverSystem; //# sourceMappingURL=river.d.ts.map