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

SCM Repository

[diderot] Annotation of /branches/vis15/src/tests/rtest/tests/convo2d0-rgb/convo2d0-rgb.diderot
ViewVC logotype

Annotation of /branches/vis15/src/tests/rtest/tests/convo2d0-rgb/convo2d0-rgb.diderot

Parent Directory Parent Directory | Revision Log Revision Log


Revision 4102 - (view) (download)

1 : jhr 4102 /*! \file convo2d0-rgb.diderot
2 :     *
3 :     * \author Gordon Kindlmann
4 :     */
5 :    
6 :     /*
7 :     * This code is part of the Diderot Project (http://diderot-language.cs.uchicago.edu)
8 :     *
9 :     * COPYRIGHT (c) 2015 The University of Chicago
10 :     * All rights reserved.
11 :     */
12 :    
13 :     int outSize = 200;
14 :    
15 :     field#0(2)[3] F = tent ⊛ image("../../data/ddro-115-rgb.nrrd");
16 :    
17 :     strand sample (int ui, int vi) {
18 :     real uu = lerp(0.0, 1.0, -0.5, real(ui), real(outSize)-0.5);
19 :     real vv = lerp(0.0, 1.0, -0.5, real(vi), real(outSize)-0.5);
20 :     vec2 pos = [uu, vv];
21 :     output vec3 out = nan[3];
22 :    
23 :     update {
24 :     out = F(pos) if (inside(pos,F)) else [0, 1, 0];
25 :     stabilize;
26 :     }
27 :     }
28 :    
29 :     grid (2) { 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