kdtree-fast
TypeScript icon, indicating that this package has built-in type declarations

1.0.0 • Public • Published

kdtree-fast

KD-tree implementation targeting WebAssembly, written in Rust and taylored for Node.js environments.

Build

$ make

Usage

$ yarn add kdtree-fast
const KdTree = require("kdtree-fast").KdTree;

const tree = new KdTree(2);

tree.add([1, 1], 1);
tree.add([3, 4], 3);
tree.add([4, 9], 5);
tree.add([7, 1], 7);
tree.add([8, 8], 23);
tree.add([2, 6], 8);

// the size of the kdtree..
tree.size();
// == 6

// the three nearest points..
tree.nearest([1, 2], 3);
// == [ [ 1, 1 ], [ 8, 3 ], [ 17, 8 ] ]

// all points within a distance of 10..
tree.within([1, 2], 10);
// == [ [ 1, 1 ], [ 8, 3 ] ]

Readme

Keywords

none

Package Sidebar

Install

npm i kdtree-fast

Weekly Downloads

0

Version

1.0.0

License

none

Unpacked Size

70.1 kB

Total Files

6

Last publish

Collaborators

  • kenansulayman