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

SCM Repository

[diderot] Diff of /branches/lamont/test/implicit-surface/unit-circle.diderot
ViewVC logotype

Diff of /branches/lamont/test/implicit-surface/unit-circle.diderot

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

revision 2244, Sun Mar 3 01:24:09 2013 UTC revision 2245, Sun Mar 3 12:51:51 2013 UTC
# Line 66  Line 66 
66              }              }
67              // take step and re-find implicit surface              // take step and re-find implicit surface
68              pos = normalize(pos + step);              pos = normalize(pos + step);
69              // oscillating if moved close to where we were two steps ago              real travel = |pos - posOld1| + |posOld1 - posOld2|;
70              real osci = |pos - posOld2|/|pos - posOld1|;              if (travel > 0) {
71              if (osci < 0.1) {                  // if we've moved in the past two steps, but we've moved back
72                  // altering step size slightly disrupts oscillation                  // to where we were two steps ago, we're oscillating ==>
73                  hh *= 0.9;                  // okay = 0. Two steps in the same direction ==> okay = 1.
74                    real okay = |pos - posOld2|/travel;
75                    // slow down if oscillating, speed up a little if not
76                    hh *= lerp(0.8, 1.01, 0, okay, 1);
77              }              }
78          }          }
79    

Legend:
Removed from v.2244  
changed lines
  Added in v.2245

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