diff options
author | Jesse Luehrs <doy@tozt.net> | 2014-10-25 10:23:26 -0400 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2014-10-25 10:23:26 -0400 |
commit | 98292bb163c83b9d2472e286a4e5d034cff028ce (patch) | |
tree | f6a13997da72dda3046a670a1c10466e511eebba | |
parent | 264fa55dcf2d72d8ddf0bb6fd96be29e4e57d666 (diff) | |
download | julia-fractals-98292bb163c83b9d2472e286a4e5d034cff028ce.tar.gz julia-fractals-98292bb163c83b9d2472e286a4e5d034cff028ce.zip |
make this parameterized
-rw-r--r-- | examples/mandelbrot.jl | 2 | ||||
-rw-r--r-- | src/mandelbrot.jl | 8 |
2 files changed, 5 insertions, 5 deletions
diff --git a/examples/mandelbrot.jl b/examples/mandelbrot.jl index ab618d4..a9cfcae 100644 --- a/examples/mandelbrot.jl +++ b/examples/mandelbrot.jl @@ -8,7 +8,7 @@ iterations = 45 imgsize = 500 img = [ Color.HSV(0, 0, 0) for x=1:imgsize, y=1:imgsize ] -m = Fractal.Mandelbrot(imgsize) +m = Fractal.Mandelbrot{Float64}(imgsize) imgc, imgslice = view(img) diff --git a/src/mandelbrot.jl b/src/mandelbrot.jl index bde0a74..9cddee7 100644 --- a/src/mandelbrot.jl +++ b/src/mandelbrot.jl @@ -1,6 +1,6 @@ -type Mandelbrot - c::Array{Complex{Float64}, 2} - z::Array{Complex{Float64}, 2} +type Mandelbrot{T <: FloatingPoint} + c::Array{Complex{T}, 2} + z::Array{Complex{T}, 2} Mandelbrot(imgsize) = ( line = linspace(-2.0, 2.0, imgsize); @@ -9,6 +9,6 @@ type Mandelbrot ) end -function step(m::Mandelbrot) +function step{T <: FloatingPoint}(m::Mandelbrot{T}) m.z = m.z.^2 + m.c end |