UNPKG

frame.akima

Version:

A package for Akima interpolation

61 lines 3.4 kB
import { Akima } from './Akima'; import { AkimaPoint } from './AkimaPoint'; /** * Interface representing a point with minimal coordinate properties * Only requires X and Y coordinates for maximum flexibility */ export interface IPoint { readonly X: number; readonly Y: number; } export declare function assertEquidistance(points: AkimaPoint[], numDigits?: number): number; export declare function printCrucialPoints(getValFromAngle: (angle: number) => number | null, value: number): void; /** * Calculates the maximum and average distances between a set of points and their closest points * on a curve defined by the provided Akima interpolation function, with an optional offset. * Optionally prints detailed information about each point's closest match. * * @param pts - Array of points to measure distances from. * @param akimaFunc - Akima interpolation function that returns the Y value for a given X. * @param offset - Offset to apply to each point before distance calculation. * @param print - If true, logs detailed information about each point's closest match. * @returns An object containing the maximum and average distances found. */ export declare function printDistances(pts: AkimaPoint[], akima: Akima, offset: AkimaPoint, print?: boolean): { maxDistance: number; averageDistance: number; }; /** * Verifies that the radii computed by the provided Akima interpolation function * closely match the actual radii of the given points from the origin. * * Iterates through each point in the `expectedPoints` array, calculates its angle * relative to the `universeCenter` using the `relAtan` method, and computes its * Euclidean distance from the origin. It then evaluates the Akima function at the * calculated angle and asserts that the returned radius is close to the actual radius, * within two decimal places. * * @param expectedPoints - An array of `Point` objects representing the expected points on the circle. * @param akimaFunc - A function that takes an angle (in radians) and returns the interpolated radius. */ export declare function checkPoints(expectedPoints: AkimaPoint[], akima: Akima, addedCenter: AkimaPoint, print?: boolean, threshold?: number): number; export declare function getCenter(points: IPoint[], print?: boolean): AkimaPoint; export declare function getXminIndex(points: AkimaPoint[]): number; export declare function getYMinIndex(points: AkimaPoint[]): number; export declare function findClosestPoint(point: AkimaPoint, akima: Akima, offset: AkimaPoint): { index: number; distance: number; }; export declare function getPointFromAkima(angle: number, akima: Akima): AkimaPoint; export declare function findPointWithYValue(yValue: number, akimaFunc: (x: number) => number | null, from: number, to: number, maxIterations?: number): number; export declare function transform(points: AkimaPoint[], transform: AkimaPoint): AkimaPoint[]; export declare function createJSON(points: AkimaPoint[]): void; export declare function createHauk(points: AkimaPoint[]): void; export declare function createRT1(points: IPoint[]): string; export declare function round(num: number, numDigits?: number): number; export declare function createEquidistantPoints(points: IPoint[], nrPoints: number, print?: boolean): { points: IPoint[]; akima: Akima | undefined; center: IPoint; }; //# sourceMappingURL=utils.d.ts.map