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

SCM Repository

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

Annotation of /branches/fem/test/border-test.diderot

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3349 - (view) (download)

1 : jhr 2962 /* border-test.diderot
2 :     *
3 : jhr 3349 * This code is part of the Diderot Project (http://diderot-language.cs.uchicago.edu)
4 :     *
5 :     * COPYRIGHT (c) 2015 The University of Chicago
6 : jhr 2962 * All rights reserved.
7 :     *
8 :     * Test the border control features.
9 : jhr 3076 *
10 :     * To convert output to PNG:
11 :     *
12 :     * for i in c m w x ; do ; unu quantize -b 8 -i txt$i.nrrd -o txt$i.png; done
13 :     *
14 :     * or
15 :     *
16 :     * unu quantize -b 8 -i txtc.nrrd -o txtc.png
17 :     * unu quantize -b 8 -i txtm.nrrd -o txtm.png
18 :     * unu quantize -b 8 -i txtw.nrrd -o txtw.png
19 :     * unu quantize -b 8 -i txtx.nrrd -o txtx.png
20 : jhr 2962 */
21 :    
22 : jhr 2974 input image(2)[3] Img = image("../data/mandrill.nrrd");
23 : jhr 2962
24 : jhr 2965 //field#0(2)[3] T = tent ⊛ Img;
25 : jhr 3073 //field#0(2)[3] Tb = tent ⊛ border(Img, [0.0, 0.0, 0.0]);
26 : jhr 2965 field#0(2)[3] Tc = tent ⊛ clamp(Img);
27 :     field#0(2)[3] Tm = tent ⊛ mirror(Img);
28 :     field#0(2)[3] Tw = tent ⊛ wrap(Img);
29 : jhr 2975 field#0(2)[3] Tww = tent ⊛ wrap(wrap(Img)); // should be the sams as Tw
30 : jhr 2962 int{2} sz = size(Img);
31 :    
32 :     strand Sample (vec2 pos)
33 :     {
34 : jhr 3073 //output vec3 txtb = nan[3];
35 :     output vec3 txtc = nan[3];
36 :     output vec3 txtm = nan[3];
37 :     output vec3 txtw = nan[3];
38 :     output vec3 txtx = nan[3];
39 : jhr 2962
40 :     update {
41 : jhr 3073 //txtb = Tb(pos);
42 : jhr 2962 txtc = Tc(pos);
43 :     txtm = Tm(pos);
44 :     txtw = Tw(pos);
45 : jhr 2975 if (inside(pos, Tww)) {
46 :     txtx = Tww(pos);
47 :     } else {
48 :     txtx = [0.0, 0.0, 1.0];
49 :     }
50 : jhr 2962 stabilize;
51 :     }
52 :     }
53 :    
54 : jhr 2965 initially [ Sample([real(i), real(j)]) | i in -sz{0} .. 2*sz{0}, j in -sz{1} .. 2*sz{1} ];

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