import type { GetInterpolateValue } from './index.js'; import type { MValue, Properties, RGBA, VectorPoint } from '../../index.js'; /** The 4 corner points closest to a point */ export type BilinearCorners = [ VectorPoint, VectorPoint, VectorPoint, VectorPoint ]; /** * Sometimes you're given a large swathe of points, and so this function helps find the closest 4 * "corners" relative to a pont * @param point - point to interpolate * @param refData - reference data to interpolate from * @returns - the corner points closest to the reference point */ export declare function getBilinearPoints(point: VectorPoint, refData: VectorPoint[]): BilinearCorners; /** * # Bilinear Interpolation * * ## Description * Given a reference of data, interpolate a point using bilinear interpolation * * ## Usage * ```ts * import { bilinearInterpolation, getBilinearPoints, PointIndexFast } from 'gis-tools-ts'; * import type { VectorPoint } from 'gis-tools-ts'; * * // We have m-value data that we want to interpolate * interface TempData { temp: number; } * * const pointIndex = new PointIndexFast(); * // add lots of points * pointIndex.insertLonLat(lon, lat, data); * // .... * * // given a point we are interested in * const point: VectorPoint = { x: 20, y: -40 }; * // get a collection of points relative to the point * const data = await pointIndex.searchRadius(point.x, point.y, radius); * * // interpolate * const interpolatedValue = bilinearInterpolation(point, data, (p) => p.m.temp); * * // if you reuse the same data, you can pass in the corners for performance gains * const corners = getBilinearPoints(point, data); * const interpolatedValue = bilinearInterpolation(point, data, (p) => p.m.temp, corners); * ``` * @param point - point to interpolate * @param refData - reference data to interpolate from * @param getValue - function to get value from reference data. Can be the z value or a property in the m-values * defaults to function that returns the z value or 0 if the z value is undefined * @param corners - the 4 corner points relative to the reference point. Add this if you don't want to keep * recomputing the corners on the same data. * @returns - the interpolated value */ export declare function bilinearInterpolation(point: VectorPoint, refData: VectorPoint[], getValue?: GetInterpolateValue, corners?: BilinearCorners): number; /** * Helper function for {@link bilinearInterpolation} on RGB(A) data. * Light in RGB data is logarithmically weighted (gamma corrected), so we need to expand each component by n^2 to * get the correct weight for each component. * @param point - Point to interpolate * @param refData - Reference data points * @returns - The interpolated RGBA data. */ export declare function rgbaBilinearInterpolation(point: VectorPoint, refData: VectorPoint[]): RGBA; //# sourceMappingURL=bilinear.d.ts.map