Exemple #1
0
 /// <summary>
 /// Fractale utilisant la classe Complexes
 /// </summary>
 public void Fractale()
 {
     Pixel[,] fractale = new Pixel[1000, 1000];
     matricepixel      = fractale;
     tailleFichier     = 54 + largeurImage * hauteurImage * 3;
     for (int x = 0; x < hauteurImage; x++)
     {
         for (int y = 0; y < largeurImage; y++)
         {
             double   a  = (double)(x - (hauteurImage / 2)) / (double)(hauteurImage / 4);
             double   b  = (double)(y - (largeurImage / 2)) / (double)(largeurImage / 4);
             Complexe c  = new Complexe(a, b);
             Complexe z  = new Complexe(0, 0);
             int      it = 0;
             while (it < 100)
             {
                 it++;
                 z.Square();
                 z.Add(c);
                 if (z.Magnitude() > 2)
                 {
                     break;
                 }
             }
             if (it < 100)
             {
                 matricepixel[x, y] = new Pixel(0, 0, 0);
             }
             else
             {
                 matricepixel[x, y] = new Pixel(255, 255, 255);
             }
         }
     }
     //    From_Image_To_File("fractale.bmp");
 }
Exemple #2
0
 public void Add(Complexe c)
 {
     a += c.a;
     b += c.b;
 }