-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMy16Cell.java
More file actions
126 lines (98 loc) · 2.31 KB
/
My16Cell.java
File metadata and controls
126 lines (98 loc) · 2.31 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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
public class My16Cell extends MyPolytope {
My16Cell(){
V_NUM = 8;
E_NUM = 24;
F_NUM = 32;
C_NUM = 16;
p = new Point4d[V_NUM];
dual_points = new Point4d[C_NUM];
v = new Vertex4d[V_NUM];
e = new Edge4d[E_NUM];
f = new Face4d[F_NUM];
c = new Cell4d[C_NUM];
setVertex4d();
setEdge4d();
setFace4d();
setCell4d();
}
@Override
void setCell4d() {
// TODO 自動生成されたメソッド・スタブ
}
@Override
void setEdge4d() {
//辺の自動検索
int[][] eIndex = new int[E_NUM][2];
int k=0;
for(int i=0;i<p.length;i++) {
for(int j=i+1;j<p.length;j++) {
//System.out.println(p[i].distance(p[j]));
if(p[i].distance(p[j])<190) {
eIndex[k][0] = i;
eIndex[k++][1] = j;
//System.out.println("{"+i+","+j+"}");
}
}
}
//System.out.println("k="+k);
for(int i=0;i<e.length;i++) {
e[i] = new Edge4d(v[eIndex[i][0]] , v[eIndex[i][1]] );
}
}
@Override
void setFace4d() {
//あやしい・・・・
Vertex4d[][] fIndex = {
{v[0],v[1],v[2]},//0
{v[0],v[1],v[3]},//1
{v[0],v[2],v[3]},//2
{v[1],v[2],v[3]},//3
{v[0],v[1],v[7]},//4
{v[0],v[2],v[7]},//5
{v[1],v[2],v[7]},//6
{v[2],v[3],v[4]},//7
{v[1],v[2],v[4]},//8
{v[1],v[3],v[4]},//9
{v[2],v[3],v[5]},//10
{v[3],v[4],v[5]},//11
{v[2],v[4],v[5]},//12
{v[3],v[4],v[6]},//13
{v[3],v[5],v[6]},//14
{v[4],v[5],v[6]},//15
{v[4],v[5],v[7]},//16
{v[4],v[6],v[7]},//17
{v[5],v[6],v[7]},//18
{v[0],v[6],v[7]},//19
{v[0],v[5],v[7]},//20
{v[0],v[5],v[6]},//21
{v[0],v[1],v[6]},//22
{v[1],v[6],v[7]},//23
{v[0],v[1],v[7]},//24
{v[0],v[2],v[3]},//25
{v[0],v[2],v[5]},//26
{v[0],v[3],v[5]},//27
{v[0],v[3],v[6]},//28
{v[1],v[4],v[6]},//29
{v[1],v[3],v[6]},//30
{v[1],v[4],v[7]},//31
};
for(int i=0;i<f.length;i++) {
f[i] = new Face4d(fIndex[i]);
}
}
@Override
void setVertex4d() {
p[0] = new Point4d(1,0,0,0);
p[1] = new Point4d(0,1,0,0);
p[2]= new Point4d(0,0,1,0);
p[3] = new Point4d(0,0,0,1);
p[4] = new Point4d(-1,0,0,0);
p[5] = new Point4d(0,-1,0,0);
p[6] = new Point4d(0,0,-1,0);
p[7] = new Point4d(0,0,0,-1);
for(int i=0;i<p.length;i++) {
v[i] = new Vertex4d(p[i]);
v[i].getPoint4d().setScale(130);
}
}
}