Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public void DrawCircle(int x0, int y0, int radius)
- {
- int x = 0;
- int y = radius;
- int delta = 1 - 2 * radius;
- int error = 0;
- while (y >= 0)
- {
- this.arr[x0 + x, y0 + y -].fill = true;
- this.arr[x0 + x, y0 - y].fill = true;
- this.arr[x0 - x, y0 + y].fill = true;
- this.arr[x0 - x, y0 - y].fill = true;
- error = 2 * (delta + y) - 1;
- if (delta < 0 && error <= 0)
- {
- ++x;
- delta += 2 * x + 1;
- continue;
- }
- error = 2 * (delta - x) - 1;
- if (delta > 0 && error > 0)
- {
- --y;
- delta += 1 - 2 * y;
- continue;
- }
- ++x;
- delta += 2 * (x - y);
- --y;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement