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

SCM Repository

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

View of /branches/vis12/bugs/bug009.diderot

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2193 - (download) (annotate)
Sun Feb 24 11:50:36 2013 UTC (6 years, 7 months ago) by jhr
File size: 1107 byte(s)
 updating comments in bug examples
int imgSize = 400;
real hh = 0.4;    // step size of integration
int stepNum = 30;  // take at most this many steps

// BUG or at least a strangeness in the how a syntax error is reported:
// [bug009.diderot:9.10] Error: syntax error; try inserting "vec4"
//
// The function is missing the return type; why suggest vec4?
//
//   Because vec4 is a type and inserting it will fix the syntax error.
//
function align (vec2 vv, vec2 ref) = vv;

strand HLIC (real sign, vec2 pos0) {
    vec2 lastdir = pos0;
    vec2 pos = pos0;
    vec2 step = [0.0,0.0];
    output real out = 0.0;
    real sum = 0.0;
    int stepIdx = 0;
    vec2 dir = [0.0,0.0];

    update {
      dir = align(pos, lastdir);
      pos += hh*dir;
      sum += |pos|;
      stepIdx += 1;
      lastdir = dir;
      if (stepIdx == stepNum) {
        stabilize;
      }
    }

    stabilize {
      out = sum;
    }
}

initially [ HLIC(lerp(-1, 1, 0, si, 1),
                 [lerp(0.0, 81.0, -0.5, xi, imgSize-0.5),
                  lerp(0.0, 81.0, -0.5, yi, imgSize-0.5)])
            | si in 0..1, yi in 0..imgSize-1, xi in 0..imgSize-1];

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