stefankoegl / kdtree

A Python implementation of a kd-tree
ISC License
371 stars 118 forks source link

Wrong nearest-neighbor result #10

Closed stefankoegl closed 10 years ago

stefankoegl commented 10 years ago

The following bug was reported by email.

When constructing a kdtree for

points= [(1,2,3),(5,1,2),(9,3,4),(3,9,1),(4,8,3),(9,1,1),(5,0,0),(1,1,1),(7,2,2),(5,9,1),(1,1,9),(9,8,7),(2,3,4),(4,5,4.01)]

the nearest-neighbor for some point is wrong

tree.search_nn((2,5,6))

returns (2,3,4) which has a squared distance of 8. It should, however, return (4,5,4.01) with a distance of 7.9601.