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

SCM Repository

[diderot] View of /branches/vis15/src/tests/rtest/tests/convo2d1/convo2d1.diderot
ViewVC logotype

View of /branches/vis15/src/tests/rtest/tests/convo2d1/convo2d1.diderot

Parent Directory Parent Directory | Revision Log Revision Log


Revision 4497 - (download) (annotate)
Sat Sep 3 14:12:36 2016 UTC (2 years, 8 months ago) by jhr
File size: 793 byte(s)
  working on merge: updating tests with new version 2 syntax
#version 2.0
/*! \file convo2d1.diderot
 *
 * \author Gordon Kindlmann
 */

/*
 * This code is part of the Diderot Project (http://diderot-language.cs.uchicago.edu)
 *
 * COPYRIGHT (c) 2015 The University of Chicago
 * All rights reserved.
 */

int outSize = 201;

field#1(2)[] F = ctmr ⊛ load_image("../../data/ddro-115.nrrd");

strand sample (int ui, int vi) {
   real uu = lerp(0.0, 1.0, -0.5, real(ui), real(outSize)-0.5);
   real vv = lerp(0.0, 1.0, -0.5, real(vi), real(outSize)-0.5);
   vec2 pos = [uu, vv];
   output vec3 out = nan[3];

   update {
      vec2 grad = ∇F(pos) if (inside(pos,F))
                          else [2000.0,0.0];
      out = [grad[0], grad[1], |grad|];
      stabilize;
   }
}

create_array { sample(ui, vi) | vi in 0..(outSize-1), ui in 0..(outSize-1) }

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