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

SCM Repository

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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2137 - (download) (annotate)
Thu Feb 14 12:39:47 2013 UTC (7 years, 1 month ago) by lamonts
File size: 1085 byte(s)
implicit unit-circle example
// unit-circle
//
// Demo of distributing particles on the unit circle 
//
real{} initPosns = load("data/implicit-surface/circlePosns.nrrd");
int numOfParticles = length(initVelocities)/2;
input real r;  // particle radius 
input real d;  // desired difference of radius (d < r && d > 0)
input real R;  // neighbor radius 
input real h;  // integration stepsize scaling ∇E update lenght 
input real maxi; // maximum number of steps in the program 

strand Particle (real posx, real posy) {
    output vec2 pos = [posx,posy];
    real isoval = 1; 
    int steps = 0;

    update {
        real energy = 0.0;
        real force = 0.0; 
        real raduis =0.01; 

        for(Particle neighbor in sphere(raidus) { 
            real d = distance (pos,neighbor.pos);             
            if(d >= 0 && d <= 1) {
                   force += -4.0 * ((1 - d)^3);     
                   energy += ((1 - d)^4); 
             }
        }
        pos = pos + force; 
        pos = pos / |pos|; 
    }
}
initially {Particle(initPosns{i*2},initPosns{i*2+1}) | i in 0 .. numOfParticles-1 };


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