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

SCM Repository

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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2309 - (download) (annotate)
Thu Mar 21 10:57:53 2013 UTC (6 years, 6 months ago) by jhr
File size: 2709 byte(s)
  minor tweaks to resolved bugs
// For testing issues with adding or multiplying a scalar constant
// and a scalar field:
// NOTE: There are 6 different possible definitions of field GG below;
// uncomment one at a time.  The definition inside "update" is the
// only one that isn't a compiler bug, but as explained its not where
// "GG = FF - sclr" would actually be used.

// Process output with:
// unu jhisto -i pos.nrrd -b 200 200 -min 0 0 -max 1 1 | unu 2op neq - 0 | unu quantize -b 8  -o iso2d.png

input real sclr = 1.0;

int gridSize = 200;
int stepsMax = 10;
real epsilon = 0.001;

field#1(2)[] FF = ctmr ⊛ image("../data/ddro.nrrd");
// the following bugs are because the negated sclr is not a global, but after
// normalization it is referenced in the strand body.
/*
** BUG: THIS is where it would make sense to define GG, and it doesn't work:
Internal error after normalization: see log file for details
*/
//field#1(2)[] GG = FF - sclr;
/*
** BUG: For what its worth; this generates the same error
*/
// FIXED
// field#1(2)[] GG = FF * sclr;
strand sample (vec2 pos0) {
    output vec2 pos = pos0;
    int steps = 0;
    /*
    ** BUG: Defining GG here doesn't work, but nor would it be a sensible place
    ** to define the field; all strands should be using the same isocontour
       uncaught exception Fail [Fail: probe: bogus field binding G0183 = RHS(self.G)]
         raised at common/phase-timer.sml:76.50-76.52
         raised at common/phase-timer.sml:76.50-76.52
         raised at high-il/normalize.sml:240.18-242.11
    */
    //field#1(2)[] GG = FF - sclr;
    /*
    ** BUG: For what its worth; this generates the same error
    */
    //field#1(2)[] GG = FF * sclr;
    update {
        /*
        ** Defining "GG = FF - sclr" here works, but its a strange place to
        ** define the field for the sake of doing an isocontour: its not
        ** really isocontouring if the isovalue could possibly change between
        ** update iterations
        */
        //field#1(2)[] GG = FF - sclr;
        /*
        ** BUG: can't multiply field by scalar:
        ** Internal error after translation to MidIL: see log file for details
        */
        field#1(2)[] GG = FF * sclr;
        vec2 grad = ∇GG(pos);
        if (|grad| == 0) {
	    die;
        }
        vec2 delta = -(GG(pos)/|grad|)*normalize(grad);
        if (|delta| < epsilon) {
	    stabilize;
        }
        pos += delta;
        steps += 1;
        if (!inside(pos, GG) || steps > stepsMax) {
	    die;
        }
    }
}

initially { sample([lerp(0.0, 1.0, -0.5, real(ui), real(gridSize)-0.5),
                    lerp(0.0, 1.0, -0.5, real(vi), real(gridSize)-0.5)])
            | vi in 0..(gridSize-1), ui in 0..(gridSize-1) };

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