fractal-bits Claude Heiland-Allen 2012{2019 Contents 1 buddhabrot/bb.c . 3 2 buddhabrot/bbcolourizelayers.c . 10 3 buddhabrot/bbrender.c . 18 4 buddhabrot/bbrenderlayers.c . 26 5 buddhabrot/bound-2.c . 33 6 buddhabrot/bound-2.gnuplot . 34 7 buddhabrot/bound.c . 35 8 buddhabrot/bs.c . 36 9 buddhabrot/bscolourizelayers.c . 37 10 buddhabrot/bsrenderlayers.c . 45 11 buddhabrot/cusp.c . 50 12 buddhabrot/expectmu.c . 51 13 buddhabrot/histogram.c . 57 14 buddhabrot/Makefile . 58 15 buddhabrot/spectrum.ppm . 59 16 buddhabrot/tip.c . 59 17 burning-ship-series-approximation/BossaNova2.cxx . 60 18 burning-ship-series-approximation/BossaNova.hs . 81 19 burning-ship-series-approximation/.gitignore . 90 20 burning-ship-series-approximation/Makefile . 90 21 .gitignore . 90 22 julia/.gitignore . 91 23 julia-iim/julia-de.c . 91 24 julia-iim/julia-iim.c . 94 25 julia-iim/julia-iim-rainbow.c . 94 26 julia-iim/julia-lsm.c . 98 27 julia-iim/Makefile . 100 28 julia/j-render.c . 100 29 mandelbrot-delta-cl/cl-extra.cc . 110 30 mandelbrot-delta-cl/delta.cl . 111 31 mandelbrot-delta-cl/Makefile . 116 32 mandelbrot-delta-cl/mandelbrot-delta-cl.cc . 117 33 mandelbrot-delta-cl/mandelbrot-delta-cl-exp.cc . 134 34 mandelbrot-delta-cl/README . 139 35 mandelbrot-delta-cl/render-library.sh . 142 36 mandelbrot-delta-cl/sft-library.txt . 142 37 mandelbrot-laurent/DM.gnuplot . 146 38 mandelbrot-laurent/Laurent.hs . 146 39 mandelbrot-laurent/Main.hs . 147 40 mandelbrot-series-approximation/args.h . 148 41 mandelbrot-series-approximation/emscripten.cpp . 150 42 mandelbrot-series-approximation/index.html . 152 2 fractal-bits buddhabrot/bb.c 43 mandelbrot-series-approximation/Makefile . 153 44 mandelbrot-series-approximation/Makefile.emscripten . 153 45 mandelbrot-series-approximation/m.cpp . 153 46 mandelbrot-series-approximation/pre.js . 177 47 mandelbrot-winding/Makefile . 178 48 mandelbrot-winding/winding.c . 178 49 pjulia-mdem/Makefile . 179 50 pjulia-mdem/pjulia.c . 180 51 pjulia-mdem/pjulia.hs . 190 52 README . 193 53 trustworthy-anti-buddhagram/.gitignore . 193 54 trustworthy-anti-buddhagram/hyper-voxel-viewer.cpp . 193 55 trustworthy-anti-buddhagram/Makefile . 198 56 trustworthy-anti-buddhagram/trustworthy-anti-buddhagram.cpp . 198 57 ultimate-anti-buddha/anti.c . 212 58 ultimate-anti-buddha/geometry.h . 216 59 ultimate-anti-buddha/.gitignore . 222 60 ultimate-anti-buddha/Makefile . 222 61 ultimate-anti-buddha/UltimateAntiBuddhagram.c . 223 62 ultimate-anti-buddha/UltimateAntiBuddhagram.frag . 243 63 z-to-exp-z-plus-c/Makefile . 248 64 z-to-exp-z-plus-c/z-to-exp-z-plus-c.c . 248 65 z-to-exp-z-plus-c/z-to-exp-z-plus-c.frag . 252 66 z-to-exp-z-plus-c/z-to-exp-z-plus-c-henriksen.c . 255 67 z-to-exp-z-plus-c/z-to-exp-z-plus-c-lyapunov.c . 258 1 buddhabrot/bb.c // gcc −std=c99 −Wall −pedantic −Wextra −O3 −fopenmp −lm −o bb bb . c // . / bb j pnmsplit − %d . pgm #i n c l u d e <complex . h> 5 #i n c l u d e <math . h> #i n c l u d e <s t d i o . h> #i n c l u d e <s t d l i b . h> #i n c l u d e <s t r i n g . h> 10 typedef unsigned char B; typedef unsigned int N; typedef int Z; typedef double R; typedef double Complex C; 15 #define S 1024 R accum[S][S]; B img[S][S]; 20 static inline C to s c r e e n (C x ) f return S ∗ ( 0 . 2 ∗ x + ( 0 . 5 + I ∗ 0 . 5 ) ) ; 25 g 3 fractal-bits buddhabrot/bb.c static inline C from s c r e e n (C x ) f 30 return ( x / S − ( 0 . 5 + I ∗ 0 . 5 ) ) ∗ 5 . 0 ; g static inline R cabs2(C z) f return creal(z) ∗ creal(z) + cimag(z) ∗ cimag ( z ) ; g 35 static void clear() f #pragma omp parallel for 40 f o r (Z y = 0 ; y < S ; ++y) f o r (Z x = 0 ; x < S ; ++x) accum[y][x] = 0; g 45 static inline void plot(Z x, Z y, R f) f if (! (isnan(f) j j i s i n f ( f ) ) ) f 50 #pragma omp atomic update accum[y][x] += f; g g 55 static void post() f R m = 0 ; f o r (Z y = 0 ; y < S / 2 ; ++y) 60 f o r (Z x = 0 ; x < S ; ++x) m = fmax(m, accum[y][x] + accum[S−1−y ] [ x ] ) ; fprintf(stderr , "%.18f nn " , m) ; m = 255 / m; #pragma omp parallel for 65 f o r (Z y = 0 ; y < S / 2 ; ++y) f o r (Z x = 0 ; x < S ; ++x) img[y][x] =m ∗ (accum[y][x] + accum[S−1−y ] [ x ] ) ; #pragma omp parallel for f o r (Z y = 0 ; y < S / 2 ; ++y) 70 f o r (Z x = 0 ; x < S ; ++x) img [ S−1−y][x] = img[y][x]; g 75 static void save() f fprintf(stdout , "P5nn%d %dnn255nn " , S , S ) ; fwrite(&img[0][0] , S ∗ S, 1, stdout); fflush(stdout); 80 g static inline R cross(C a, C b) 4 fractal-bits buddhabrot/bb.c f 85 return creal(a) ∗ cimag ( b ) − cimag ( a ) ∗ c r e a l ( b ) ; g static inline N inside(C a, C b, C c) 90 f return cross(a − b , c − b ) < 0 ; g 95 // https://en. wikipedia .org/wiki/Line%E2%80%93line intersection#⤦ Ç G i v e n t w o p o i n t s o n e a c h l i n e static inline C intersect(C a, C b, C c, C d) f R x1 = creal(a); R y1 = cimag(a); 100 R x2 = creal(b); R y2 = cimag(b); R x3 = creal(c); R y3 = cimag(c); R x4 = creal(d); 105 R y4 = cimag(d); R x = ( x1 ∗ y2 − y1 ∗ x2 ) ∗ ( x3 − x4 ) − ( x1 − x2 ) ∗ ( x3 ∗ y4 − y3 ∗ x4 ) ; R y = ( x1 ∗ y2 − y1 ∗ x2 ) ∗ ( y3 − y4 ) − ( y1 − y2 ) ∗ ( x3 ∗ y4 − y3 ∗ x4 ) ; R z = ( x1 − x2 ) ∗ ( y3 − y4 ) − ( y1 − y2 ) ∗ ( x3 − x4 ) ; i f ( z == 0) 110 return a ; return ( x + I ∗ y ) / z ; g 115 // https://en. wikipedia . org/wiki/Sutherland%E2%80%93Hodgman algorithm#⤦ Ç Pseudo code static R coverage(C a, C b, C c) f C c l i p polygon[3][2] = f f a , b g , f b , c g , f c , a g g ; R nan = 0.0 / 0.0; 120 C subject[2][16] = f f 0, 1, 1 + I, I, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, ⤦ Ç nan , nan g , f nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, ⤦ Ç nan , nan g g ; N count = 4 ; 125 N s o u r c e c o u n t = 4 ; N source = 1 ; for (N edge = 0; edge < 3 ; ++edge ) f source = 1 − source ; 130 s o u r c e count = count; count = 0 ; C e0 = c l i p polygon[edge][0]; C e1 = c l i p polygon[edge][1]; C s = 0 ; 135 i f ( s o u r c e c o u n t > 0) s = subject[source][source c o u n t − 1 ] ; 5 fractal-bits buddhabrot/bb.c f o r (N i = 0 ; i < s o u r c e c o u n t ; ++i ) f C e = subject[source][i]; 140 if (inside(e, e0, e1)) f if (! inside(s, e0, e1)) s u b j e c t [1 − source][count++] = intersect(s, e, e0, e1); s u b j e c t [1 − source ][count++] = e; 145 g else if (inside(s, e0, e1)) s u b j e c t [1 − source][count++] = intersect(s, e, e0, e1); s = e ; g 150 g source = 1 − source ; // clipped polgon in subject[source][[0..count)] R cover = 0 ; C p.
Details
-
File Typepdf
-
Upload Time-
-
Content LanguagesEnglish
-
Upload UserAnonymous/Not logged-in
-
File Pages261 Page
-
File Size-