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 1897 - (view) (download)
Original Path: branches/vis12/test/mandel.diderot

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

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