SCM Repository
Annotation of /branches/vis12/bugs/resolved/bug009.diderot
Parent Directory
|
Revision Log
Revision 2685 - (view) (download)
1 : | glk | 2176 | |
2 : | int imgSize = 400; | ||
3 : | real hh = 0.4; // step size of integration | ||
4 : | int stepNum = 30; // take at most this many steps | ||
5 : | |||
6 : | // BUG or at least a strangeness in the how a syntax error is reported: | ||
7 : | jhr | 2193 | // [bug009.diderot:9.10] Error: syntax error; try inserting "vec4" |
8 : | // | ||
9 : | glk | 2176 | // The function is missing the return type; why suggest vec4? |
10 : | jhr | 2193 | // |
11 : | // Because vec4 is a type and inserting it will fix the syntax error. | ||
12 : | // | ||
13 : | glk | 2176 | function align (vec2 vv, vec2 ref) = vv; |
14 : | |||
15 : | strand HLIC (real sign, vec2 pos0) { | ||
16 : | vec2 lastdir = pos0; | ||
17 : | vec2 pos = pos0; | ||
18 : | vec2 step = [0.0,0.0]; | ||
19 : | output real out = 0.0; | ||
20 : | real sum = 0.0; | ||
21 : | int stepIdx = 0; | ||
22 : | vec2 dir = [0.0,0.0]; | ||
23 : | |||
24 : | update { | ||
25 : | dir = align(pos, lastdir); | ||
26 : | pos += hh*dir; | ||
27 : | sum += |pos|; | ||
28 : | stepIdx += 1; | ||
29 : | lastdir = dir; | ||
30 : | if (stepIdx == stepNum) { | ||
31 : | stabilize; | ||
32 : | } | ||
33 : | } | ||
34 : | |||
35 : | stabilize { | ||
36 : | out = sum; | ||
37 : | } | ||
38 : | } | ||
39 : | |||
40 : | initially [ HLIC(lerp(-1, 1, 0, si, 1), | ||
41 : | [lerp(0.0, 81.0, -0.5, xi, imgSize-0.5), | ||
42 : | lerp(0.0, 81.0, -0.5, yi, imgSize-0.5)]) | ||
43 : | | si in 0..1, yi in 0..imgSize-1, xi in 0..imgSize-1]; |
root@smlnj-gforge.cs.uchicago.edu | ViewVC Help |
Powered by ViewVC 1.0.0 |