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

SCM Repository

[diderot] View of /examples/iso2d-spatial/data/fsamp3.diderot
ViewVC logotype

View of /examples/iso2d-spatial/data/fsamp3.diderot

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3004 - (download) (annotate)
Sat Mar 7 22:23:04 2015 UTC (4 years, 2 months ago) by glk
File size: 2142 byte(s)
new data
input int sz0 = 40;
input int sz1 = 40;
input int sz2 = 40;
input real width = 4;
vec3 spc = [width/(sz0-1), width/(sz1-1), width/(sz2-1)];

input vec3 pp = [0.2,0.2,0.2];
vec4 qq = normalize([pp[0],pp[1],pp[2],1.0]);
tensor[3,3] rot = [[qq[0]*qq[0] + qq[1]*qq[1] - qq[2]*qq[2] - qq[3]*qq[3],
                    2*(qq[1]*qq[2] - qq[0]*qq[3]),
                    2*(qq[1]*qq[3] + qq[0]*qq[2])],
                   [2*(qq[1]*qq[2] + qq[0]*qq[3]),
                    qq[0]*qq[0] - qq[1]*qq[1] + qq[2]*qq[2] - qq[3]*qq[3],
                    2*(qq[2]*qq[3] - qq[0]*qq[1])],
                   [2*(qq[1]*qq[3] - qq[0]*qq[2]),
                    2*(qq[2]*qq[3] + qq[0]*qq[1]),
                    qq[0]*qq[0] - qq[1]*qq[1] - qq[2]*qq[2] + qq[3]*qq[3]]];
vec3 xdir = rot•[spc[0], 0.0, 0.0];
vec3 ydir = rot•[0.0, spc[1], 0.0];
vec3 zdir = rot•[0.0, 0.0, spc[2]];
vec3 orig = -(xdir*(sz0-1) + ydir*(sz1-1) + zdir*(sz2-1))/2;

function real func(vec3 pos) {
    real x = pos[0];
    real y = pos[1];
    real z = pos[2];
    return x^6 + y^6 + z^6;
}

strand sample(int xi, int yi, int zi) {
  output real vv = 0;
  update {
    if (0 == xi && 0 == yi && 0 == zi) {
      print("NRRD0004\n");
      print("# Complete NRRD file format specification at:\n");
      print("# http://teem.sourceforge.net/nrrd/format.html\n");
      print("type: float\n");
      print("dimension: 3\n");
      print("sizes: ", sz0, " ", sz1, " ", sz2, "\n");
      print("kinds: space space space\n");
      print("endian: little\n");
      print("encoding: raw\n");
      print("space dimension: 3\n");
      print("space directions: (", xdir[0], ",", xdir[1], ",", xdir[2],
                            ") (", ydir[0], ",", ydir[1], ",", ydir[2],
                            ") (", zdir[0], ",", zdir[1], ",", zdir[2], ")\n");
      print("space origin: (", orig[0], ",", orig[1], ",", orig[2], ")\n");
      print("data file: vv.nrrd\n");
      print("byte skip: -1\n");
    }
    vec3 xyz  = orig + xi*xdir + yi*ydir + zi*zdir;
    vv = func(xyz);
    stabilize;
  }
}
initially [ sample(xi, yi, zi) | zi in 0..(sz2-1), yi in 0..(sz1-1), xi in 0..(sz0-1) ];

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