-
Notifications
You must be signed in to change notification settings - Fork 18
/
FormattingMesh.txt
43 lines (42 loc) · 1.13 KB
/
FormattingMesh.txt
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
#include <iostream>
#include <string>
#include <vector>
using namespace std;
int main()
{
vector<vector<int>> vertices;
for (int i = -1; i <= 1; i += 2)
for (int j = -1; j <= 1; j += 2)
for (int k = -1; k <= 1; k += 2)
for (int l = -1; l <= 1; l += 2) {
vector<int> tmp;
tmp.push_back(l);
tmp.push_back(k);
tmp.push_back(j);
tmp.push_back(i);
vertices.push_back(tmp);
}
vector<vector<int>> faces;
for( int i = 0; i<4;i++)
for ( int j = i+1 ; j<4; j++)
for (int k = -1; k<=1;k+=2)
for (int l = -1;l<=1;l+=2)
{
vector<int> tmp;
for ( int m = 0; m<16;m++)
{
if (vertices[m][i] == k && vertices[m][j] == l)
{
tmp.push_back(m);
}
}
swap (tmp[0],tmp[1]);
faces.push_back(tmp);
}
for (int i =0;i<faces.size();i++)
{
for (int j = 0; j<4;j++)
cout<<faces[i][j]<<',';
cout<<endl;
}
}