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

SCM Repository

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

View of /tests/vis12-bugs/src/bug013.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: 1618 byte(s)
initial result of svn export --username anonsvn --password=anonsvn https://svn.smlnj-gforge.cs.uchicago.edu/svn/diderot/branches/vis15/src/tests/
// 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");
//field#1(2)[] GG = FF - sclr;
strand sample (vec2 pos0) {
    output vec2 pos = pos0;
    int steps = 0;
    /*
    ** BUG: Defining GG here doesn't work:
    **
	 uncaught exception Fail [Fail: probe: bogus field binding GG0185 = RHS(self.GG)]
	   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:244.18-246.11
    */
    field#1(2)[] GG = FF - sclr;
    update {
//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