I'm working on this iso grid game (more precise: dimetric projection, indexed in typical diamond layout) and wanted to implement circular brushes to paint tiles on my map just like you would in any image editing software. I started with the Midpoint Circle Algorithm, but noticed right away, that the result doesn't look like what I want for small brush sizes between 1 and 7.
I would much rather have something like this:
Ignore, that the first circles are not filled, that of course is easy. Are there any suited algorithms for shape generation on iso grids? I probably don't even want circle shapes, but alternating quad and cross-like/x-shapes.
Here is the code for first image sample taken from Wikipedia:
static List<IntVector2> GetBrushCircleCoords(int x0, int y0, int radius)
{
List<IntVector2> coords = new List<IntVector2>();
int x = radius;
int y = 0;
int err = 0;
while (x >= y)
{
coords.Add(new IntVector2(x0 + x, y0 + y));
coords.Add(new IntVector2(x0 + y, y0 + x));
coords.Add(new IntVector2(x0 - y, y0 + x));
coords.Add(new IntVector2(x0 - x, y0 + y));
coords.Add(new IntVector2(x0 - x, y0 - y));
coords.Add(new IntVector2(x0 - y, y0 - x));
coords.Add(new IntVector2(x0 + y, y0 - x));
coords.Add(new IntVector2(x0 + x, y0 - y));
y += 1;
err += 1 + 2 * y;
if (2 * (err - x) + 1 > 0)
{
x -= 1;
err += 1 - 2 * x;
}
}
return coords;
}