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

SCM Repository

[diderot] View of /branches/vis12/bugs/resolved/bug024.diderot
ViewVC logotype

View of /branches/vis12/bugs/resolved/bug024.diderot

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2343 - (download) (annotate)
Sat Apr 6 13:16:09 2013 UTC (6 years, 4 months ago) by jhr
File size: 1452 byte(s)
  Fix bug024 (sequence append/prepend of expressions).
vec2 {} x0s = load("../data/seeds.txt");
int x0num = length(x0s);
real h = 0.02;
int stepNum = 130;
input real arrow = 0.4;

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

strand sline (int ii, vec2 x0) {
  int step = 0;
  vec2 xf = x0;
  output vec2{} path = {x0};
    vec2 aa = [0,0];
    vec2 bb = [0,0];

  update {
    if (inside(xf, ins))
      xf += h*V(xf + 0.5*h*V(xf));
    if (inside(xf, ins))
      path = path @ xf;
    step += 1;
    if (step == stepNum) {
      vec2 f = arrow*V(xf);
      vec2 p = 0.4*[-f[1],f[0]];
      /* BUG:  can't append an expression to a sequence:
bug024.c:460:66: error: address expression must be an lvalue or a function designator
                Diderot_DynSeqAppend(sizeof(vec2f_t), l_path_99, &(l__t_152+l_p_151)),...
                                                                 ^ ~~~~~~~~~~~~~~~~
     */
      path = path @ (xf - f + p);
      path = path @ (xf - f - p);
      path = path @ xf;
      /* and BUG: try making local variables for these, as with: */
      vec2 aa = (xf - f + p);
      vec2 bb = (xf - f - p);
      path = path @ aa;
      path = bb @ path;
      path = path @ xf;
      /* that won't work either.  and BUG, nor can you make aa and bb local to update.
      It only works if aa and bb are strand variables */
      stabilize;
    }
  }
}

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

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