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

SCM Repository

[diderot] View of /branches/vis15/src/tests/new-tests/border-test.diderot
ViewVC logotype

View of /branches/vis15/src/tests/new-tests/border-test.diderot

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3803 - (download) (annotate)
Tue May 3 18:00:31 2016 UTC (3 years, 1 month ago) by jhr
File size: 1384 byte(s)
  add data for border test
/* border-test.diderot
 *
 * This code is part of the Diderot Project (http://diderot-language.cs.uchicago.edu)
 *
 * COPYRIGHT (c) 2015 The University of Chicago
 * All rights reserved.
 *
 * Test the border control features.
 *
 * To convert output to PNG:
 *
 *	for i in c m w x ; do ; unu quantize -b 8 -i txt$i.nrrd -o txt$i.png; done
 *
 * or
 *
 *	unu quantize -b 8 -i txtc.nrrd -o txtc.png
 *	unu quantize -b 8 -i txtm.nrrd -o txtm.png
 *	unu quantize -b 8 -i txtw.nrrd -o txtw.png
 *	unu quantize -b 8 -i txtx.nrrd -o txtx.png
 */

input image(2)[3] Img = image("data/mandrill.nrrd");

//field#0(2)[3] T = tent ⊛ Img;
//field#0(2)[3] Tb = tent ⊛ border(Img, [0.0, 0.0, 0.0]);
field#0(2)[3] Tc = tent ⊛ clamp(Img);
field#0(2)[3] Tm = tent ⊛ mirror(Img);
field#0(2)[3] Tw = tent ⊛ wrap(Img);
field#0(2)[3] Tww = tent ⊛ wrap(wrap(Img));  // should be the sams as Tw
int{2} sz = size(Img);

strand Sample (vec2 pos)
{
    //output vec3 txtb = nan[3];
    output vec3 txtc = nan[3];
    output vec3 txtm = nan[3];
    output vec3 txtw = nan[3];
    output vec3 txtx = nan[3];

    update {
	//txtb = Tb(pos);
	txtc = Tc(pos);
	txtm = Tm(pos);
	txtw = Tw(pos);
        if (inside(pos, Tww)) {
	    txtx = Tww(pos);
	} else {
	    txtx = [0.0, 0.0, 1.0];
	}
	stabilize;
    }
}

initially [ Sample([real(i), real(j)]) | i in -sz{0} .. 2*sz{0}, j in -sz{1} .. 2*sz{1} ];

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