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

SCM Repository

[diderot] Annotation of /examples/curve-lic/lic.diderot
ViewVC logotype

Annotation of /examples/curve-lic/lic.diderot

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2872 - (view) (download)

1 : jhr 2872 /*! \file lic.diderot
2 :     *
3 :     * \author John Reppy
4 :     *
5 :     * This Diderot program implements a lic on an iso surface that was discovered by
6 :     * the rcast.diderot program.
7 :     */
8 :    
9 :     /*
10 :     * COPYRIGHT (c) 2015 The Diderot Project (http://diderot-language.cs.uchicago.edu)
11 :     * All rights reserved.
12 :     */
13 :    
14 :     input image(2)[] nDepth; // depth output from RCast phase
15 :     field D = tent ⊛ nDepth;
16 :    
17 :     field#1(2)[2] V = image("data/vfrhand-nohip-smooth.nrrd") ⊛ bspln3;
18 :     field#0(2)[] R = image("data/turb2d.nrrd") ⊛ tent; // noise field
19 :    
20 :     strand LIC (int xi, int yi) {
21 :    
22 :     vec3 pos0 = [xx, yy, -D([xx,yy])]; // viewing plane is X-Y plane looking toward -Z
23 :     vec3 forw = pos0;
24 :     vec3 back = pos0;
25 :     int step = 0;
26 :     output real sum = R(pos0);
27 :    
28 :     /* what I'd like to be able to write:
29 :     initially {
30 :     if (isNan(sum)) {
31 :     stabilize;
32 :     }
33 :     }
34 :     */
35 :    
36 :     update {
37 :     if (isNan(sum)) {
38 :     sum = 0;
39 :     stabilize;
40 :     }
41 :     // Euler integration step
42 :     // forw = forw + h*V(forw);
43 :     // back = back - h*V(back);
44 :     // Midpoint method step
45 :     forw += h*V(forw + 0.5*h*V(forw));
46 :     back -= h*V(back - 0.5*h*V(back));
47 :     sum += R(forw) + R(back);
48 :     step += 1;
49 :     if (step == stepNum) {
50 :     // modulate output by velocity at initial position
51 :     sum = |V(pos0)|*sum/real(1 + 2*stepNum);
52 :     stabilize;
53 :     }
54 :     }
55 :    
56 :     } /* strand LIC */
57 :    
58 :    
59 :     initially [ LIC(xi, yi) | yi in 0..(imgSizeY-1), xi in 0..(imgSizeX-1) ];

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