Part 0: preparation |
Part 1: Mandelbrot function |
Part 2: Gray-scale image |
a.out < mand4.txt
Print out their values using printf() to make sure you did this properly.
(-1.25, 0.75) (-0.75, 0.75) (-0.25, 0.75) ( 0.25, 0.75) (-1.25, 0.25) (-0.75, 0.25) (-0.25, 0.25) ( 0.25, 0.25) (-1.25, -0.25) (-0.75, -0.25) (-0.25, -0.25) ( 0.25, -0.25) (-1.25, -0.75) (-0.75, -0.75) (-0.25, -0.75) ( 0.25, -0.75)
(-1.25, 0.75): 2 (-0.75, 0.75): 3 (-0.25, 0.75): 21 ( 0.25, 0.75): 4 (-1.25, 0.25): 8 (-0.75, 0.25): 12 (-0.25, 0.25): 255 ( 0.25, 0.25): 255 (-1.25, -0.25): 8 (-0.75, -0.25): 12 (-0.25, -0.25): 255 ( 0.25, -0.25): 255 (-1.25, -0.75): 2 (-0.75, -0.75): 3 (-0.25, -0.75): 21 ( 0.25, -0.75): 4
Again, check that your code works properly with other data files.( 64.0, 448.0): 2 (192.0, 448.0): 3 (320.0, 448.0): 21 (448.0, 448.0): 4 ( 64.0, 320.0): 8 (192.0, 320.0): 12 (320.0, 320.0): 255 (448.0, 320.0): 255 ( 64.0, 192.0): 8 (192.0, 192.0): 12 (320.0, 192.0): 255 (448.0, 192.0): 255 ( 64.0, 64.0): 2 (192.0, 64.0): 3 (320.0, 64.0): 21 (448.0, 64.0): 4
( 0.0, 384.0): 2 (128.0, 384.0): 3 (256.0, 384.0): 21 (384.0, 384.0): 4 ( 0.0, 256.0): 8 (128.0, 256.0): 12 (256.0, 256.0): 255 (384.0, 256.0): 255 ( 0.0, 128.0): 8 (128.0, 128.0): 12 (256.0, 128.0): 255 (384.0, 128.0): 255 ( 0.0, 0.0): 2 (128.0, 0.0): 3 (256.0, 0.0): 21 (384.0, 0.0): 4
n
. Also, convert
the iteration count t into a gray-scale value using the
formula 1.0 - t/255.0. You are now ready to produce the
PostScript output.
%! 50 50 translate 0 0 512 512 rectstroke 0.992 setgray 0.000 384.000 128.000 128.000 rectfill 0.988 setgray 128.000 384.000 128.000 128.000 rectfill 0.918 setgray 256.000 384.000 128.000 128.000 rectfill 0.984 setgray 384.000 384.000 128.000 128.000 rectfill 0.969 setgray 0.000 256.000 128.000 128.000 rectfill 0.953 setgray 128.000 256.000 128.000 128.000 rectfill 0.000 setgray 256.000 256.000 128.000 128.000 rectfill 0.000 setgray 384.000 256.000 128.000 128.000 rectfill 0.969 setgray 0.000 128.000 128.000 128.000 rectfill 0.953 setgray 128.000 128.000 128.000 128.000 rectfill 0.000 setgray 256.000 128.000 128.000 128.000 rectfill 0.000 setgray 384.000 128.000 128.000 128.000 rectfill 0.992 setgray 0.000 0.000 128.000 128.000 rectfill 0.988 setgray 128.000 0.000 128.000 128.000 rectfill 0.918 setgray 256.000 0.000 128.000 128.000 rectfill 0.984 setgray 384.000 0.000 128.000 128.000 rectfill showpage
Part 3: Color image |
In this part, you will create a glorious color image of the Mandelbrot set.
cp mandgray.c mandcolor.c