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

SCM Repository

[diderot] Annotation of /branches/lamont/test/zslice-k1k2.diderot
ViewVC logotype

Annotation of /branches/lamont/test/zslice-k1k2.diderot

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1685 - (view) (download)
Original Path: branches/vis12/test/zslice-k1k2.diderot

1 : jhr 1115
2 :     // 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;
8 :     int dataRes = 110;
9 :     vec3 orig = [0.0, 0.0, 10.0];
10 :     vec3 uVec = [1.0, 0.0, 0.0];
11 :     vec3 vVec = [0.0, 1.0, 0.0];
12 :     field#2(3)[] F = load("../data/quad-patches-pad.nrrd") ⊛ bspln3;
13 :     field#0(2)[3] RGB = load("../data/txf/2d-bow.nrrd") ⊛ tent;
14 :    
15 :     strand sample (int ui, int vi)
16 :     {
17 :     real uu = lerp(-0.5, real(dataRes)-0.5, -0.5, real(ui), real(imgRes)-0.5);
18 :     real vv = lerp(-0.5, real(dataRes)-0.5, -0.5, real(vi), real(imgRes)-0.5);
19 :     output vec3 rgb = [0.0,0.0,0.0];
20 :    
21 :     update
22 :     {
23 :     vec3 pos = orig + uu*uVec + vv*vVec;
24 :     if (inside (pos,F)) {
25 :     vec3 g = -∇F(pos);
26 :     // the "if (g[2] > 0.10)" test is specific to this dataset;
27 :     // it is true when within one of the quadratic patches
28 :     if (g[2] > 0.10) {
29 :     vec3 n = normalize(g);
30 :     tensor[3,3] H = -∇(∇F)(pos);
31 :     tensor[3,3] P = identity[3] - n⊗n;
32 :     tensor[3,3] G = (P•H•P)/|g|;
33 :     real disc = max(0.0, sqrt(2.0*|G|^2 - trace(G)^2));
34 :     real k1 = (trace(G) + disc)/2.0;
35 :     real k2 = (trace(G) - disc)/2.0;
36 :     // correct curvature computation ends here
37 :     k1 = max(-1.0, min(1.0, 5.0*k1));
38 :     k2 = max(-1.0, min(1.0, 5.0*k2));
39 :     rgb = RGB([k1,k2]);
40 :     }
41 :     }
42 :     stabilize;
43 :     }
44 :     }
45 :    
46 :     initially [ sample(ui, vi) | vi in 0..(imgRes-1), ui in 0..(imgRes-1) ];

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