public void Sqrt() { Complexe a = new Complexe(5, 10); a.Sqrt(); Assert.AreEqual(a.re, -75); Assert.AreEqual(a.im, 100); }
/// <summary> /// Permet de faire une Fractale de Mandel Broot a partir d'une image /// </summary> public void FractaledeMandelBroot() { for (int x = 0; x < matRGB.GetLength(0); x++) { for (int y = 0; y < matRGB.GetLength(1); y++) { double Re = Convert.ToDouble((x - (matRGB.GetLength(0) / 2)) / Convert.ToDouble(matRGB.GetLength(0) / 4)); double Im = Convert.ToDouble((y - (matRGB.GetLength(1) / 2)) / Convert.ToDouble(matRGB.GetLength(1) / 4)); int i = 0; Complexe z = new Complexe(0, 0); Complexe c = new Complexe(Re, Im); while (i < 100) { z.Sqrt(); z.Add(c); if (z.modulo() > 2) { break; } i++; } if (i < 100) { matRGB[x, y] = new Pixel(255 * i / 100, 255 * i / 100, 240 * i / 100); } else { matRGB[x, y] = new Pixel(0, 0, 0); } } } }