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 883, Wed Apr 20 13:20:41 2011 UTC revision 884, Wed Apr 20 14:01:16 2011 UTC
# Line 1  Line 1 
1    
2  // quad-k1k2: demo of curvature calculation on quad patch dataset  // quad-k1k2: demo of curvature calculation on quad patch dataset
3    // to process output:
4    // unu reshape -i mip.txt -s 3 200 200 | unu quantize -b 8 -o zslice-k1k2.png
5    //
6    
7  int imgRes = 200;  int imgRes = 200;
8  int dataRes = 110;  int dataRes = 110;
# Line 9  Line 12 
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  // HEY ( want) some kind of error upon redeclaration
15  // of variables; was getting confused by error messages  // of variables; was getting really confused by error messages
16  // associated with having used G both for green image (here)  // associated with having used G both for green image (here)
17  // and geometry tensor (below)  // and geometry tensor (below)
18  image(2)[] imgR = load("../data/hue-0.nrrd"); field#0(2)[] RR = imgR ⊛ tent;  image(2)[] imgR = load("../data/hue-0.nrrd"); field#0(2)[] RR = imgR ⊛ tent;
# Line 27  Line 30 
30      {      {
31          vec3 pos = orig + uu*uVec + vv*vVec;          vec3 pos = orig + uu*uVec + vv*vVec;
32          if (inside (pos,F)) {          if (inside (pos,F)) {
33             vec3 g = ∇F@pos;             vec3 g = -∇F@pos;
34             // the "if (g[2] < -0.10)" test is specific to this dataset;             // the "if (g[2] > 0.10)" test is specific to this dataset;
35             // it assesses if we're within one of the quadratic patches             // it assesses if we're within one of the quadratic patches
36             if (g[2] < -0.10) {             if (g[2] > 0.10) {
37                vec3 n = normalize(g);                vec3 n = normalize(g);
38                tensor[3,3] H = ∇(∇F)@pos;                // HEY BUG: "-∇(∇F)@pos" in line below causes:
39                  // uncaught exception Fail [Fail: Error in compiling zslice-k1k2.diderot]
40                  //  raised at driver/main.sml:31.39-31.76
41                  // while "-∇F@pos" (used above) is okay
42                  tensor[3,3] H = -1.0*∇(∇F)@pos; // replace with -∇(∇F)@pos
43                tensor[3,3] P = identity[3] - n⊗n;                tensor[3,3] P = identity[3] - n⊗n;
44                tensor[3,3] G = (P•H•P)/|g|;                tensor[3,3] G = (P•H•P)/|g|;
45                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));

Legend:
Removed from v.883  
changed lines
  Added in v.884

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