# rbush-3d-knn

> k-neareset neighbors search for RBush-3d

Latest version **0.0.1** (published 2022-11-13) · ISC license · 0 weekly downloads

## Install

```sh
npm install rbush-3d-knn
pnpm add rbush-3d-knn
yarn add rbush-3d-knn
bun add rbush-3d-knn
```

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.1 |
| Published | 2022-11-13 |
| First published | 2022-11-13 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Dependencies | 1 |
| Unpacked size | 9.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | ion9 |
| Maintainers | ion9 |
| Keywords | rbush-3d, 3d-knn, 3d k neareset neighbors, data structure, query |

## Links

- npm: https://www.npmjs.com/package/rbush-3d-knn
- Repository: https://github.com/ion9/rbush-3d-knn
- Homepage: https://github.com/ion9/rbush-3d-knn#readme
- Issues: https://github.com/ion9/rbush-3d-knn/issues
- npm.io page: https://npm.io/package/rbush-3d-knn

## Dependencies (1)

- [tinyqueue](https://npm.io/package/tinyqueue.md) ^2.0.3

## Alternatives

- [gamedig](https://npm.io/package/gamedig.md) — 29.3K weekly downloads
- [join-monster](https://npm.io/package/join-monster.md) — 12.8K weekly downloads
- [masked](https://npm.io/package/masked.md) — 5.5K weekly downloads
- [@comunica/actor-query-process-explain-logical](https://npm.io/package/@comunica/actor-query-process-explain-logical.md) — 4.7K weekly downloads
- [@veracity/vui](https://npm.io/package/@veracity/vui.md) — 4.6K weekly downloads

## Recent versions

- 0.0.1 (latest) — 2022-11-13

## README

## rbush-3d-knn 

_k_-nearest neighbors search for [RBush-3D](https://github.com/Eronana/rbush-3d).
Implements a simple depth-first kNN search algorithm using a priority queue.

```js
var RBush = require('rbush-3d');
var knn = require('rbush-knn');

var tree = new RBush(); // create RBush tree
tree.load(data); // bulk insert
var neighbors = knn(tree, 40, 40, 40, 10); // return 10 nearest items around point [40, 40, 40]
```

You can optionally pass a filter function to find k neighbors that satisfy a certain condition:

```js
var neighbors = knn(tree, 40, 40, 40, 10, function (item) {
    return item.foo === 'bar';
});
```

### API

**knn(tree, x, y, z, [k, filterFn, maxDistance])**

- `tree`: an RBush tree
- `x`, `y`, `z`: query coordinates
- `k`: number of neighbors to search for (`Infinity` by default)
- `filterFn`: optional filter function; `k` nearest items where `filterFn(item) === true` will be returned.
- `maxDistance` (optional): maximum distance between neighbors and the query coordinates (`Infinity` by default)

### Changelog



##### 0.0.1 (Nov 12, 2020)

- Rework rbush-knn to work with rbush-3d

---
_Source: https://npm.io/package/rbush-3d-knn · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
