IEnumerable<Point> GetRadiusPoints(Point center, int innerRadius, int outerRadius)
{
for (int i = 0; i <= outerRadius; i++)
{
if (i < innerRadius)
continue;
if (i == 0)
{
yield return center;
continue;
}
var left = new Point(center.X - i, center.Y);
var right = new Point(center.X + i, center.Y);
var up = new Point(center.X, center.Y - i);
var down = new Point(center.X, center.Y + i);
yield return up;
yield return right;
yield return down;
yield return left;
}
var diagonal = (outerRadius - 1);
for (int y = 1; y <= diagonal; y++)
{
if (y < innerRadius)
continue;
for (int x = 1; x <= diagonal; x++)
{
if (x < innerRadius)
continue;
var x1 = new Point(center.X + x, center.Y + y);
var x2 = new Point(center.X - x, center.Y + y);
var y1 = new Point(center.X + x, center.Y - y);
var y2 = new Point(center.X - x, center.Y - y);
yield return x1;
yield return x2;
yield return y1;
yield return y2;
}
}
}