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

SCM Repository

[diderot] Annotation of /tests/lamont-tests/test-sphere2b.diderot
ViewVC logotype

Annotation of /tests/lamont-tests/test-sphere2b.diderot

Parent Directory Parent Directory | Revision Log Revision Log


Revision 4640 - (view) (download)

1 : glk 4640 #version 2
2 :    
3 :     input real queryRadius = 1.25;
4 :    
5 :     strand S (real x, real y)
6 :     {
7 :     vec2 pos = [x, y];
8 :     output vec2 avgPos = [0, 0];
9 :    
10 :     update {
11 :     // avgPos = mean { p.pos | p in sphere (queryRadius)};
12 :     S[] neighbors = sphere (queryRadius);
13 :     foreach (S p in neighbors) {
14 :     avgPos += p.pos;
15 :     }
16 :     if (length(neighbors) > 0) {
17 :     avgPos /= length(neighbors);
18 :     }
19 :     stabilize;
20 :     }
21 :    
22 :     }
23 :    
24 :     create_array { S(x, y) | x in 0..9, y in 0..9 }

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