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.
OptionalnodeSize: number = 16
Size 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.
OptionalmaxResults: number = Infinity
The maximum number of results to return.
OptionalmaxDistance: number = Infinity
The maximum distance to search.
OptionalfilterFn: (item: T) => boolean
An 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.
OptionalfilterFn: (item: T) => boolean
An 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