Radial Grid Search Algorithm
Posted
by grey
on Stack Overflow
See other posts from Stack Overflow
or by grey
Published on 2010-03-12T21:18:45Z
Indexed on
2010/03/12
21:27 UTC
Read the original article
Hit count: 252
I'm sure there's a clean way to do this, but I'm probably not using the right keywords for find it.
So let's say I have a grid. Starting from a position on the grid, return all of the grid coordinates that fall within a given distance. So I call something like:
getCoordinates( currentPosition, distance )
And for each coordinate, starting from the initial position, add all cardinal directions, and then add the spaces around those and so forth until the distance is reached. I imagine that on a grid this would look like a diamond.
© Stack Overflow or respective owner