import { Engine, BodyId, Zodiac } from "./chart.js"; import { RankedMoment } from "./scan.js"; export declare const DEFAULT_BODIES: string[]; /** * Build a feature vector from explicit `(longitude, weight)` pairs: each pair * contributes a weighted unit-circle point `[w·cos(lon), w·sin(lon)]`. The * low-level primitive behind {@link chartFeatures}; most callers want that. * * @param weightedLons `[longitudeDeg, weight]` pairs, in the order they should * appear in the vector. * @returns A flat vector, two entries per pair. */ export declare function featureVector(weightedLons: [number, number][]): number[]; /** * Cosine similarity of two feature vectors, in `[-1, 1]`. For vectors from * {@link chartFeatures} this is a weighted mean of `cos(Δlongitude)` per body: * `1` when the configurations coincide, falling off as bodies diverge. * * @param a First feature vector. * @param b Second feature vector (compared over the shorter length). * @returns Similarity in `[-1, 1]`; `0` if either vector is all zeros. */ export declare function cosineSimilarity(a: number[], b: number[]): number; export interface FeatureOptions { bodies?: BodyId[]; weights?: Record; zodiac?: Zodiac; } /** * Encode the sky at an instant as a feature vector: each body's ecliptic * longitude becomes a weighted unit-circle point. The deterministic substrate * for matching and searching chart configurations — compare two with * {@link cosineSimilarity}, or rank a time range against one with * {@link searchConfigurations}. * * @param engine The engine used to evaluate positions. * @param jdUt Julian Day in UT. * @param opts `bodies` (ordered; defaults to the ten major bodies), per-body * `weights`, and `zodiac` (tropical by default). * @returns A flat vector `[w·cos(lon), w·sin(lon), ...]`, two entries per body * in `bodies` order. * @example * ```ts * const target = chartFeatures(engine, julianDay(2000, 1, 1)); * const now = chartFeatures(engine, julianDay(2025, 6, 1)); * cosineSimilarity(now, target); // 1 = identical configuration * ``` */ export declare function chartFeatures(engine: Engine, jdUt: number, opts?: FeatureOptions): number[]; /** * Similarity between the sky at `jdUt` and a target feature vector — shorthand * for `cosineSimilarity(chartFeatures(engine, jdUt, opts), target)`. The scoring * function {@link searchConfigurations} maximizes. * * @param engine The engine used to evaluate positions. * @param jdUt Julian Day in UT. * @param target A target feature vector from {@link chartFeatures}. * @param opts {@link FeatureOptions} — must match those used to build `target`. * @returns Cosine similarity in `[-1, 1]`. */ export declare function configurationFit(engine: Engine, jdUt: number, target: number[], opts?: FeatureOptions): number; export interface SearchConfigOptions extends FeatureOptions { start: number; end: number; step: number; limit?: number; } /** * Rank the instants in `[start, end]` by how closely the sky resembles a * `target` feature vector, best first — a realization search over the feature * space. Build `target` with {@link chartFeatures} (e.g. from a natal chart). * * @param engine The engine used to evaluate positions. * @param target A target feature vector from {@link chartFeatures}. * @param opts `start`/`end` (Julian Days, UT) and `step` (days) define the * scan, `limit` caps the results, plus the {@link FeatureOptions} (`bodies`, * `weights`, `zodiac`) — which must match those used to build `target`. * @returns Ranked `{ jd, score }` moments, highest similarity first. * @example * ```ts * const natal = chartFeatures(engine, julianDay(1990, 6, 10, 14, 30)); * const matches = searchConfigurations(engine, natal, { * start: julianDay(2025, 1, 1), end: julianDay(2026, 1, 1), step: 1, limit: 5, * }); * matches[0].jd; // best-matching instant * ``` */ export declare function searchConfigurations(engine: Engine, target: number[], opts: SearchConfigOptions): RankedMoment[];