# List of grid points within radius of point

This topic is 2589 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

(Apologies if this is a trivial issue that I could search for... I did a few searches but didn't really know what to search for.)

Let's say you have a large grid (game world), and at some point on that grid you have a point of interest (say, a factory). The factory produces units, which are then deposited around the factory on the grid. The units can be placed anywhere within a circular radius of the factory. No two units can be placed at the same grid point.

My question is, is there a quick way to predetermine the coordinates of all grid points within that radius, so I can pull empty spots from a list rather than having to continually measure distances between points to see if it is within range? I know the math for drawing a circle outline, but not for gathering all of the points within that circle.

##### Share on other sites
The midpoint circle algorithm is the traditional method to find the grid points at the border of the region you are interested in. You should be able to modify the algorithm a bit to suit your needs.

##### Share on other sites

The midpoint circle algorithm is the traditional method to find the grid points at the border of the region you are interested in. You should be able to modify the algorithm a bit to suit your needs.

Nice! From the algorithms on the page you linked, I think I've found a way to pull this off. Thanks!

• 32
• 12
• 10
• 9
• 9
• ### Forum Statistics

• Total Topics
631349
• Total Posts
2999473
×