Drawing circles the Bresenham way
Drawing circles pixel by pixel can also suffer from the same issue of pixel skipping if the naïve approach of using a circle equation to calculate pixel locations is used. Consider the implicit circle equation:
The naïve approach to drawing this with pixels could be achieved with the following code:
import math import pygame pygame.init() screen_width = 400 screen_height = 400 screen = pygame.display.set_mode((screen_width, screen_height)) pygame.display.set_caption('Naive Circle') done = False white = pygame.Color(255, 255, 255) radius = 50 center = (200, 200) while not done: for event in pygame.event.get(): if event.type == pygame...