Add Julia module
This commit is contained in:
parent
47fd39b8c4
commit
880370c5e6
7 changed files with 29 additions and 2 deletions
26
Julia.fs
Normal file
26
Julia.fs
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
module Julia
|
||||
|
||||
open System
|
||||
open System.Numerics
|
||||
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 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))))
|
||||
|
||||
MandelBrot.colorMap (findI 0 (Complex(0.0, 0.0))) maxIter
|
||||
|
||||
let generate (width:int) height zoom rMax maxIter =
|
||||
let result = new Bitmap(width, height)
|
||||
|
||||
for y in 0 .. height-1 do
|
||||
for x in 0 .. width-1 do
|
||||
generatePixel x y height width zoom rMax maxIter
|
||||
|> (fun color -> result.SetPixel(x, y, color))
|
||||
|
||||
result
|
||||
Binary file not shown.
Binary file not shown.
|
|
@ -6,6 +6,7 @@
|
|||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="MandelBrot.fs" />
|
||||
<Compile Include="Julia.fs" />
|
||||
<Compile Include="Program.fs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
|
|
|
|||
Binary file not shown.
Binary file not shown.
File diff suppressed because one or more lines are too long
Loading…
Add table
Add a link
Reference in a new issue