Repository navigation
Expand file tree
/
Copy pathedge.cpp
More file actions
106 lines (98 loc) · 2.27 KB
/
Copy pathedge.cpp
File metadata and controls
106 lines (98 loc) · 2.27 KB
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
/**
* @author Andy Wang, UC Berkeley.
* Copyright 2016 reserve.
* UC Berkeley, Slide_2016 project.
* Advised by Prof. Sequin H. Carlos.
*/
#include "edge.h"
Edge::Edge() {
va = vb = NULL;
nextVaFa = nextVaFb = nextVbFa = nextVbFb = NULL;
fa = fb = NULL;
edgePoint = NULL;
isSharp = false;
mobius = false;
firstHalf = secondHalf = NULL;
}
Edge::Edge(Vertex * v1, Vertex * v2) {
va = v1;
vb = v2;
nextVaFa = nextVaFb = nextVbFa = nextVbFb = NULL;
fa = fb = NULL;
edgePoint = NULL;
isSharp = false;
mobius = false;
firstHalf = secondHalf = NULL;
}
Edge * Edge::nextEdge(Vertex * v, Face * f) {
if(v == va) {
if(f == fa) {
return nextVaFa;
} else if (f == fb) {
return nextVaFb;
}
} else if(v == vb) {
if(f == fa) {
return nextVbFa;
} else if (f == fb) {
return nextVbFb;
}
}
cout<<"Error: Invalid search of edge at vertex "<<v -> ID<<"."<<endl;
exit(0);
}
void Edge::setNextEdge(Vertex * v, Face * f, Edge * nextEdge) {
if(v == va) {
if(f == fa) {
nextVaFa = nextEdge;
return;
} else if (f == fb) {
nextVaFb = nextEdge;
return;
}
} else if(v == vb) {
if(f == fa) {
nextVbFa = nextEdge;
return;
} else if (f == fb) {
nextVbFb = nextEdge;
return;
}
}
cout<<"Error: Invalid set next edge at vertex "<<v -> ID<<"."<<endl;
exit(0);
}
Vertex * Edge::theOtherVertex(Vertex * v) {
if(v == va) {
return vb;
} else if(v == vb) {
return va;
} else {
cout<<"ERROR: v is not in edge!"<<endl;
//exit(0);
}
}
Face * Edge::theOtherFace(Face * f) {
if(f == fa) {
return fb;
} else if(f == fb) {
return fa;
} else {
cout<<"ERROR: f is not adjacent to this edge"<<endl;
exit(0);
}
}
Edge * Edge::nextEdgeOfFace(Face * f) {
if(f == fa) {
return nextVbFa;
} else if(f == fb) {
if(mobius) {
return nextVbFb;
} else {
return nextVaFb;
}
} else {
cout<<"ERROR: f is not adjacent to this edge"<<endl;
exit(0);
}
}