public static Complex FromXYPair(int x, int y, Bitmap bmp, Window window) { var xRange = window.XMax - window.XMin; var yRange = window.YMax - window.YMin; var percentX = (double)x / bmp.Width; var percentY = (double)y / bmp.Height; var re = xRange * percentX + window.XMin; var im = yRange * percentY + window.YMin; return new Complex (re, im); }
public static void Main(string[] args ) { for (int y = 0; y < height; y++) { Console.WriteLine (""); for (int x = 0; x < width; x++) { var bmp = new Bitmap { Height = height, Width = width }; var window = new Window { XMin = xMin, XMax = xMax, YMin = yMin, YMax = yMax }; var currentComplexNumber = FromXYPair (x, y, bmp, window); var n = GetIterations (currentComplexNumber); Console.Write (n < 100 ? " " : "*"); } } Console.ReadKey (); }