diff options
author | Jesse Luehrs <doy@tozt.net> | 2014-10-28 02:08:19 -0400 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2014-10-28 02:08:19 -0400 |
commit | f5e418897ab4c1e755d84a8281681b702dec80f9 (patch) | |
tree | 21af9f8876f2143b2c6287bd9d26cbdbdbde94ab /src/fractal.jl | |
parent | 83c26e19bac20cf6a9e3456cdec7d5c52ebf3fb8 (diff) | |
download | julia-fractals-f5e418897ab4c1e755d84a8281681b702dec80f9.tar.gz julia-fractals-f5e418897ab4c1e755d84a8281681b702dec80f9.zip |
there's already a type for this
Diffstat (limited to 'src/fractal.jl')
-rw-r--r-- | src/fractal.jl | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/src/fractal.jl b/src/fractal.jl index 1912d40..f2a9bec 100644 --- a/src/fractal.jl +++ b/src/fractal.jl @@ -5,19 +5,18 @@ type Fractal{T <: FloatingPoint} function Fractal( imgsize::(Integer, Integer), - range::(T, T, T, T), + bb::Base.Graphics.BoundingBox, make_c::Function, step::Function ) - (ul_x, ul_y, width, height) = range (size_x, size_y) = imgsize aspect_ratio = size_y / size_x if size_x < size_y - range_x = (ul_x, ul_x + width) - range_y = (ul_y, ul_y + height * aspect_ratio) + range_x = (bb.xmin, bb.xmax) + range_y = (bb.ymin, bb.ymin + (bb.ymax - bb.ymin) * aspect_ratio) else - range_x = (ul_x, ul_x + width / aspect_ratio) - range_y = (ul_y, ul_y + height) + range_x = (bb.xmin, bb.xmin + (bb.xmax - bb.xmin) / aspect_ratio) + range_y = (bb.ymin, bb.ymax) end line_x = linspace(range_x[1], range_x[2], size_x) line_y = linspace(range_y[1], range_y[2], size_y) |