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 1192 - (view) (download)

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