Skip to content

Commit 530a271

Browse files
author
Stephan Herhut
committed
hyper hyper!
1 parent 42cdbf0 commit 530a271

1 file changed

Lines changed: 13 additions & 18 deletions

File tree

L8_case-study_mandelbrot/mandelbrot.sac

Lines changed: 13 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
#define YRES 3
33
#define EXPAND 128
44

5+
#define INTERACTIVE_ZOOM
6+
57
#define DEPTH 1024
68

79
#ifndef TIER
@@ -44,21 +46,11 @@ int main()
4446

4547

4648
#ifdef INTERACTIVE_ZOOM
47-
zoom_coords = genarray( [2,2], 0);
48-
plane = genarray( [YRES,XRES], toc( 0d));
49-
5049
while( true) {
51-
cmin = all( zoom_coords[[0]] == 0) ? cmin : plane[ zoom_coords[0]];
52-
cmax = all( zoom_coords[[1]] == 0) ? cmax : plane[ zoom_coords[1]];
50+
#endif /* INTERACTIVE_ZOOM */
5351
plane = genComplexArray( [YRES,XRES], cmin, cmax);
54-
expand = EXPAND;
55-
#else
56-
plane = genComplexArray( [YRES,XRES], cmin, cmax);
57-
#endif
52+
5853
while( expand >= 1) {
59-
print( cmin);
60-
print( cmax);
61-
printf( "\n");
6254
ts = escapeTime( plane, DEPTH);
6355

6456
rgbs = intArrayToMonochrome( ts);
@@ -82,21 +74,24 @@ int main()
8274
rgbs = sobelEdges( rgbs);
8375

8476
drawArrayMulti( disp, stretchRgb( rgbs, expand), [1,1]);
85-
#endif
86-
#endif
77+
#endif /* TIER >= 3 */
78+
#endif /* TIER >= 2 */
8779

8880
expand = expand / 2;
8981
plane = genComplexArray( 2*shape(plane), cmin, cmax);
9082
}
9183

9284
#ifdef INTERACTIVE_ZOOM
9385
q, zoom_coords = getSelectionMulti( disp, [2,2]);
86+
cmin = plane[ reverse( 2 * zoom_coords[[0]])];
87+
cmax = plane[ reverse( 2 * zoom_coords[[1]])];
88+
expand = EXPAND;
9489
}
95-
#else
96-
wait = StdIO::fgetc( StdIO::stdin);
97-
#endif
90+
#else /* INTERACTIVE_ZOOM */
91+
wait = StdIO::fgetc( StdIO::stdin);
92+
#endif /* INTERACTIVE_ZOOM */
9893

99-
destroyDisplay( disp);
94+
destroyDisplay( disp);
10095

10196
return(0);
10297
}

0 commit comments

Comments
 (0)