-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSatellite.pde
67 lines (61 loc) · 1.61 KB
/
Satellite.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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
float spin;
boolean satGroup1, satGroup2;
Satellite sat1, sat2, sat3, sat4, sat5, sat6;
class Satellite { // Name
float angle; // Data
String shape;
Satellite(float a, String b) { // Constructor; set addressable variables.
angle = a;
shape = b;
}
void move() { // Behaviour (keep separate from display to avoid cumulative spins.
spin += 2;
}
void display() { // Functionality
pushMatrix();
rotate(radians(angle));
translate(width/5, 0, 0);
rotateZ(radians(spin));
if (shape == "panel") {
stroke(0, 255, 255);
fill(0, 255, 255, 127);
box(100, 100, 5);
}
if (shape == "pyramid") {
scale(0.75);
translate(-100, -57.735, -75);
beginShape(TRIANGLES);
stroke(255, 255, 0);
fill(0, 255, 255, 127);
vertex(0, 0, 0);
fill(0, 255, 255, 127);
vertex(200, 0, 0);
fill(0, 255, 255, 127);
vertex(100, 173.2, 0);
fill(0, 255, 255, 127);
vertex(0, 0, 0);
fill(0, 255, 255, 127);
vertex(200, 0, 0);
fill(255, 255, 0, 127);
vertex(100, 57.735, 173.2);
fill(0, 255, 255, 127);
vertex(200, 0, 0);
fill(0, 255, 255, 127);
vertex(100, 173.2, 0);
fill(255, 255, 0, 127);
vertex(100, 57.735, 173.2);
fill(0, 255, 255, 127);
vertex(0, 0, 0);
fill(255, 255, 0, 127);
vertex(100, 57.735, 173.2);
fill(0, 255, 255, 127);
vertex(100, 173.2, 0);
endShape();
scale(1);
}
if (shape == "icosahedron") {
ico.create();
}
popMatrix();
}
}