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

SCM Repository

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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2897 - (download) (annotate)
Fri Feb 27 17:45:41 2015 UTC (4 years, 5 months ago) by glk
File size: 1705 byte(s)
comment about isocontour of curl
input int size0 = 30;
input int size1 = 30;
input real width = 3;
input real shear = 0;
vec2 spacing = [width/(size0-1), width/(size1-1)];

input real theta = 0.0;
tensor[2,2] rot = [[cos(theta),sin(theta)],[-sin(theta),cos(theta)]];
vec2 dir0 = rot•[spacing[0], 0.0];
vec2 dir1 = rot•[0.0, spacing[1]] + shear*dir0;
vec2 orig = -(dir0*(size0-1) + dir1*(size1-1))/2.0;

/*
** This program generates nrrd files that sample (on some oriented grid)
** f(x,y) = [y,-x] with a cosine-line weighting that goes to zero at radius 1
** So the isocontour of vector magnitude should be pairs of circles,
** and isocontour of curl should be circles
*/
function vec2 func(vec2 pos) {
  real x = pos[0];
  real y = pos[1];
  real w = 0.0 if |pos| > 1 else (1+cos(π*|pos|))/2;
  return [y, -x]*w;
}

strand sample(int xi, int yi) {
  output vec2 vv = [0,0];
  update {
    if (0 == xi && 0 == yi) {
      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: 2 ", size0, " ", size1, "\n");
      print("kinds: 2-vector space space\n");
      print("endian: little\n");
      print("encoding: raw\n");
      print("space dimension: 2\n");
      print("space directions: none (", dir0[0], ",", dir0[1],
                            ") (", dir1[0], ",", dir1[1], ")\n");
      print("space origin: (", orig[0], ",", orig[1], ")\n");
      print("data file: vv.nrrd\n");
      print("byte skip: -1\n");
    }
    vv = func(orig + xi*dir0 + yi*dir1);
    stabilize;
  }
}
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