Advertisement
Guest User

Untitled

a guest
Mar 23rd, 2017
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.10 KB | None | 0 0
  1. public void DrawCircle(int x0, int y0, int radius)
  2. {
  3. int x = 0;
  4. int y = radius;
  5. int delta = 1 - 2 * radius;
  6. int error = 0;
  7. while (y >= 0)
  8. {
  9. this.arr[x0 + x, y0 + y -].fill = true;
  10. this.arr[x0 + x, y0 - y].fill = true;
  11. this.arr[x0 - x, y0 + y].fill = true;
  12. this.arr[x0 - x, y0 - y].fill = true;
  13. error = 2 * (delta + y) - 1;
  14. if (delta < 0 && error <= 0)
  15. {
  16. ++x;
  17. delta += 2 * x + 1;
  18. continue;
  19. }
  20. error = 2 * (delta - x) - 1;
  21. if (delta > 0 && error > 0)
  22. {
  23. --y;
  24. delta += 1 - 2 * y;
  25. continue;
  26. }
  27. ++x;
  28. delta += 2 * (x - y);
  29. --y;
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement