Conjunto de Mandelbrot en C# .Net, Fractales, Mandelbrot Set

En este video te explicare el conjunto de mandelbrot, y como se puede representar en C# .Net.

Código


public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            MandelbrotSet();

        }

        private void MandelbrotSet()
        {
            int width = pictureBox1.Width;
            int heigh = pictureBox1.Height;
            Bitmap bmp = new Bitmap(width,heigh);

            for (int row=0;row<heigh;row++)
            {
                for (int col=0;col<width;col++)
                {
                    double c_re = (col - width / 2.0) * 4.0 / width;
                    double c_im = (row - Height / 2.0) * 4.0 / heigh;
                    int iteracion = 0;
                    double x = 0, y = 0;

                    while (iteracion<1000 && ((x*x)+(y*y))<=4)
                    {
                        double x_temp = (x * x) - (y * y) + c_re;
                        y = 2 * x * y + c_im;
                        x = x_temp;
                        iteracion++;
                    }

                    if (iteracion < 1000)
                        bmp.SetPixel(col, row, Color.FromArgb(iteracion%128,iteracion%50*5,iteracion%10));
                    else
                        bmp.SetPixel(col, row, Color.Black);
                }
            }

            pictureBox1.Image = bmp;

        }
    }