summaryrefslogtreecommitdiffstats
path: root/src/mandelbrot.jl
blob: 9cddee7bf865d93f2e3ac86061dea20b07bc65f0 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
type Mandelbrot{T <: FloatingPoint}
    c::Array{Complex{T}, 2}
    z::Array{Complex{T}, 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{T <: FloatingPoint}(m::Mandelbrot{T})
    m.z = m.z.^2 + m.c
end