-
Notifications
You must be signed in to change notification settings - Fork 0
/
Face.java
43 lines (34 loc) · 940 Bytes
/
Face.java
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
import java.util.Optional;
public class Face {
private final int id;
private Optional<HalfEdge> halfedge;
Face(int id) {
this.id = id;
this.halfedge = Optional.<HalfEdge>empty();
}
private Face(int id, Optional<HalfEdge> halfedge) {
this.id = id;
this.halfedge = halfedge;
}
void setHalfEdge(HalfEdge halfedge) {
this.halfedge = Optional.<HalfEdge>of(halfedge);
}
void removeHalfEdge() {
this.halfedge = Optional.<HalfEdge>empty();
}
Face copy() {
return new Face(this.id, this.halfedge);
}
int getId() {
return this.id;
}
public Optional<HalfEdge> getHalfEdge() {
return this.halfedge;
}
@Override
public String toString() {
HalfEdge edge = new HalfEdge(-1);
return String.format("Face %d: Edge %d", this.id,
this.halfedge.orElse(edge).getId());
}
}