#include #include using namespace std; int main() { const int nMax = 150; const double maxNorm = 1e2; const int width = wio.xmax() - wio.xmin(); const int height = wio.ymax() - wio.ymin(); const int maxColor = wio.number_of_colors() - 2; double x0 = -2., y0 = -2., h = 4./width; while (true) { int col, row, n; for (row = 0; row <= height; row++) { for (col = 0; col <= width; col++) { complex c(x0+col*h, y0+row*h), z(0,0); for (n = 0; n < nMax && norm(z) < maxNorm; n++) z = z*z+c; wio << color(n*maxColor / nMax) << Point(col,row); } wio << flush; } while (!wio.check_key() && !wio.check_mouse_click()); // wait for event if (wio.check_key()) break; int button = wio.get_mouse_click(col, row); switch (button) { // L: zoom in, M: set center, R: zoom out case 1: h /= 2.; x0 += col*h; y0 += row*h; break; case 2: x0 -= (width/2.-col)*h; y0 -= (height/2.-row)*h; break; case 3: x0 -= col*h; y0 -= row*h; h *= 2.; break; } } return 0; }