Create a BoxIndex index that will hold a given number of items.
The items to index.
A function for accessing the minX, minY, maxX, and maxY properties of the items.
Optional
nodeSize: number = 16Size of the tree node (16 by default).
Search items in order of distance from the given point.
The x coordinate of the query point.
The y coordinate of the query point.
Optional
maxResults: number = InfinityThe maximum number of results to return.
Optional
maxDistance: number = InfinityThe maximum distance to search.
Optional
filterFn: (item: T) => booleanAn optional function for filtering the results.
An array of indices of items found.
Search the index by a bounding box.
The minimum x coordinate of the query point.
The minimum y coordinate of the query point.
The maximum x coordinate of the query point.
The maximum y coordinate of the query point.
Optional
filterFn: (item: T) => booleanAn optional function that is called on every found item; if supplied, only items for which this function returns true will be included in the results array.
An array of indices of items intersecting or touching the given bounding box.
BoxIndex
Description
An Index for points and rectangles
A really fast static spatial index for 2D points and rectangles in JavaScript. Uses either a fast simple Hilbert curve algorithm or a more complex Hilbert curve (S2) algorithm.
This is a partial port/typescript port of the flatbush codebase.
Usage
Links