/** * Pure derivation helpers consumed by the body factory and external callers * (UI panels, raycast tooltips, dig pipelines). Pulled out of `useBody.ts` * so the factory can stay focused on scene-graph assembly while these stay * trivially testable without instantiating any THREE resource. */ import type { BodyConfig } from '../../types/body.types'; import type { TerrainLevel } from '../types/terrain.types'; /** * Derives the hexasphere subdivision count needed to make each tile match * `tileSize` on the surface of a sphere of the given `radius`. * * The relation follows from the Goldberg polyhedron tile count: * N = (4π r²) / tileSize² and N = 10·f² + 2 * where `f` is the subdivision frequency returned. * * @param radius - Sphere radius in world units. * @param tileSize - Target tile edge length in world units. * @returns Subdivision frequency (≥ 2). */ export declare function tileSizeToSubdivisions(radius: number, tileSize: number): number; /** * Selects or builds the terrain palette for a given planet config. * * Routes through {@link strategyFor} — each body type provides its own * palette generator + densification rule. All non-rocky generators feed * their base palette through a shared remapping helper so * `getTileLevel(elevation, palette)` with integer `elevation ∈ [0, N-1]` * resolves to `palette[elevation]` regardless of the body type. * * @param config - Body configuration (drives the strategy lookup). * @param paletteOverride - When provided, short-circuits the generators and * returns this array verbatim. Caller is responsible * for sizing/thresholding it consistently with * `resolveTerrainLevelCount(radius, coreRadiusRatio)`. */ export declare function choosePalette(config: BodyConfig, paletteOverride?: TerrainLevel[]): TerrainLevel[]; /** * Resolves the visual height of a tile from the terrain palette. * Falls back to a default tile height (`0.06`) when the palette returns no * usable height for the elevation (empty palette, missing/non-finite `height`). * * @param config - Planet body config (needed to choose the palette). * @param elevation - Tile elevation — integer band index `[0, N-1]`. * @param paletteOverride - Optional render-time palette override; see * {@link choosePalette}. When omitted, the palette * is auto-derived from `config.type`. * @returns Resolved tile height for building placement. */ export declare function resolveTileHeight(config: BodyConfig, elevation: number, paletteOverride?: TerrainLevel[]): number; /** * Resolves the signed terrain level of a tile *relative to sea level* — a * caller-friendly index independent from the absolute band count: * - `0` = the band currently sitting at the waterline. * - `-1` = one band below the waterline (shallows); deeper bands go `-2, -3, ...`. * - `1` = one band above the waterline; peaks climb `2, 3, ...`. * On dry or frozen bodies (no sea), `seaLevel` is `-1`: the call just returns * the absolute band index so every tile stays in `[0, N-1]`. * * @param seaLevel - Sea level elevation from the simulation (band space). * @param elevation - Tile elevation — integer band index `[0, N-1]`. * @returns Signed integer level. */ export declare function resolveTileLevel(seaLevel: number, elevation: number): number; //# sourceMappingURL=bodyHelpers.d.ts.map