This is a very important data structure from a historical point of view, but unfortunately it doesn't work well when you are dealing with complex spaces. Try LSH as mentioned before or something that is 10X faster: <a href="http://simmachines.com" rel="nofollow">http://simmachines.com</a>