-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathLineBoundaryList.pde
46 lines (35 loc) · 931 Bytes
/
LineBoundaryList.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
/*
© 2020 Alex Harding
Physics Clock by Alex Harding
www.alexharding.io
https://hackaday.io/project/176037-concrete-physics-clock
https://github.com/arcadeperfect/Physics-Clock-Processing
Originally based on Dan Shiffman's "boxes" example for his Box2D wrapper for processing:
https://github.com/shiffman/Box2D-for-Processing/tree/master/Box2D-for-Processing/dist/box2d_processing/examples/Boxes
*/
// Helper class to manage lists of line boundaries
class LineBoundaryList {
ArrayList<LineBoundary> bounds = new ArrayList<LineBoundary>();
LineBoundaryList() {
}
void add(LineBoundary l) {
bounds.add(l);
}
void remove(LineBoundary l) {
l.killBody();
bounds.remove(l);
}
void clear() {
for (LineBoundary l : bounds) {
l.killBody();
}
bounds.clear();
}
void draw() {
for (LineBoundary l : bounds) {
strokeWeight(2);
fill(255);
l.draw();
}
}
}