Class default
Index
Constructors
Properties
Methods
Constructors
constructor
- new default(
numItems: number,
nodeSize?: number,
ArrayType?: TypedArrayConstructor,
ArrayBufferType?: ArrayBufferConstructor | SharedArrayBufferConstructor,
data?: ArrayBufferLike,
): defaultParameters
- numItems: number
OptionalnodeSize: numberSize of the KD-tree node (64 by default).
OptionalArrayType: TypedArrayConstructorThe array type used for coordinates storage (
Float64Arrayby default).OptionalArrayBufferType: ArrayBufferConstructor | SharedArrayBufferConstructorThe array buffer type used for storage (
ArrayBufferby default).Optionaldata: ArrayBufferLike(For internal use only)
Returns default
Properties
ArrayType
coords
| Float32Array<ArrayBuffer>
| Uint8Array<ArrayBuffer>
| Float64Array<ArrayBuffer>
| Uint32Array<ArrayBuffer>
| Uint16Array<ArrayBuffer>
| Int8Array<ArrayBuffer>
| Uint8ClampedArray<ArrayBuffer>
| Int16Array<ArrayBuffer>
| Int32Array<ArrayBuffer>
data
ids
IndexArrayType
nodeSize
numItems
Methods
add
Add a point to the index.
Parameters
- x: number
- y: number
Returns number
An incremental index associated with the added item (starting from
0).
finish
Perform indexing of the added points.
Returns this
range
Search the index for items within a given bounding box.
Parameters
- minX: number
- minY: number
- maxX: number
- maxY: number
Returns number[]
An array of indices correponding to the found items.
within
Search the index for items within a given radius.
Parameters
- qx: number
- qy: number
- r: number
Query radius.
Returns number[]
An array of indices correponding to the found items.
withinInto
Search the index for items within a given radius, writing matching ids into
outvia indexed assignment (out[i] = id). Accepts any indexed-writable container — a typed array sized to the expected upper bound (allocation-free, fast) or a plainArray(which will grow as needed). Returns the number of matches written.Parameters
- qx: number
- qy: number
- r: number
Query radius.
- out: number[] | TypedArray
Container to write matching ids into.
Returns number
The number of matches written to
out.
Creates an index that will hold a given number of items.