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

SCM Repository

[diderot] Diff of /branches/vis12/test/lic.diderot
ViewVC logotype

Diff of /branches/vis12/test/lic.diderot

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

revision 1330, Mon Jun 13 00:13:54 2011 UTC revision 1334, Mon Jun 13 04:36:50 2011 UTC
# Line 18  Line 18 
18      real xx = lerp(0.0, 3.0, -0.5, real(xi), real(imgSizeX)-0.5);      real xx = lerp(0.0, 3.0, -0.5, real(xi), real(imgSizeX)-0.5);
19      real yy = lerp(0.0, 2.0, -0.5, real(yi), real(imgSizeY)-0.5);      real yy = lerp(0.0, 2.0, -0.5, real(yi), real(imgSizeY)-0.5);
20      vec2 pos0 = [xx,yy];      vec2 pos0 = [xx,yy];
21      vec2 forw = pos0;      vec2 pos = [xx,yy];
22      vec2 back = pos0;      bool forw;
23      output real sum = R(pos0);      output real sum = R(pos0);
24      int step = 0;      int step = 0;
25    
26      update {      update {
         // Euler integration step  
         // forw = forw + h*V(forw);  
         // back = back - h*V(back);  
27          // Midpoint method step          // Midpoint method step
28          forw += h*V(forw + 0.5*h*V(forw));          if (forw) {
29          back -= h*V(back - 0.5*h*V(back));            pos += h*V(pos + 0.5*h*V(pos));
30              sum += R(pos);
31              if (step == stepNum) {
32                forw = false;
33              }
34            } else {  // going backwards, not forward
35              pos -= h*V(pos - 0.5*h*V(pos));
36              sum += R(pos);
37            }
38          sum += R(forw) + R(back);          sum += R(forw) + R(back);
         step += 1;  
39          if (step == stepNum) {          if (step == stepNum) {
40            // modulate output by velocity at initial position            // modulate output by velocity at initial position
41            sum = |V(pos0)|*sum/real(1 + 2*stepNum);            sum = |V(pos0)|*sum/real(1 + 2*stepNum);

Legend:
Removed from v.1330  
changed lines
  Added in v.1334

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