forked from awang289/Per10-Wang-Oleksiuk-Sprouts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathLine.pde
54 lines (48 loc) · 1.14 KB
/
Line.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
class Line {
ArrayList<Point> points= new ArrayList<Point>();
public Line(Point p) {
addify(p);
}
void addify(Point p) {
points.add(p);
}
void removeify(Point p) {
points.remove(p);
}
void display() {
noFill();
smooth();
stroke(0);
beginShape();
curveVertex(points.get(0).x, points.get(0).y);
for (Point p : points) {
curveVertex(p.x, p.y);
}
curveVertex(points.get(points.size()-1).x, points.get(points.size()-1).y);
endShape();
}
void display(color c) {
noFill();
smooth();
stroke(c);
beginShape();
curveVertex(points.get(0).x, points.get(0).y);
for (Point p : points) {
curveVertex(p.x, p.y);
}
curveVertex(points.get(points.size()-1).x, points.get(points.size()-1).y);
endShape();
}
void displayIntersection() {
noFill();
smooth();
stroke(0);
beginShape();
curveVertex(points.get(0).x, points.get(0).y);
for (int i = 0; i < points.size()-2; i++) {
curveVertex(points.get(i).x, points.get(i).y);
}
curveVertex(points.get(points.size()-1).x, points.get(points.size()-1).y);
endShape();
}
}