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

SCM Repository

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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2137 - (view) (download)

1 : lamonts 2131 // unit-circle
2 :     //
3 :     // Demo of distributing particles on the unit circle
4 :     //
5 : lamonts 2137 real{} initPosns = load("data/implicit-surface/circlePosns.nrrd");
6 :     int numOfParticles = length(initVelocities)/2;
7 :     input real r; // particle radius
8 :     input real d; // desired difference of radius (d < r && d > 0)
9 :     input real R; // neighbor radius
10 :     input real h; // integration stepsize scaling ∇E update lenght
11 :     input real maxi; // maximum number of steps in the program
12 : lamonts 2131
13 : lamonts 2137 strand Particle (real posx, real posy) {
14 :     output vec2 pos = [posx,posy];
15 : lamonts 2131 real isoval = 1;
16 :     int steps = 0;
17 :    
18 :     update {
19 : lamonts 2132 real energy = 0.0;
20 :     real force = 0.0;
21 :     real raduis =0.01;
22 : lamonts 2131
23 : lamonts 2132 for(Particle neighbor in sphere(raidus) {
24 :     real d = distance (pos,neighbor.pos);
25 : lamonts 2137 if(d >= 0 && d <= 1) {
26 : lamonts 2132 force += -4.0 * ((1 - d)^3);
27 :     energy += ((1 - d)^4);
28 : lamonts 2137 }
29 : lamonts 2132 }
30 : lamonts 2137 pos = pos + force;
31 :     pos = pos / |pos|;
32 : lamonts 2131 }
33 :     }
34 : lamonts 2137 initially {Particle(initPosns{i*2},initPosns{i*2+1}) | i in 0 .. numOfParticles-1 };
35 : lamonts 2131

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