Luc*_*ius 15
您正在寻找以下像素集:

与[R为你圆的半径和(M1,M2)的中心.
为了使这些像素迭代所有位置并将符合条件的那些存储在列表中:
List<int> indices = new List<int>();
for (int x = 0; x < width; x++)
{
for (int y = 0; y < height; y++)
{
double dx = x - m1;
double dy = y - m2;
double distanceSquared = dx * dx + dy * dy;
if (distanceSquared <= radiusSquared)
{
indices.Add(x + y * width);
}
}
}
Run Code Online (Sandbox Code Playgroud)