forked from techwebb/canvas
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathHalfEdge.js
44 lines (37 loc) · 998 Bytes
/
HalfEdge.js
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
function HalfEdge(v, name) {
this.name = name;
//this.Start = null;
this.origin = v;
//this.oppositeEdge = null;
// Counter clock-wise
this.next = null;
this.prev = null;
this.twin = null;
this.helper = null;
this.polygon = null;
}
HalfEdge.prototype.setNextEdge = (he) => {
this.next = he;
};
HalfEdge.prototype.setPrevEdge = (pe) => {
this.prev = pe;
};
HalfEdge.prototype.setTwin = (e) => {
this.twin = e;
};
HalfEdge.prototype.setHelper = (p) => {
this.helper = p;
};
HalfEdge.prototype.toHTML = () => {
const pName = this.polygon ? this.polygon.getName() : string.Empty;
return `<b>e${this.name}</b><br/> (${this.origin.getName()}, ${this.next.origin.getName()})<br/>${pName}`;
};
HalfEdge.prototype.getName = () => {
return `e${this.name}`;
};
HalfEdge.prototype.setOrigin = (v) => {
this.origin = v;
};
HalfEdge.prototype.setPolygon = (p) => {
this.polygon = p;
};