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

SCM Repository

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

Annotation of /trunk/rtest/tests/sum-ghp/sum-ghp.diderot

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1383 - (view) (download)

1 : glk 1192
2 : glk 1194 // sum-ghp:
3 :     //
4 :     // does summation of view-space components of Hessian • gradient
5 :    
6 : glk 1192 vec3 camEye = [6.65584, 13.2759, 8.55225];
7 :     vec3 camAt = [0.0, 0.0, 0.0];
8 :     vec3 camUp = [0.0, 0.0, 1.0];
9 :     real camNear = -1.0;
10 :     real camFar = 1.0;
11 :     real camFOV = 6.0;
12 :     int imgResU = 320;
13 :     int imgResV = 240;
14 : glk 1193 real rayStep = 0.06; // HEY: this is large only because program is slow
15 : glk 1192
16 :     real camDist = |camAt - camEye|;
17 :     real camVspNear = camNear + camDist;
18 :     real camVspFar = camFar + camDist;
19 :     vec3 camN = normalize(camAt - camEye);
20 :     vec3 camU = normalize(camN × camUp);
21 :     vec3 camV = camN × camU;
22 :     real camVmax = tan(camFOV*π/360.0)*camDist;
23 :     real camUmax = camVmax*real(imgResU)/real(imgResV);
24 :    
25 :     field#2(3)[] F = bspln3 ⊛ load("../../data/ring.nrrd");
26 :    
27 :     strand RayCast (int ui, int vi) {
28 :     real rayU = lerp(-camUmax, camUmax, -0.5, real(ui), real(imgResU)-0.5);
29 :     real rayV = lerp(-camVmax, camVmax, -0.5, real(vi), real(imgResV)-0.5);
30 :     vec3 rayVec = (camDist*camN + rayU*camU + rayV*camV)/camDist;
31 :    
32 :     real rayN = camVspNear;
33 :     output vec3 sum = [0.0,0.0,0.0];
34 :    
35 :     update {
36 :     vec3 rayPos = camEye + rayN*rayVec;
37 :     if (inside (rayPos,F)) {
38 : jhr 1383 vec3 prod = ∇⊗∇F(rayPos) • ∇F(rayPos);
39 : glk 1192 sum = sum + [prod•camU, prod•camV, prod•camN];
40 :     }
41 :     if (rayN > camVspFar)
42 :     stabilize;
43 :     rayN = rayN + rayStep;
44 :     }
45 :     }
46 :    
47 :     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