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

SCM Repository

[diderot] View of /branches/vis12/bugs/open/bug052.diderot
ViewVC logotype

View of /branches/vis12/bugs/open/bug052.diderot

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3373 - (download) (annotate)
Thu Nov 5 19:01:17 2015 UTC (4 years, 8 months ago) by glk
File size: 1253 byte(s)
inside() doesn't on 1D fields
/*
** BUG: inside" doesn't seem to work on 1D fields;
** compiling with: ../../bin/diderotc --exec bug052.diderot
** generates:

[bug052.diderot:32.17-26] Error: type error in application of 'inside'
  expected:  (tensor['dim00FC] * field#'diff00FD('dim00FC)'shp00FB)
  but found: (real * field#1(1)[])
[bug052.diderot:16.1-44.0] Error: program does not have any strands

synthetic data generated with:
echo 1 | unu reshape -s 1 | unu pad -min -15 -max M+15 -b pad -v 0 | unu dnorm -o data1D.nrrd
echo 1 | unu pad -min -15 -15 -max M+15 M+15 -b pad -v 0 | unu dnorm -o data2D.nrrd
*/

field#1(2)[] G = image("../data/data2D.nrrd") ⊛ bspln3;
field#1(1)[] F = image("../data/data1D.nrrd") ⊛ bspln3;

strand foo (int xi, int yi) {
   real xx = lerp(0, 30, 0, xi, 2);
   real yy = lerp(0, 30, 0, yi, 2);
   vec2 pos2 = [xx,yy];
   real pos1 = xx;
   output real out = 0;
   int ins = 0;

   update {
      if (inside(pos2, G)) { // this works fine
         out += G(pos2);
         ins += 1;
      }
      if (inside(pos1, F)) { // this fails; how should inside() be called?
         out += F(pos1);
         ins += 1;
      }
      if (0 == ins) {
         out = -1;
      }
      stabilize;
   }
}

initially [ foo(xi, yi) | yi in 0..2, xi in 0..2 ];

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