summaryrefslogtreecommitdiffstats
path: root/src/fractal.jl
diff options
context:
space:
mode:
Diffstat (limited to 'src/fractal.jl')
-rw-r--r--src/fractal.jl10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/fractal.jl b/src/fractal.jl
index 67c8205..1912d40 100644
--- a/src/fractal.jl
+++ b/src/fractal.jl
@@ -5,17 +5,19 @@ type Fractal{T <: FloatingPoint}
function Fractal(
imgsize::(Integer, Integer),
+ range::(T, T, T, T),
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 = (-2.0, 2.0)
- range_y = (-2.0 * aspect_ratio, 2.0 * aspect_ratio)
+ range_x = (ul_x, ul_x + width)
+ range_y = (ul_y, ul_y + height * aspect_ratio)
else
- range_x = (-2.0 / aspect_ratio, 2.0 / aspect_ratio)
- range_y = (-2.0, 2.0)
+ range_x = (ul_x, ul_x + width / aspect_ratio)
+ range_y = (ul_y, ul_y + height)
end
line_x = linspace(range_x[1], range_x[2], size_x)
line_y = linspace(range_y[1], range_y[2], size_y)