To paint the mandelbrot set, the "color" of each square of Kara's world must be determined (method test
). To do this, the coordinates of Kara's world must be transformed into coordinates of the Mandelbrot set image (methods calculateMandelX/Y
).
for row in range (0, KARA_HEIGHT): for col in range (0, KARA_WIDTH): x = calculateMandelX(col) y = calculateMandelY(row) i = test(x, y) if i == ITERATIONS: world.setLeaf(col, row, 1) tools.checkState()