Home My Page Projects Code Snippets Project Openings diderot

# SCM Repository

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

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

revision 2368, Fri Apr 12 19:44:00 2013 UTC revision 2369, Tue Apr 16 16:48:02 2013 UTC
# Line 2  Line 2
2  //  //
3  // Demo of distributing particles on the unit circle  // Demo of distributing particles on the unit circle
4  //  //
6  int numOfParticles = length(initPosns)/2;  int numOfParticles = length(initPosns)/2;
7  input int iterMax = 500;  // maximum number of steps to run  input int iterMax = 100;  // maximum number of steps to run
8  input real rr = 0.2;      // actual particle radius  input real rr = 0.2;      // actual particle radius
9  real d = rr + 0.2;                // desired distance for new particles  real d = rr + 0.2;                // desired distance for new particles
10  real stdev = ∞;  real stdev = ∞;
# Line 30  Line 30
30      vec2 posOld1 = pos;   // remember last TWO positions      vec2 posOld1 = pos;   // remember last TWO positions
31      vec2 posOld2 = pos;      vec2 posOld2 = pos;
32      output vec2 outPos = pos;      output vec2 outPos = pos;
33        int id = ii;
34      real energy = ii;     // HEY: can do convergence test based on variance of energies      real energy = ii;     // HEY: can do convergence test based on variance of energies
35      vec2 force = [0,0];   // or can test convergence based on sum of |force|      vec2 force = [0,0];   // or can test convergence based on sum of |force|
36      update {      update {
37
38          if(stdev <= threshold)  {          if(iter >= iterMax)  {
39              stabilize;              stabilize;
40          }          }
41
# Line 76  Line 77
77                  hh *= lerp(0.8, 1.01, 0, okay, 1);                  hh *= lerp(0.8, 1.01, 0, okay, 1);
78              }              }
79          }else {  // we do have neighbors so create new neighbors          }else {  // we do have neighbors so create new neighbors
80              new Particle(-1,pos[0] + d, pos[1] + d);             if(id == 0 && iter == 40) {
81                            new Particle(3,pos[0] + 0.01, pos[1] + 0.01);
82               }
83          }          }
84          outPos = pos;          outPos = pos;
85      }      }

Legend:
 Removed from v.2368 changed lines Added in v.2369