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

SCM Repository

[diderot] View of /tests/glk-tests/orig/sline.diderot
ViewVC logotype

View of /tests/glk-tests/orig/sline.diderot

Parent Directory Parent Directory | Revision Log Revision Log


Revision 4640 - (download) (annotate)
Tue Sep 27 20:54:47 2016 UTC (2 years, 9 months ago) by glk
File size: 741 byte(s)
initial result of svn export --username anonsvn --password=anonsvn https://svn.smlnj-gforge.cs.uchicago.edu/svn/diderot/branches/vis15/src/tests/
/*

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

*/

vec2 {} x0s = load("seeds.txt");
real h = 0.02;
int stepNum = 180;
input real arrow = 0.4;

field#1(2)[2] V = bspln3 ⊛ image("flow.nrrd");
field#1(2)[2] ins = bspln3 ⊛ 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;
    }
  }
}

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

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