Erlang k-d tree
Switch branches/tags
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
c_src
ebin
src
test
.gitignore
Makefile
README.md
opensuse.spec.in
rebar.config
release
version

README.md

ekdtree implements Erlang interface to CGAL k-d tree and k-NN search algorithm.

Usage

ekdtree:new/1 constructs tree from points which are 4-tuples of integer Id, and float XYZ coordinates:

Points = [{0, 10.0, 10.0, 10.0}, {1, 10.0, 10.0, -10.0}, {2, 10.0,-10.0, 10.0}],
{ok, Tree} = ekdtree:new(Points).

ekdtree:size/1 returns a number of points:

3 = ekdtree:size(Tree).

ekdtree:search/3 returns an ordered list of K nearest neighbors along with a transformed (squared) distance(s):

Knn = ekdtree:search(Tree, {5.0, 5.0, 10.0}, 2), 
[{0, 50.0}, {2, 250.0}])] = Knn.