-
Notifications
You must be signed in to change notification settings - Fork 0
/
Agents.pde
48 lines (40 loc) · 841 Bytes
/
Agents.pde
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
class Agents {
ArrayList<Agent> agents;
Agents() {
this.build();
}
void build() {
agents = new ArrayList<Agent>();
int steps = 50000;
float step = TWO_PI / steps;
float rad = 300;
float amp = PI/8;
for ( float i = 0; i <= steps; ++i ) {
float a = step * i;
agents.add(new Agent(
new PVector(cos(a), sin(a)).mult(rad).add(center).add(PVector.random2D().mult(20)),
a + PI/2 + PI/8 + random(-amp, amp),
//pal.col((sin(a)+1)*0.5)
color(255)
));
}
}
void update() {
for ( Agent a : agents ) {
a.update();
}
}
void render() {
beginShape(POINTS);
stroke(255);
strokeWeight(1.0);
for ( Agent a : agents ) {
a.render();
}
endShape();
}
void run() {
this.update();
this.render();
}
}