Home My Page Projects Code Snippets Project Openings diderot
Summary Activity Tracker Tasks SCM

SCM Repository

[diderot] Annotation of /branches/fem/test/mandel.diderot
ViewVC logotype

Annotation of /branches/fem/test/mandel.diderot

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1904 - (view) (download)
Original Path: branches/vis12/test/mandel.diderot

1 : glk 1904
2 :    
3 : glk 1894 // ../bin/diderotc --exec mandel.diderot && ./mandel && unu quantize -b 8 -i rgb.nrrd -o mandel.png
4 : glk 1893
5 :     // Global definitions
6 : glk 1904 input int reso = 2000;
7 :     input int maxiter = 2000;
8 :     input vec2 center = [-1.2, -0.3]; // [0.0,0.0] for whole thing
9 :     input real fov = 0.15; // 2.0 for whole thing
10 : glk 1893
11 :     // Strand definition
12 : glk 1897 strand mandel(vec2 c) {
13 : glk 1893 vec2 z = [0.0, 0.0];
14 :     int iter = 0;
15 :     output vec3 rgb = [0.0, 0.0, 0.0];
16 :     update {
17 :     z = [z[0]^2 - z[1]^2, 2.0*z[0]*z[1]] + c; // z = z^2 + c
18 :     iter += 1;
19 :     if (z•z > 4.0) {
20 :     // point has escaped; set color based on iteration
21 :     real t = 11.0*real(iter)^0.2;
22 :     rgb = [sin(t), sin(t + 2.0*π/3.0), sin(t - 2.0*π/3.0)];
23 : glk 1895 rgb = ([1.7, 1.7, 1.7] + rgb)/2.7;
24 : glk 1893 stabilize;
25 :     }
26 :     if (iter > maxiter) {
27 :     rgb = [0.0, 0.0, 0.0];
28 :     stabilize;
29 :     }
30 :     }
31 :     }
32 :    
33 :     // Strand initialization
34 : glk 1904 initially [ mandel([lerp(center[0]-fov, center[0]+fov,
35 :     1.0, real(crIdx), real(reso)),
36 :     lerp(center[1]-fov, center[1]+fov,
37 :     1.0, real(ciIdx), real(reso))])
38 : glk 1897 | ciIdx in 1..reso, crIdx in 1..reso ];

root@smlnj-gforge.cs.uchicago.edu
ViewVC Help
Powered by ViewVC 1.0.0