diff options
author | Jesse Luehrs <doy@tozt.net> | 2014-10-25 09:53:41 -0400 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2014-10-25 09:53:41 -0400 |
commit | 264fa55dcf2d72d8ddf0bb6fd96be29e4e57d666 (patch) | |
tree | 1e2e0876bea680b22d83b1e16e5341968f04d4f5 /src | |
parent | 35c239e4b7ab489961a0029a53b505921f230244 (diff) | |
download | julia-fractals-264fa55dcf2d72d8ddf0bb6fd96be29e4e57d666.tar.gz julia-fractals-264fa55dcf2d72d8ddf0bb6fd96be29e4e57d666.zip |
start refactoring this into a class
Diffstat (limited to 'src')
-rw-r--r-- | src/mandelbrot.jl | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/src/mandelbrot.jl b/src/mandelbrot.jl index 614d490..bde0a74 100644 --- a/src/mandelbrot.jl +++ b/src/mandelbrot.jl @@ -1,3 +1,14 @@ -function mandelbrot(z, c) - z.^2 + c +type Mandelbrot + c::Array{Complex{Float64}, 2} + z::Array{Complex{Float64}, 2} + + Mandelbrot(imgsize) = ( + line = linspace(-2.0, 2.0, imgsize); + plane = [ x + y*im for x=line, y=line ]; + new(plane, plane) + ) +end + +function step(m::Mandelbrot) + m.z = m.z.^2 + m.c end |