-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathclass_RepParts.pde
48 lines (38 loc) · 1.04 KB
/
class_RepParts.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 RepAgent extends VerletParticle {
//General variables
//float repRange= depth;
float repMag = 10;//5;
float repRange= 1.5*depth;//2*depth;
int repAgentAge = 0;
//__________________________________CONSTRUCTORS
RepAgent(Vec3D loc){
super(loc);
physics.addBehavior(new AttractionBehavior(this, repRange, -repMag));
}
//__________________________________METHOD or BEHAVIORS
void run(){
repAgentAge++;
//change condition temp
//field.updateTemp(this, -5);
}
void display (){
float weight = map(repAgentAge, 0, 60, 5, .1);
strokeWeight(weight);
stroke(150,150,150,150);
point(this.x, this.y, this.z);
strokeWeight(.5);
pushMatrix();
translate(this.x, this.y, this.z);
noFill();
ellipse(0, 0, repRange*2, repRange*2);
popMatrix();
}
}
void killRepAg(){
for (int i = 0; i < repAgents.size(); ++i) {
RepAgent rP = (RepAgent) repAgents.get(i);
if (rP.repAgentAge >= 60) {
repAgents.remove(rP);
}
}
}