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

SCM Repository

[diderot] Diff of /branches/pure-cfg/test/zslice-k1k2.diderot
ViewVC logotype

Diff of /branches/pure-cfg/test/zslice-k1k2.diderot

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

revision 909, Thu Apr 21 17:54:38 2011 UTC revision 910, Thu Apr 21 18:06:54 2011 UTC
# Line 11  Line 11 
11  vec3 vVec = [0.0, 1.0, 0.0];  vec3 vVec = [0.0, 1.0, 0.0];
12  image(3)[] vol = load("../data/quad-patches-pad.nrrd");  image(3)[] vol = load("../data/quad-patches-pad.nrrd");
13  field#2(3)[] F = vol ⊛ bspln3;  field#2(3)[] F = vol ⊛ bspln3;
14  // HEY (want) some kind of error upon redeclaration  image(2)[3] imgRGB = load("../data/hue.nhdr");
15  // of variables; was getting really confused by error messages  field#0(2)[3] RGB = imgRGB ⊛ tent;
 // associated with having used G both for green image (here)  
 // and geometry tensor (below)  
 image(2)[] imgR = load("../data/hue-0.nrrd"); field#0(2)[] RR = imgR ⊛ tent;  
 image(2)[] imgG = load("../data/hue-1.nrrd"); field#0(2)[] GG = imgG ⊛ tent;  
 image(2)[] imgB = load("../data/hue-2.nrrd"); field#0(2)[] BB = imgB ⊛ tent;  
 //image(2)[3] imgRGB = load("../data/hue.nhdr"); field#0(2)[3] RGB = imgRGB ⊛ tent;  
16    
17  strand RayCast (int ui, int vi)  strand sample (int ui, int vi)
18  {  {
19      real uu = lerp(-0.5, real(dataRes)-0.5, -0.5, real(ui), real(imgRes)-0.5);      real uu = lerp(-0.5, real(dataRes)-0.5, -0.5, real(ui), real(imgRes)-0.5);
20      real vv = lerp(-0.5, real(dataRes)-0.5, -0.5, real(vi), real(imgRes)-0.5);      real vv = lerp(-0.5, real(dataRes)-0.5, -0.5, real(vi), real(imgRes)-0.5);
# Line 30  Line 24 
24      {      {
25          vec3 pos = orig + uu*uVec + vv*vVec;          vec3 pos = orig + uu*uVec + vv*vVec;
26          if (inside (pos,F)) {          if (inside (pos,F)) {
27             vec3 g = -∇F@pos;             vec3 g = -∇F(pos);
28             // the "if (g[2] > 0.10)" test is specific to this dataset;             // the "if (g[2] > 0.10)" test is specific to this dataset;
29             // it assesses if we're within one of the quadratic patches             // it is true when within one of the quadratic patches
30             if (g[2] > 0.10) {             if (g[2] > 0.10) {
31                vec3 n = normalize(g);                vec3 n = normalize(g);
32                tensor[3,3] H = -∇(∇F)@pos; // replace with -∇(∇F)@pos                tensor[3,3] H = -∇(∇F)(pos);
33                tensor[3,3] P = identity[3] - n⊗n;                tensor[3,3] P = identity[3] - n⊗n;
34                tensor[3,3] G = (P•H•P)/|g|;                tensor[3,3] G = (P•H•P)/|g|;
35                real disc = max(0.0, sqrt(2.0*|G|^2 - trace(G)^2));                real disc = max(0.0, sqrt(2.0*|G|^2 - trace(G)^2));
36                real k1 = (trace(G) + disc)/2.0;                real k1 = (trace(G) + disc)/2.0;
37                real k2 = (trace(G) - disc)/2.0;                real k2 = (trace(G) - disc)/2.0;
38                // correct curvature computation ends here                // correct curvature computation ends here
39                k1 = max(-0.99, min(0.99, 4.2*k1));                k1 = max(-1.0, min(1.0, 4.2*k1));
40                k2 = max(-0.99, min(0.99, 4.2*k2));                k2 = max(-1.0, min(1.0, 4.2*k2));
41                vec2 kk = [k1,k2];                rgb = RGB([k1,k2]) if inside([k1,k2],RGB) else [0.0,0.0,0.0];
               rgb = [RR@kk,GG@kk,BB@kk] if inside(kk,RR)  
                     else [0.0,0.0,0.0];  
               //rgb = RGB@kk if inside(kk,RGB) else [0.0,0.0,0.0];  
42             }             }
43          }          }
44          stabilize;          stabilize;
45      }      }
46  }  }
47    
48  initially [ RayCast(ui, vi) | vi in 0..(imgRes-1), ui in 0..(imgRes-1) ];  initially [ sample(ui, vi) | vi in 0..(imgRes-1), ui in 0..(imgRes-1) ];

Legend:
Removed from v.909  
changed lines
  Added in v.910

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