How do I optimize searching for the nearest point?

Posted by Rootosaurus on Game Development See other posts from Game Development or by Rootosaurus
Published on 2012-04-12T12:55:54Z Indexed on 2012/04/12 17:43 UTC
Read the original article Hit count: 253

Filed under:
|

For a little project of mine I'm trying to implement a space colonization algorithm in order to grow trees.

The current implementation of this algorithm works fine. But I have to optimize the whole thing in order to make it generate faster. I work with 1 to 300K of random attraction points to generate one tree, and it takes a lot of time to compute and compare distances between attraction points and tree node in order to keep only the closest treenode for an attraction point.

So I was wondering if some solutions exist (I know they must exist) in order to avoid the time loss looping on each tree node for each attraction point to find the closest... and so on until the tree is finished.

© Game Development or respective owner

Related posts about algorithm

Related posts about tree