/** @typedef {{x: number, y: number}} XY */ export type XY = { x: number; y: number; }; /** * Objects bucketed by their projected points into square cells, for finding the closest one within a radius. Cells are * twice the radius wide, so that the radius around any point overlaps only 2x2 of them. * @template {object} T */ export declare class DistanceGrid { _radius: number; _sqRadius: number; _cellSize: number; /** Rows by cell y, cells by cell x, each cell a flat [obj, x, y, obj, x, y, ...] array. @type {Map>>} */ _rows: Map>>; /** @param {number} radius */ constructor(radius: number); /** * @param {T} obj * @param {XY} point */ addObject(obj: T, point: XY): void; /** * Returns true if the object was found. * @param {T} obj * @param {XY} point The point it was added with. */ removeObject(obj: T, point: XY): boolean; /** * The object closest to the point within the radius, or null. * @param {XY} point * @returns {T | null} */ getNearObject(point: XY): T | null; /** @param {number} x */ _getCoord(x: number): number; }