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

SCM Repository

[diderot] Diff of /branches/fem/examples/mip_d3s/mip_d3s.diderot
ViewVC logotype

Diff of /branches/fem/examples/mip_d3s/mip_d3s.diderot

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 3233, Tue Aug 11 15:07:12 2015 UTC revision 3234, Fri Aug 14 13:35:44 2015 UTC
# Line 13  Line 13 
13  //  //
14  // does maximum intensity projection  // does maximum intensity projection
15    
16  input vec3 camEye = [6.65584, 13.2759, 8.55225];  input vec3 camEye = [-1,-1,-10];
17  input vec3 camAt = [0.0, 0.0, 0.0];  input vec3 camAt = [0.25,0.25,0.25];
18  input vec3 camUp = [0.0, 0.0, 1.0];  input vec3 camUp = [0.0, 0.0, 1.0];
19  input real camNear = -1.0;  input real camNear = -1.0;
20  input real camFar = 1.0;  input real camFar = 1.0;
21  input real camFOV = 6.0;  input real camFOV = 20.0;
22  input int imgResU = 320;  input int imgResU ;
23  input int imgResV = 240;  input int imgResV ;
24  input real rayStep = 0.03;  input real rayStep = 0.03;
25    
26    
# Line 33  Line 33 
33  real camVmax = tan(camFOV*π/360.0)*camDist;  real camVmax = tan(camFOV*π/360.0)*camDist;
34  real camUmax = camVmax*real(imgResU)/real(imgResV);  real camUmax = camVmax*real(imgResU)/real(imgResV);
35    
 //field#0(3)[] F = tent ⊛ image("../../data/ring.nrrd");  
36  input fem#0(3)[] m;  input fem#0(3)[] m;
37  field#0(3)[] F = toField(m);  field#0(3)[] F = toField(m);
38    
39    
40  strand RayCast (int ui, int vi) {  strand RayCast (int ui, int vi) {
41    
42      real rayU = lerp(-camUmax, camUmax, -0.5, real(ui), real(imgResU)-0.5);      real rayU = lerp(-camUmax, camUmax, -0.5, real(ui), real(imgResU)-0.5);
43      real rayV = lerp(-camVmax, camVmax, -0.5, real(vi), real(imgResV)-0.5);      real rayV = lerp(-camVmax, camVmax, -0.5, real(vi), real(imgResV)-0.5);
44    
45      vec3 rayVec = (camDist*camN + rayU*camU + rayV*camV)/camDist;      vec3 rayVec = (camDist*camN + rayU*camU + rayV*camV)/camDist;
46    
47      real rayN = camVspNear;      real rayN = camVspNear;
48      output real out = -0.6;      output real out = -0.6;
49    
50    
51    
52      update {      update {
53          vec3 rayPos = camEye + rayN*rayVec;          vec3 rayPos = camEye + rayN*rayVec;
54          if (inside (rayPos,F)) {          if (inside (rayPos,F)) {
55            out = max(out, F(rayPos));            out = max(out, F(rayPos));
56          }          }
57          if (rayN > camVspFar)          if (rayN > camVspFar)
58    
59              stabilize;              stabilize;
60          rayN += rayStep;          rayN += rayStep;
61      }      }
62  }  }
   
63  initially [ RayCast(ui, vi) | vi in 0..(imgResV-1), ui in 0..(imgResU-1) ];  initially [ RayCast(ui, vi) | vi in 0..(imgResV-1), ui in 0..(imgResU-1) ];

Legend:
Removed from v.3233  
changed lines
  Added in v.3234

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