-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMyTruncatedOctahedronPillar.java
143 lines (115 loc) · 3.87 KB
/
MyTruncatedOctahedronPillar.java
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
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
import java.util.Iterator;
public class MyTruncatedOctahedronPillar extends MyPolytope {
MyTruncatedOctahedronPillar(){
V_NUM = 48;
E_NUM = 96;
F_NUM = 64;
C_NUM = 16;
p = new Point4d[V_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++) {
//if(i==0)
//System.out.println(p[i].distance(p[j]));
//4次元距離の計算
double distance = p[i].distance(p[j]);
//System.out.println(distance);
//if(p[i].distance(p[j]) > 56.0 && p[i].distance(p[j]) < 57.0 ) {
//ルート2系ならば辺が存在
if(distance > 84 && distance < 85 ) {
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() {
// TODO 自動生成されたメソッド・スタブ
}
@Override
void setVertex4d() {
p[0] = new Point4d(-1, 2, 0 ,-Math.sqrt(2)/2);
p[1] = new Point4d(0, 2, 1 ,-Math.sqrt(2)/2);
p[2] = new Point4d(1, 2, 0 ,-Math.sqrt(2)/2);
p[3] = new Point4d(0, 2, -1 ,-Math.sqrt(2)/2);
// 2段目4(y=1)
p[4] = new Point4d(-2, 1, 0 ,-Math.sqrt(2)/2);
p[5] = new Point4d(0, 1, 2 ,-Math.sqrt(2)/2);
p[6] = new Point4d(2, 1, 0 ,-Math.sqrt(2)/2);
p[7] = new Point4d(0, 1, -2 ,-Math.sqrt(2)/2);
// 中段(y=0)
p[8] = new Point4d(-2, 0, -1 ,-Math.sqrt(2)/2);
p[9] = new Point4d(-2, 0, 1 ,-Math.sqrt(2)/2);
p[10] = new Point4d(-1, 0, 2 ,-Math.sqrt(2)/2);
p[11] = new Point4d(1, 0, 2 ,-Math.sqrt(2)/2);
p[12] = new Point4d(2, 0, 1 ,-Math.sqrt(2)/2);
p[13] = new Point4d(2, 0, -1 ,-Math.sqrt(2)/2);
p[14] = new Point4d(1, 0, -2 ,-Math.sqrt(2)/2);
p[15] = new Point4d(-1, 0, -2 ,-Math.sqrt(2)/2);
// 4段目4(y=-1)
p[16] = new Point4d(-2, -1, 0 ,-Math.sqrt(2)/2);
p[17] = new Point4d(0, -1, 2 ,-Math.sqrt(2)/2);
p[18] = new Point4d(2, -1, 0 ,-Math.sqrt(2)/2);
p[19] = new Point4d(0, -1, -2, -Math.sqrt(2)/2);
// 底面4(y=-2)
p[20] = new Point4d(-1, -2, 0 ,-Math.sqrt(2)/2);
p[21] = new Point4d(0, -2, 1 ,-Math.sqrt(2)/2);
p[22] = new Point4d(1, -2, 0 ,-Math.sqrt(2)/2);
p[23] = new Point4d(0, -2, -1 ,-Math.sqrt(2)/2);
p[24] = new Point4d(-1, 2, 0 ,Math.sqrt(2)/2);
p[25] = new Point4d(0, 2, 1 ,Math.sqrt(2)/2);
p[26] = new Point4d(1, 2, 0 ,Math.sqrt(2)/2);
p[27] = new Point4d(0, 2, -1 ,Math.sqrt(2)/2);
// 2段目4(y=1)
p[28] = new Point4d(-2, 1, 0 ,Math.sqrt(2)/2);
p[29] = new Point4d(0, 1, 2 ,Math.sqrt(2)/2);
p[30] = new Point4d(2, 1, 0 ,Math.sqrt(2)/2);
p[31] = new Point4d(0, 1, -2 ,Math.sqrt(2)/2);
// 中段(y=0)
p[32] = new Point4d(-2, 0, -1 ,Math.sqrt(2)/2);
p[33] = new Point4d(-2, 0, 1 ,Math.sqrt(2)/2);
p[34] = new Point4d(-1, 0, 2 ,Math.sqrt(2)/2);
p[35] = new Point4d(1, 0, 2 ,Math.sqrt(2)/2);
p[36] = new Point4d(2, 0, 1 ,Math.sqrt(2)/2);
p[37] = new Point4d(2, 0, -1 ,Math.sqrt(2)/2);
p[38] = new Point4d(1, 0, -2 ,Math.sqrt(2)/2);
p[39] = new Point4d(-1, 0, -2 ,Math.sqrt(2)/2);
// 4段目4(y=-1)
p[40] = new Point4d(-2, -1, 0 ,Math.sqrt(2)/2);
p[41] = new Point4d(0, -1, 2 ,Math.sqrt(2)/2);
p[42] = new Point4d(2, -1, 0 ,Math.sqrt(2)/2);
p[43] = new Point4d(0, -1, -2, Math.sqrt(2)/2);
// 底面4(y=-2)
p[44] = new Point4d(-1, -2, 0 ,Math.sqrt(2)/2);
p[45] = new Point4d(0, -2, 1 ,Math.sqrt(2)/2);
p[46] = new Point4d(1, -2, 0 ,Math.sqrt(2)/2);
p[47] = new Point4d(0, -2, -1 ,Math.sqrt(2)/2);
for(int i=0;i<p.length;i++) {
v[i] = new Vertex4d(p[i]);
v[i].getPoint4d().setScale(60);
}
}
}