@mui/x-charts
Version:
The community edition of MUI X Charts components.
62 lines • 3.17 kB
TypeScript
type TypedArrayConstructor = Int8ArrayConstructor | Uint8ArrayConstructor | Uint8ClampedArrayConstructor | Int16ArrayConstructor | Uint16ArrayConstructor | Int32ArrayConstructor | Uint32ArrayConstructor | Float32ArrayConstructor | Float64ArrayConstructor;
export declare class Flatbush {
_queue: FlatQueue<number>;
_boxes: TypedArrayConstructor;
_indices: Uint16Array | Uint32Array;
data: ArrayBufferLike;
numItems: number;
nodeSize: number;
_levelBounds: number[];
byteOffset: number;
/**
* Recreate a Flatbush index from raw `ArrayBuffer` or `SharedArrayBuffer` data.
* @param {ArrayBufferLike} data
* @param {number} [byteOffset=0] byte offset to the start of the Flatbush buffer in the referenced ArrayBuffer.
* @returns {Flatbush} index
*/
static from(data: any, byteOffset?: number): Flatbush;
/**
* Create a Flatbush index that will hold a given number of items.
* @param {number} numItems
* @param {number} [nodeSize=16] Size of the tree node (16 by default).
* @param {TypedArrayConstructor} [ArrayType=Float64Array] The array type used for coordinates storage (`Float64Array` by default).
* @param {ArrayBufferConstructor | SharedArrayBufferConstructor} [ArrayBufferType=ArrayBuffer] The array buffer type used to store data (`ArrayBuffer` by default).
* @param {ArrayBufferLike} [data] (Only used internally)
* @param {number} [byteOffset=0] (Only used internally)
*/
constructor(numItems: number, nodeSize?: number, ArrayType?: TypedArrayConstructor, ArrayBufferType?: ArrayBufferConstructor | SharedArrayBufferConstructor, data?: ArrayBufferLike, byteOffset?: number);
/**
* Add a given rectangle to the index.
* @param {number} minX
* @param {number} minY
* @param {number} maxX
* @param {number} maxY
* @returns {number} A zero-based, incremental number that represents the newly added rectangle.
*/
add(minX: any, minY: any, maxX?: any, maxY?: any): number;
/** Perform indexing of the added rectangles. */
finish(): void;
/**
* Search the index by a bounding box.
* @param {number} minX
* @param {number} minY
* @param {number} maxX
* @param {number} maxY
* @param {(index: number) => boolean} [filterFn] An optional function for filtering the results.
* @returns {number[]} An array containing the index, the x coordinate and the y coordinate of the points intersecting or touching the given bounding box.
*/
search(minX: number, minY: number, maxX: number, maxY: number, filterFn?: (index: number) => boolean): number[];
/**
* Search items in order of distance from the given point.
* @param x
* @param y
* @param [maxResults=Infinity]
* @param maxDistSq
* @param [filterFn] An optional function for filtering the results.
* @param [sqDistFn] An optional function to calculate squared distance from the point to the item.
* @returns {number[]} An array of indices of items found.
*/
neighbors(x: any, y: any, maxResults?: number, maxDistSq?: number, filterFn?: (index: number) => boolean, sqDistFn?: typeof sqDist): number[];
}
declare function sqDist(dx: number, dy: number): number;
export {};