/** A compiled form has no instant, so declination constraints resolve through * a fixed, stated convention: the J2000 mean obliquity, degrees. */ export declare const OBLIQUITY_J2000_DEG = 23.4392911; /** Generous per-body latitude envelopes (deg) for the solver's search bounds: * roughly the maximum geocentric ecliptic latitude each real body reaches. * Bounds, not assertions -- anything not named gets {@link DEFAULT_LAT_BOUND}, * and `latBounds` overrides per body. */ export declare const DEFAULT_LAT_BOUND = 9; export declare const BODY_LAT_BOUNDS: Record; export type Constraint = { kind: "aspect"; a: string; b: string; angle: number; weight?: number; } | { kind: "sign"; body: string; sign: number; weight?: number; } | { kind: "degree"; body: string; degree: number; weight?: number; } | { kind: "declination"; body: string; degree: number; weight?: number; } | { kind: "parallel"; a: string; b: string; contra?: boolean; weight?: number; } | { kind: "separation3d"; a: string; b: string; angle: number; weight?: number; }; /** A body's compiled state: ecliptic longitude and latitude, degrees. */ export interface BodyState { lon: number; lat: number; } /** Loss-function input: bare longitudes (latitude 0) or full states. */ export type Positions = Record; /** Declination (deg) of an ecliptic (lon, lat) under a fixed obliquity. */ export declare function declinationOf(lonDeg: number, latDeg: number, obliquityDeg?: number): number; /** * Degrees by which a single {@link Constraint} is unmet for a set of body * positions — `0` when satisfied. The pure building block of {@link formLoss} * and {@link compileForm}. * * @param positions Body positions keyed by id: bare longitudes in degrees * (latitude 0), or `{ lon, lat }` states. * @param c The constraint to score. * @returns The unmet amount in degrees (`0` = satisfied). */ export declare function constraintLoss(positions: Positions, c: Constraint): number; /** * Total weighted loss for a set of body positions — the sum of each * constraint's {@link constraintLoss} times its weight. The objective * {@link compileForm} minimizes. * * @param positions Body positions keyed by id (bare longitudes or states). * @param constraints The constraints to score. * @returns The total weighted loss in degrees (`0` = all satisfied). */ export declare function formLoss(positions: Positions, constraints: Constraint[]): number; export interface CompiledForm { longitudes: Record; /** Solved ecliptic latitudes, degrees. Zero for every body no * latitude-sensitive constraint touches (the legacy case). */ latitudes: Record; residual: number; maxConstraintLoss: number; impossible: boolean; constraints: Array; } export interface CompileOptions { restarts?: number; iters?: number; /** A form is impossible when its worst constraint exceeds this (degrees). */ impossibleDeg?: number; /** Per-body latitude search bound override, degrees (e.g. `{ algol: 90 }` * for a fixed star). Defaults come from {@link BODY_LAT_BOUNDS} / * {@link DEFAULT_LAT_BOUND}. */ latBounds?: Record; } /** * Synthesize a chart form from geometric constraints — the inverse of * (time, place) → chart. Given weighted {@link Constraint}s (aspects, sign * placements, exact degrees, declinations, parallels, true 3D separations), * find the body positions that best satisfy them via deterministic * coordinate descent over (longitude, latitude), and report how well they * can be met. When even the best fit is poor, the form is flagged * `impossible` — a valid, informative result. * * @param constraints The geometric constraints to satisfy; each may carry a * `weight` (default `1`). * @param opts `restarts` and `iters` tune the optimizer (more = slower, more * thorough); `impossibleDeg` is the worst-constraint threshold in degrees * above which the form is impossible; `latBounds` widens a body's latitude * search range. Defaults: `12`, `8`, `5`. * @returns A {@link CompiledForm}: solved `longitudes` and `latitudes`, total * `residual`, `maxConstraintLoss`, the `impossible` flag, and each * constraint annotated with its `loss`. * @example * ```ts * const form = compileForm([ * { kind: "parallel", a: "venus", b: "jupiter" }, // shared declination * { kind: "declination", body: "moon", degree: -5 }, * { kind: "aspect", a: "venus", b: "jupiter", angle: 120 }, * ]); * form.impossible; // false * form.latitudes.venus; // the latitude the parallel needed * ``` */ export declare function compileForm(constraints: Constraint[], opts?: CompileOptions): CompiledForm;