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

SCM Repository

[diderot] Annotation of /branches/charisee/rtest/tests/convo2d1/convo2d1.diderot
ViewVC logotype

Annotation of /branches/charisee/rtest/tests/convo2d1/convo2d1.diderot

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3349 - (view) (download)

1 : jhr 3060 /*! \file convo2d1.diderot
2 :     *
3 :     * \author Gordon Kindlmann
4 :     */
5 : glk 1168
6 : jhr 3060 /*
7 : jhr 3349 * This code is part of the Diderot Project (http://diderot-language.cs.uchicago.edu)
8 :     *
9 :     * COPYRIGHT (c) 2015 The University of Chicago
10 : jhr 3060 * All rights reserved.
11 :     */
12 : glk 1168
13 : glk 1227 int outSize = 201;
14 : glk 1168
15 : jhr 3060 field#1(2)[] F = ctmr ⊛ image("../../data/ddro-115.nrrd");
16 : glk 1168
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,nan,nan];
22 :    
23 :     update {
24 :     vec2 grad = ∇F(pos) if (inside(pos,F))
25 :     else [2000.0,0.0];
26 :     out = [grad[0], grad[1], |grad|];
27 :     stabilize;
28 :     }
29 :     }
30 :    
31 :     initially [ 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