sandfox/kdtree — pull request #7 by MichaelRFairhurst (2014-05-29 19:18:20+00:00)
Title: Multiple bugfixes

From what I can tell, most all bugs have been removed.

Issues fixed:
- building correct hyperrectangle required proper order of points -- min/max were only ever coincidentally correct
- array slice in tree build - was dropping one point per node due to wrong slice tree
- median by value rather than index - when median point was equivalent to previous point, the previous points were put in the wrong side of the tree
- search over correct dimensions - count($dimensions) was always returning 1
- closest hyperrectangle point fixed - choose min/exact/or max point in each dimension.

Introduced an issue where exact duplicate nodes cause infinite loops - so I introduced a maxdepth and exception throw.

Hopefully it all looks good!