Skip to content

Commit 00d5e6b

Browse files
committed
Improved mandelbrot simple
1 parent e4e08ca commit 00d5e6b

1 file changed

Lines changed: 9 additions & 6 deletions

File tree

L8_case-study_mandelbrot/mandelbrot_simple.sac

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
#define XRES 6
22
#define YRES 4
3-
#define EXPAND 64
3+
#define EXPAND 128
44

5-
#define DEPTH 1024
5+
#define DEPTH 2048
66

77
use Structures: all;
88
use SDLdisplay: all;
99
use StdIO : all;
1010

1111
use Fractal_tier1 : all;
12+
use Fractal_tier2 : all;
1213

1314
inline
1415
color[.,.] stretchRgb( color[.,.] pic, int stretch)
@@ -35,19 +36,21 @@ int main()
3536
do {
3637
plane = genComplexArray( cur_shape, cmin[[0]], cmax[[0]]);
3738

38-
ts = escapeTime( plane, DEPTH);
39+
ts, vs = escapeTimeAndValue( plane, DEPTH);
3940

40-
rgbs = intArrayToMonochrome( ts);
41+
nvs = normalizedIterationCount( ts, vs);
42+
rgbs = doubleArrayToRGB( nvs);
4143

4244
drawArray( disp, stretchRgb( rgbs, expand));
4345

4446
expand = expand / 2;
4547
cur_shape = 2 * cur_shape;
4648
} while ( expand >= 1);
4749

48-
#if 0
50+
#if 1
4951
zoom_coords = getSelection( disp);
50-
if (all( zoom_coords >= 0)) {
52+
53+
if (all( (zoom_coords[1] - zoom_coords[0]) > 0)) {
5154
cmin = [plane[ zoom_coords[[0]]]] ++ cmin;
5255
cmax = [plane[ zoom_coords[[1]]]] ++ cmax;
5356
} else {

0 commit comments

Comments
 (0)