Initial data commit

This commit is contained in:
Ingy döt Net 2023-07-01 11:58:00 -04:00
parent 72d218235f
commit f23f22d71c
199087 changed files with 3378941 additions and 0 deletions

View file

@ -0,0 +1,10 @@
let getJuliaValues width height centerX centerY zoom maxIter =
let initzx x = 1.5 * float(x - width/2) / (0.5 * zoom * float(width))
let initzy y = 1.0 * float(y - height/2) / (0.5 * zoom * float(height))
let calc y x =
let rec loop i zx zy =
if i=maxIter then 0
elif zx*zx + zy*zy >= 4.0 then i
else loop (i + 1) (zx*zx - zy*zy + centerX) (2.0*zx*zy + centerY)
loop 0 (initzx x) (initzy y)
[0..height-1] |> List.map(fun y->[0..width-1] |> List.map (calc y))

View file

@ -0,0 +1,3 @@
getJuliaValues 80 25 -0.7 0.27015 1.0 50
|> List.map(fun row-> row |> List.map (function | 0 ->" " |_->".") |> String.concat "")
|> List.iter (printfn "%s")

View file

@ -0,0 +1,20 @@
open System.Drawing
open System.Windows.Forms
let showGraphic (colorForIter: int -> Color) width height centerX centerY zoom maxIter =
new Form()
|> fun frm ->
frm.Width <- width
frm.Height <- height
frm.BackgroundImage <-
new Bitmap(width,height)
|> fun bmp ->
getJuliaValues width height centerX centerY zoom maxIter
|> List.mapi (fun y row->row |> List.mapi (fun x v->((x,y),v))) |> List.collect id
|> List.iter (fun ((x,y),v) -> bmp.SetPixel(x,y,(colorForIter v)))
bmp
frm.Show()
let toColor = (function | 0 -> (0,0,0) | n -> ((31 &&& n) |> fun x->(0, 18 + x * 5, 36 + x * 7))) >> Color.FromArgb
showGraphic toColor 640 480 -0.7 0.27015 1.0 5000