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

SCM Repository

[diderot] View of /branches/vis15/src/tests/glk-tests/new/sline.diderot
ViewVC logotype

View of /branches/vis15/src/tests/glk-tests/new/sline.diderot

Parent Directory Parent Directory | Revision Log Revision Log


Revision 4497 - (download) (annotate)
Sat Sep 3 14:12:36 2016 UTC (2 years, 8 months ago) by jhr
File size: 774 byte(s)
  working on merge: updating tests with new version 2 syntax
#version 2

/*

$DDRO_HOME/branches/vis12/bin/diderotc --exec sline.diderot \
 && ./sline

*/

vec2 [] x0s = load_sequence("seeds.txt");
real h = 0.02;
int stepNum = 180;
input real arrow = 0.4;

field#1(2)[2] V = bspln3 ⊛ load_image("flow.nrrd");
field#1(2)[2] ins = bspln3 ⊛ load_image("flow-crop.nrrd");

strand sline (int ii, vec2 x0) {
  int step = 0;
  vec2 x = x0;
  output vec2[] p = {x0};

  update {
    if (inside(x, ins)) {
      x += h*V(x + 0.5*h*V(x));
      p = p @ x;
    }
    step += 1;
    if (step == stepNum) {
      vec2 a = arrow*V(x);
      vec2 b = 0.4*[-a[1],a[0]];
      p = p @ (x - b);
      p = p @ (x + a);
      p = p @ (x + b);
      p = p @ x;
      stabilize;
    }
  }
}

create_array { sline(ii, x0s[ii]) | ii in 0..length(x0s)-1 }

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