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

SCM Repository

[diderot] View of /tests/vis12-bugs/src/bug021.diderot
ViewVC logotype

View of /tests/vis12-bugs/src/bug021.diderot

Parent Directory Parent Directory | Revision Log Revision Log


Revision 4640 - (download) (annotate)
Tue Sep 27 20:54:47 2016 UTC (2 years, 10 months ago) by glk
File size: 1140 byte(s)
initial result of svn export --username anonsvn --password=anonsvn https://svn.smlnj-gforge.cs.uchicago.edu/svn/diderot/branches/vis15/src/tests/
/*
** BUG with sequences
**
** The output sequence is pathUp, but the modifications to pathDn change
** what is saved in pathUp. The compiler is confusing different sequences.
**
** To visualize results:

./bug021 -moddn false
unu jhisto -i pathUp-data.nrrd -b 300 300 -min -1 -1 -max 1 1 | unu quantize -b 8 -o 0.png
./bug021 -moddn true
unu jhisto -i pathUp-data.nrrd -b 300 300 -min -1 -1 -max 1 1 | unu quantize -b 8 -o 1.png

** 0.png and 1.png should be identical
*/
field#0(2)[2] vv = tent ⊛ image("../data/testvec4.nrrd");

vec2 {} pos0s = {[0.4,0],[-0.4,0]};
int pos0Num = length(pos0s);
input bool moddn = false;

int iterNum = 40;
real hh = 0.04;

strand sline(vec2 pos0) {
  vec2 posUp = pos0;
  vec2 posDn = pos0;
  output vec2{} pathUp = {pos0};
  vec2{} pathDn = {pos0};
  int iter = 0;

  update {
    if (inside(posUp, vv)) {
      posUp -= hh*vv(posUp);
      pathUp = pathUp @ posUp;
    }
    if (moddn && inside(posDn, vv)) {
      posDn += hh*vv(posDn);
      pathDn = pathDn @ posDn;
    }
    iter += 1;
    if (iter > iterNum) {
       stabilize;
    }
  }
}

initially [ sline(pos0s{ii}) | ii in 0..pos0Num-1 ];

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