On Tue, Jan 20, 2009 at 10:21 PM, René Dudfield <ren...@gmail.com> wrote: > I forgot to mention this quadtree code too: > http://www.pygame.org/wiki/QuadTree > > > cu, > > > On Wed, Jan 21, 2009 at 5:06 PM, René Dudfield <ren...@gmail.com> wrote: >> hi, >> >> you'll want to use a spacial hash. >> >> Like this quadtree for example: >> http://www.pygame.org/project/752/ >> >> cu! >>
Those suggestions are good. Also, even in the original case, you probably don't need a squareroot at all. You can use the manhattan distance instead for relative distances. But even that will not scale well enough if your collection gets big enough. The real problem is comparing everything to everything else, which some kind of partitioning will help you avoid.