-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsup_triang.cpp
57 lines (41 loc) · 1.3 KB
/
sup_triang.cpp
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
#include "off_struct.cpp"
#include "che_struct.cpp"
#include <vector>
void sup_to_triang(off_set set){
HalfEdgeMesh mesh;
std::vector<std::vector<int> > adjacencias;
adjacencias.resize(set.faces.size());
int commonVertices;
int i, j;
for(int i = 0; i < (int)set.faces.size(); i++){
for(int j = 0; j < (int)set.faces.size(); j++){
commonVertices = 0;
if(set.vertices[i][0] == set.vertices[j][0] || set.vertices[i][0] == set.vertices[j][1] || set.vertices[i][0] == set.vertices[j][2]){
commonVertices++;
}
if(set.vertices[i][1] == set.vertices[j][0] || set.vertices[i][1] == set.vertices[j][1] || set.vertices[i][1] == set.vertices[j][2]){
commonVertices++;
}
if(set.vertices[i][2] == set.vertices[j][0] || set.vertices[i][2] == set.vertices[j][1] || set.vertices[i][2] == set.vertices[j][2]){
commonVertices++;
}
if(commonVertices == 2){
adjacencias[i].push_back(j);
}
}
}
printf("---ADJACÊNCIAS---\n");
for(int i = 0; i < (int)adjacencias.size(); i++){
printf("face %d: ", i);
for(int j = 0; j < (int)adjacencias[i].size(); j++){
int face = adjacencias[i][j];
printf("%d ", face);
}
printf("\n");
}
}
int main(void){
off_set cone = makeOffSet("cone.off");
sup_to_triang(cone);
return 0;
}