public
Description: kD-trees in Clojure
Homepage:
Clone URL: git://github.com/abscondment/clj-kdtree.git
name age message
file .gitignore Thu Dec 03 12:21:20 -0800 2009 Added Clojars dep for push; actually removed ol... [abscondment]
file LICENSE Mon Nov 09 17:36:39 -0800 2009 License & readme changes. [Brendan Ribera]
file README.markdown Wed Nov 11 14:01:46 -0800 2009 Struggling with markdown. [abscondment]
file project.clj Sat Dec 12 16:01:12 -0800 2009 Transitioning deps from clojure-alpha to clojur... [abscondment]
directory src/ Thu Dec 03 12:13:15 -0800 2009 Test organization. [abscondment]
directory test/ Thu Dec 03 12:21:20 -0800 2009 Added Clojars dep for push; actually removed ol... [abscondment]
README.markdown

clj-kdtree

Overview

A Kd-tree is a special type of binary tree that partitions points in a k-dimensional space. It can be used for efficient nearest-neighbor searches.

For more detail, refer to Wikipedia on Kd-trees.

Usage

;;; Use a kdtree to find neighbors for one point given a set of points.
(let [points [[8 8] [3 1] [6 6] [7 7] [1 3] [4 4] [5 5]]
      tree (build-tree points)
      neighbors (nearest-neighbor tree [2 2] 4)]
      (println "Tree:" tree
               "\n\nFour points closest to [2 2]:\n"
               neighbors))

License

Copyright (C) 2009 Brendan Ribera. All rights reserved.

Distributed under the MIT License; see the file LICENSE at the root of this distribution.