Home My Page Projects Code Snippets Project Openings diderot

# SCM Repository

[diderot] Diff of /branches/charisee_dev/examples/mode/mode-vr-byhand.diderot
 [diderot] / branches / charisee_dev / examples / mode / mode-vr-byhand.diderot

# Diff of /branches/charisee_dev/examples/mode/mode-vr-byhand.diderot

revision 3306, Fri Oct 16 19:23:34 2015 UTC revision 3307, Fri Oct 16 19:41:04 2015 UTC
# Line 1  Line 1

1  input real isoval = 0.9;  input real isoval = 0.9;
2  input real thick = 0.8;  input real thick = 0.8;
3

4  field#2(3)[3,3] V = c4hexic ⊛ image("slab-c4h-ten9-small.nrrd");  field#2(3)[3,3] V = c4hexic ⊛ image("slab-c4h-ten9-small.nrrd");
//field#2(3)[3,3] E = V - trace(V)*identity[3]/3;

//field#2(3)[3,3] e1=E;
//field#1(3)[3,3,3] dele1=∇⊗e1;
//field#2(3)[] e2=|E|;
//field#1(3)[3] dele2=∇e2;
//field#1(3)[3,3,3] J=∇⊗(E/|E|);
//field#1(3)[3,3,3] J=(e1⊗dele2-e2*dele1)/(e2*e2);

5  field#0(1)[3] cmap = tent ⊛ image("diverg-cmap.nrrd");  field#0(1)[3] cmap = tent ⊛ image("diverg-cmap.nrrd");
6
7  function vec3 color(vec3 x,real k) =cmap(clamp(-1,1,3*sqrt(6)*k/2));  function vec3 color(vec3 x,real k) =cmap(clamp(-1,1,3*sqrt(6)*k/2));
8
9  input real refStep = 1;  input real refStep = 1;

10  input vec3 camEye = [-139.415, 396.62, 451.98];  input vec3 camEye = [-139.415, 396.62, 451.98];
11  input vec3 camAt = [128.432, 126.52, 219.103];  input vec3 camAt = [128.432, 126.52, 219.103];
12  input vec3 camUp = [-0.0213419, -0.0581629, 0.998079];  input vec3 camUp = [-0.0213419, -0.0581629, 0.998079];
# Line 32  Line 19
19  input real phongKd = 0.7;  input real phongKd = 0.7;
20  input real rayStep = 0.4;  input real rayStep = 0.4;
21  input vec3 lightVsp = [-2.0, -3.5, -4.0];  input vec3 lightVsp = [-2.0, -3.5, -4.0];

// (boilerplate) computation of camera and light info
22  real camDist = |camAt - camEye|;  real camDist = |camAt - camEye|;
23  real camNear = camNearAtRel + camDist;  real camNear = camNearAtRel + camDist;
24  real camFar = camFarAtRel + camDist;  real camFar = camFarAtRel + camDist;
# Line 64  Line 49
49
50       tensor [3,3] e1=V (x)- trace(V(x))*identity[3]/3;       tensor [3,3] e1=V (x)- trace(V(x))*identity[3]/3;
51       real e2=sqrt(e1:e1);       real e2=sqrt(e1:e1);

52       vec3 XXXX=(∇(trace(V)))(x);//<<< need to remove trace       vec3 XXXX=(∇(trace(V)))(x);//<<< need to remove trace
53       tensor [3,3,3] dele1=∇⊗V(x)- (XXXX⊗identity[3]/3);       tensor [3,3,3] dele1=∇⊗V(x)- (XXXX⊗identity[3]/3);
54

55       //∇|E|;       //∇|E|;
56      tensor [3,3,3] t4=∇⊗V(x)- (XXXX⊗identity[3]/3);      tensor [3,3,3] t4=∇⊗V(x)- (XXXX⊗identity[3]/3);
57      vec3 t3 =2*(t4:(e1));//product rule      vec3 t3 =2*(t4:(e1));//product rule
# Line 78  Line 60
60      tensor[3,3] probeQ= e1/sqrt(e1:e1); //E/|E|;      tensor[3,3] probeQ= e1/sqrt(e1:e1); //E/|E|;
61      tensor[3,3,3] probedelQ=(e1⊗dele2-e2*dele1)/(e2*e2);      tensor[3,3,3] probedelQ=(e1⊗dele2-e2*dele1)/(e2*e2);
62

63        real qa=probeQ[0,0];        real qa=probeQ[0,0];
64        real qb=probeQ[0,1];        real qb=probeQ[0,1];
65        real qc=probeQ[0,2];        real qc=probeQ[0,2];
# Line 98  Line 78
78        vec3 dqg=probedelQ[2,0,:];        vec3 dqg=probedelQ[2,0,:];
79        vec3 dqh=probedelQ[2,1,:];        vec3 dqh=probedelQ[2,1,:];
80        vec3 dqi=probedelQ[2,2,:];        vec3 dqi=probedelQ[2,2,:];

81  real t0=(qe*qi)-(qf*qh);  real t0=(qe*qi)-(qf*qh);
82  real t1=(qd*qi) -(qf*qg);  real t1=(qd*qi) -(qf*qg);
83  real t2=(qd*qh) -(qe*qg);  real t2=(qd*qh) -(qe*qg);

Legend:
 Removed from v.3306 changed lines Added in v.3307