Skip to content

Instantly share code, notes, and snippets.

@nasser
Created June 14, 2018 15:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nasser/533abbe4e809dc7e942da8a6078e7cfa to your computer and use it in GitHub Desktop.
Save nasser/533abbe4e809dc7e942da8a6078e7cfa to your computer and use it in GitHub Desktop.
public static void Circle(int x0, int y0, int radius, uint c)
{
int x = radius;
int y = 0;
int dx = 1;
int dy = 1;
int err = dx - (radius << 1);
while (x >= y)
{
Set(x0 + x, y0 + y, 1);
Set(x0 + y, y0 + x, 2);
Set(x0 - y, y0 + x, 3);
Set(x0 - x, y0 + y, 4);
Set(x0 - x, y0 - y, 5);
Set(x0 - y, y0 - x, 6);
Set(x0 + y, y0 - x, 7);
Set(x0 + x, y0 - y, 8);
x += dx * 2 + 1;
dx += 1;
if (x + y > radius)
{
y -= dy * 2 - 1;
dy -= 1;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment