Skip to content

Commit

Permalink
Trap the case where $height-ratio is too extreme.
Browse files Browse the repository at this point in the history
  • Loading branch information
colomon committed Dec 4, 2011
1 parent f981a75 commit 9ef8787
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions bin/gtk-mandelbrot.pl
Expand Up @@ -2,8 +2,7 @@

use Threads;

my $size = @*ARGS[0] // 321;
$size = +$size;
my $size = +(@*ARGS[0] // 321);
my $max_iterations = 128;

my $upper-right = -2 + (5/4)i;
Expand Down Expand Up @@ -305,11 +304,13 @@ ($obj, $args)
my $upper-right = ($c1.re min $c2.re) + ($c1.im max $c2.im)i;
my $lower-left = ($c1.re max $c2.re) + ($c1.im min $c2.im)i;
my $height-ratio = ($upper-right.im - $lower-left.im) / ($lower-left.re - $upper-right.re);
FractalSet.new(is-julia => False,
upper-right => $upper-right,
delta => ($lower-left.re - $upper-right.re) / $size,
width => ($size / $height-ratio).Int,
height => $size).build-window;
if 0 < $height-ratio < 100 {
FractalSet.new(is-julia => False,
upper-right => $upper-right,
delta => ($lower-left.re - $upper-right.re) / $size,
width => ($size / $height-ratio).Int,
height => $size).build-window;
}
}
}
when 3 {
Expand Down

0 comments on commit 9ef8787

Please sign in to comment.