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

SCM Repository

[diderot] Annotation of /branches/vis12/rtest/tests/sum-ghp/sum-ghp.diderot
ViewVC logotype

Annotation of /branches/vis12/rtest/tests/sum-ghp/sum-ghp.diderot

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1928 - (view) (download)

1 : jhr 1809 /*! \file sum-ghp.diderot
2 :     *
3 :     * \author Gordon Kindlmann
4 :     *
5 :     * does summation of view-space components of Hessian • gradient
6 :     */
7 : glk 1192
8 : jhr 1809 /*
9 :     * COPYRIGHT (c) 2012 The Diderot Project (http://diderot-language.cs.uchicago.edu)
10 :     * All rights reserved.
11 :     */
12 : glk 1194
13 : glk 1192 vec3 camEye = [6.65584, 13.2759, 8.55225];
14 :     vec3 camAt = [0.0, 0.0, 0.0];
15 :     vec3 camUp = [0.0, 0.0, 1.0];
16 :     real camNear = -1.0;
17 :     real camFar = 1.0;
18 :     real camFOV = 6.0;
19 :     int imgResU = 320;
20 :     int imgResV = 240;
21 : glk 1193 real rayStep = 0.06; // HEY: this is large only because program is slow
22 : glk 1192
23 :     real camDist = |camAt - camEye|;
24 :     real camVspNear = camNear + camDist;
25 :     real camVspFar = camFar + camDist;
26 :     vec3 camN = normalize(camAt - camEye);
27 :     vec3 camU = normalize(camN × camUp);
28 :     vec3 camV = camN × camU;
29 :     real camVmax = tan(camFOV*π/360.0)*camDist;
30 :     real camUmax = camVmax*real(imgResU)/real(imgResV);
31 :    
32 : jhr 1928 field#2(3)[] F = bspln3 ⊛ image("../../data/ring.nrrd");
33 : glk 1192
34 :     strand RayCast (int ui, int vi) {
35 :     real rayU = lerp(-camUmax, camUmax, -0.5, real(ui), real(imgResU)-0.5);
36 :     real rayV = lerp(-camVmax, camVmax, -0.5, real(vi), real(imgResV)-0.5);
37 :     vec3 rayVec = (camDist*camN + rayU*camU + rayV*camV)/camDist;
38 :    
39 :     real rayN = camVspNear;
40 : jhr 1809 output vec3 out = [0.0,0.0,0.0];
41 : glk 1192
42 :     update {
43 :     vec3 rayPos = camEye + rayN*rayVec;
44 :     if (inside (rayPos,F)) {
45 : jhr 1383 vec3 prod = ∇⊗∇F(rayPos) • ∇F(rayPos);
46 : jhr 1809 out = out + [prod•camU, prod•camV, prod•camN];
47 : glk 1192 }
48 :     if (rayN > camVspFar)
49 :     stabilize;
50 :     rayN = rayN + rayStep;
51 :     }
52 :     }
53 :    
54 :     initially [ RayCast(ui, vi) | vi in 0..(imgResV-1), ui in 0..(imgResU-1) ];

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