ningliang/FastKDTree
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
Fast KD Tree in javascript, based on Duyn's java version. http://robowiki.net/wiki/User:Duyn/kd-tree_Tutorial http://en.wikipedia.org/wiki/K-d_tree Usage: var nodes = [ { data: "A", coords: [1, 2] }, { data: "B", coords: [4, 5] }, { data: "C", coords: [9, 10] } ]; var tree = new FastKDTree(); tree.add_all(nodes); var k = 2; var query = [2, 2]; var nearest_points = tree.k_nearest(query, k); Notes - The "data" key in each node can have an arbitrary value - "coords" are length N arrays (N constant for a given tree) - The tree uses Euclidean distance for finding the k nearest neighbors - The search state uses a simple array instead of a heap - there is an optimization here Contributions welcome! Thanks, Ning
About
A fast kd tree in javascript
Resources
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published