diff --git a/Julia.fs b/Julia.fs index 43e8ef1..8e8e3d9 100644 --- a/Julia.fs +++ b/Julia.fs @@ -6,12 +6,15 @@ open System.Drawing let generatePixel x y height width zoom rMax maxIter = let c = MandelBrot.getComplexValueForPixel (float x) (float y) (float height) (float width) zoom + let z = Complex(-0.8, 0.156) let rec findI i z = if i >= maxIter then i else if Complex.Abs(z) >= (float rMax) then i - //else findI (i+1) (z*z+c) - else findI (i+1) (Complex.Add(c, (Complex.Multiply(z, z)))) + else + let newRe = c.Real*c.Real - c.Imaginary*c.Imaginary + let newIm = 2.0 * c.Real * c.Imaginary + findI (i+1) (Complex(newRe, newIm)+z) MandelBrot.colorMap (findI 0 (Complex(0.0, 0.0))) maxIter diff --git a/MandelBrot.fs b/MandelBrot.fs index 67627b7..eaa4895 100644 --- a/MandelBrot.fs +++ b/MandelBrot.fs @@ -66,8 +66,7 @@ let generatePixel x y height width zoom rMax maxIter = let rec findI i z = if i >= maxIter then i else if Complex.Abs(z) >= (float rMax) then i - //else findI (i+1) (z*z+c) - else findI (i+1) (Complex.Add(c, (Complex.Multiply(z, z)))) + else findI (i+1) (c+z*z) colorMap (findI 0 (Complex(0.0, 0.0))) maxIter diff --git a/Program.fs b/Program.fs index e2f004f..b387130 100644 --- a/Program.fs +++ b/Program.fs @@ -6,8 +6,10 @@ open System let main argv = printfn "Mandelbrot!" - let result = MandelBrot.generate 800 600 150.0 32 570 + let resultMandelbrot = MandelBrot.generate 800 600 150.0 32 570 + resultMandelbrot.Save("mandelbrot.bmp") - result.Save("mandelbrot.bmp") + let resultJulia = Julia.generate 800 600 150.0 32 570 + resultJulia.Save("julia.bmp") 0 // return an integer exit code diff --git a/bin/Debug/netcoreapp2.2/fsharp-mandelbrot.dll b/bin/Debug/netcoreapp2.2/fsharp-mandelbrot.dll index 8a54357..a359d81 100644 Binary files a/bin/Debug/netcoreapp2.2/fsharp-mandelbrot.dll and b/bin/Debug/netcoreapp2.2/fsharp-mandelbrot.dll differ diff --git a/bin/Debug/netcoreapp2.2/fsharp-mandelbrot.pdb b/bin/Debug/netcoreapp2.2/fsharp-mandelbrot.pdb index d1fa22f..986da6d 100644 Binary files a/bin/Debug/netcoreapp2.2/fsharp-mandelbrot.pdb and b/bin/Debug/netcoreapp2.2/fsharp-mandelbrot.pdb differ diff --git a/julia.bmp b/julia.bmp new file mode 100644 index 0000000..35e3696 Binary files /dev/null and b/julia.bmp differ diff --git a/obj/Debug/netcoreapp2.2/fsharp-mandelbrot.dll b/obj/Debug/netcoreapp2.2/fsharp-mandelbrot.dll index 8a54357..a359d81 100644 Binary files a/obj/Debug/netcoreapp2.2/fsharp-mandelbrot.dll and b/obj/Debug/netcoreapp2.2/fsharp-mandelbrot.dll differ diff --git a/obj/Debug/netcoreapp2.2/fsharp-mandelbrot.pdb b/obj/Debug/netcoreapp2.2/fsharp-mandelbrot.pdb index d1fa22f..986da6d 100644 Binary files a/obj/Debug/netcoreapp2.2/fsharp-mandelbrot.pdb and b/obj/Debug/netcoreapp2.2/fsharp-mandelbrot.pdb differ