I need a very fast algorithm to access the tiles that are in a disc.
I don’t need a perfect disc, at the end, but I do need a very fast algorithm.
I know I can use a bounding square, and iterate through all the tiles in that square and then compute x²+y²<R² to determine whether or not the tile is in the disc. I my case, this is going to be very slow because I have to test thousands of circles per second, meaning millions of tiles, and testing x²+y²<R² on millions of tiles is slow.
I need something fast, even if it’s not very accurate (=even if it’s not a perfect disc, deformed)
Even an octagon (filled) would be ok, if it’s fast enough.
x² + y² < R²→x² < R² − y²sox ∈ ( −√(R²−y²); +√(R²−y²))I think it is fast enough to calculate range just every line. If not, use Bresenham’s algorithm to make it even faster.