-
Notifications
You must be signed in to change notification settings - Fork 1
/
HalfEdge.js
43 lines (36 loc) · 968 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
function HalfEdge(v, name){
this.name = name;
//this.Start = null;
this.origin = v;
//this.oppositeEdge = null;
this.next = null; //counter clock wise
this.prev = null;
this.twin = null;
this.helper = null;
this.polygon = null;
}
HalfEdge.prototype.setNextEdge = function(he){
this.next = he;
};
HalfEdge.prototype.setPrevEdge = function(pe){
this.prev = pe;
};
HalfEdge.prototype.setTwin = function(e){
this.twin = e;
};
HalfEdge.prototype.setHelper = function(p){
this.helper = p;
};
HalfEdge.prototype.toHTML = function(){
var pName = this.polygon ? this.polygon.getName() : '';
return `<b>e${this.name}</b><br/>(${this.origin.getName()}, ${this.next.origin.getName()})<br/>${pName}`;
};
HalfEdge.prototype.getName = function(){
return 'e'+this.name;
};
HalfEdge.prototype.setOrigin = function(v){
this.origin = v;
};
HalfEdge.prototype.setPolygon = function(p){
this.polygon = p;
};