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

SCM Repository

[diderot] Annotation of /branches/charisee/ertest/vispaper/viso2d/fsamp.diderot
ViewVC logotype

Annotation of /branches/charisee/ertest/vispaper/viso2d/fsamp.diderot

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2897 - (view) (download)

1 : glk 2894
2 :     input int size0 = 30;
3 :     input int size1 = 30;
4 :     input real width = 3;
5 :     input real shear = 0;
6 :     vec2 spacing = [width/(size0-1), width/(size1-1)];
7 :    
8 :     input real theta = 0.0;
9 :     tensor[2,2] rot = [[cos(theta),sin(theta)],[-sin(theta),cos(theta)]];
10 :     vec2 dir0 = rot•[spacing[0], 0.0];
11 :     vec2 dir1 = rot•[0.0, spacing[1]] + shear*dir0;
12 :     vec2 orig = -(dir0*(size0-1) + dir1*(size1-1))/2.0;
13 :    
14 :     /*
15 :     ** This program generates nrrd files that sample (on some oriented grid)
16 :     ** f(x,y) = [y,-x] with a cosine-line weighting that goes to zero at radius 1
17 : glk 2897 ** So the isocontour of vector magnitude should be pairs of circles,
18 :     ** and isocontour of curl should be circles
19 : glk 2894 */
20 :     function vec2 func(vec2 pos) {
21 :     real x = pos[0];
22 :     real y = pos[1];
23 :     real w = 0.0 if |pos| > 1 else (1+cos(π*|pos|))/2;
24 :     return [y, -x]*w;
25 :     }
26 :    
27 :     strand sample(int xi, int yi) {
28 :     output vec2 vv = [0,0];
29 :     update {
30 :     if (0 == xi && 0 == yi) {
31 :     print("NRRD0004\n");
32 :     print("# Complete NRRD file format specification at:\n");
33 :     print("# http://teem.sourceforge.net/nrrd/format.html\n");
34 :     print("type: float\n");
35 :     print("dimension: 3\n");
36 :     print("sizes: 2 ", size0, " ", size1, "\n");
37 :     print("kinds: 2-vector space space\n");
38 :     print("endian: little\n");
39 :     print("encoding: raw\n");
40 :     print("space dimension: 2\n");
41 :     print("space directions: none (", dir0[0], ",", dir0[1],
42 :     ") (", dir1[0], ",", dir1[1], ")\n");
43 :     print("space origin: (", orig[0], ",", orig[1], ")\n");
44 :     print("data file: vv.nrrd\n");
45 :     print("byte skip: -1\n");
46 :     }
47 :     vv = func(orig + xi*dir0 + yi*dir1);
48 :     stabilize;
49 :     }
50 :     }
51 :     initially [ sample(xi, yi) | yi in 0..(size1-1), xi in 0..(size0-1) ];

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