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

SCM Repository

[diderot] Annotation of /branches/pure-cfg/test/fields.diderot
ViewVC logotype

Annotation of /branches/pure-cfg/test/fields.diderot

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1031 - (view) (download)

1 : glk 1020 // fields
2 :     //
3 :     // documents bugs in field expressions
4 :     // process output with:
5 :     // unu reshape -i mip.txt -s 2 300 200 | unu pad -min 0 0 0 -max 2 M M -b wrap | unu quantize -b 8 -o fields.png
6 : glk 933
7 :    
8 :     int imgSizeX = 300;
9 :     int imgSizeY = 200;
10 :    
11 :     image(2)[2] Vimg = load("../data/vorttest.nrrd");
12 :    
13 : glk 1028 // (1) HEY (BUG) I thought we had scalar multiplication of fields? this:
14 : jhr 1031 field#1(2)[2] Vpos = Vimg ⊛ ctmr;
15 :     field#1(2)[2] V1 = -Vpos;
16 : glk 933 // causes:
17 :     // translate (V00E2, *001E, ...)
18 :     // uncaught exception Fail [Fail: TranslateBasis.translate: unknown basis function *001E]
19 :     // raised at translate/translate-basis.sml:192.41-192.43
20 :     // raised at translate/translate-basis.sml:189.22-189.100
21 :     //
22 : glk 1028 // (2) This also fails:
23 : jhr 1031 field#1(2)[2] V2 = 1.0*(Vimg ⊛ ctmr);
24 : glk 933
25 : glk 1028 // (3) HEY (BUG): can't seem to even assign fields! This also fails:
26 : jhr 1031 //field#1(2)[2] V3 = Vpos;
27 : glk 933
28 : glk 1028 // (4) HEY (BUG): I thought we had addition of fields? This also fails:
29 : jhr 1031 field#1(2)[2] V4 = Vpos + Vpos;
30 : glk 933
31 : jhr 985 // NOTE: these bugs are a symptom of the mishandling of variable scoping.
32 :    
33 : jhr 1031 //image(2)[] Rimg = load("../data/vorttest-rand.nrrd");
34 :     field#0(2)[] R = load("../data/vorttest-rand.nrrd") ⊛ tent;
35 : glk 933
36 :     strand LIC (int xi, int yi) {
37 :     real xx = lerp(0.0, 3.0, -0.5, real(xi), real(imgSizeX)-0.5);
38 :     real yy = lerp(0.0, 2.0, -0.5, real(yi), real(imgSizeY)-0.5);
39 :     vec2 pos = [xx,yy];
40 :     output vec2 v = [0.0,0.0];
41 :    
42 :     update {
43 : jhr 1031 v = (V1(pos) + V2(pos) /* + V3(pos)*/ + V4(pos)) * R(pos);
44 : glk 933 stabilize;
45 :     }
46 :     }
47 :    
48 :     initially [ LIC(xi, yi) | yi in 0..(imgSizeY-1), xi in 0..(imgSizeX-1) ];

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