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 (int row = 0; row < KARA_HEIGHT; row++) { for (int col = 0; col < KARA_WIDTH; col++) { double x = calculateMandelX(col); double y = calculateMandelY(row); int i = test(x, y); if (i == ITERATIONS) { world.setLeaf(col, row, true); tools.checkState(); } } }