static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new MyForm(settings, fractals, shaders)); pixels = new int[settings.Width * settings.Height]; domain = new double[settings.Width, settings.Height, 2]; for (int x = 0; x < settings.Width; x++) { double mx = Auxiliary.MapDouble(x, 0, settings.Width, -2 * settings.AspectRatio, 2 * settings.AspectRatio); for (int y = 0; y < settings.Height; y++) { double my = Auxiliary.MapDouble(y, 0, settings.Height, -2, 2); domain[x, y, 0] = mx; domain[x, y, 1] = my; } } }
//Iterate the Mandelbrot and return TRUE if the point escapes //Also handle the drawing of the exit points private bool Iterate(double x0, double y0, int w, int h, bool drawIt) { double x = 0; double y = 0; double xnew, ynew; for (int i = 0; i < properties.Bailout; i++) { ynew = (x * x - y * y) + x0; xnew = (2 * x * y) + y0; if (drawIt && (i > properties.Cutoff)) { int ix = (int)Auxiliary.MapDouble(xnew, domain[0, 0, 0], domain[w - 1, 0, 0], 0, w - 1); int iy = (int)Auxiliary.MapDouble(ynew, domain[0, 0, 1], domain[0, h - 1, 1], 0, h - 1); if (ix >= 0 && iy >= 0 && iy < h && ix < w) { // rotate and expose point int index = iy * w + ix; pixels[index]++; if (highest < pixels[index]) { highest = pixels[index]; } } } if ((xnew * xnew + ynew * ynew) > 4) { // escapes return(true); } y = xnew; x = ynew; } //does not escape return(false); }