-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathFace.pde
42 lines (35 loc) · 768 Bytes
/
Face.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
class Face {
Vertex[] vertices;
Face() {
}
Face(Vertex[] verts) {
referTo(verts);
}
String toString() {
StringBuilder sb = new StringBuilder();
for (int i = 0, sz = vertices.length; i < sz; ++i) {
sb.append(vertices[i].toString());
sb.append("\n");
}
return sb.toString();
}
Face copyFrom(Face face) {
return copyFrom(face.vertices);
}
Face copyFrom(Vertex[] verts) {
int sz = verts.length;
vertices = new Vertex[sz];
for (int i = 0; i < sz; ++i) {
vertices[i] = new Vertex();
vertices[i].copyFrom(verts[i]);
}
return this;
}
Face referTo(Face face) {
return referTo(face.vertices);
}
Face referTo(Vertex[] verts) {
vertices = verts;
return this;
}
}