WIP julia
This commit is contained in:
parent
880370c5e6
commit
a0b4e19007
8 changed files with 10 additions and 6 deletions
7
Julia.fs
7
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
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Binary file not shown.
Binary file not shown.
BIN
julia.bmp
Normal file
BIN
julia.bmp
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 63 KiB |
Binary file not shown.
Binary file not shown.
Loading…
Add table
Add a link
Reference in a new issue