Question

I have collection of objects. Each object represents a coordinate range (ie, a block). What I want is to find the object near another coordinate in a given direction.

Is there a way to do this without traversing the whole collection all the time?

Was it helpful?

Solution

Please see this question.

OTHER TIPS

You may want to look into Binary Space Partitioning, and similar algorithms (Quadtree comes to mind, along with variations on Plane Sweet Algorithms)

While inserting the objects .. sort them by the cordinates then use divide and conquer algorithm to search for your nearest possibility

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top