1 |
29b82486
|
Leszek Koltunski
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
2 |
|
|
// Copyright 2020 Leszek Koltunski //
|
3 |
|
|
// //
|
4 |
|
|
// This file is part of Magic Cube. //
|
5 |
|
|
// //
|
6 |
|
|
// Magic Cube is free software: you can redistribute it and/or modify //
|
7 |
|
|
// it under the terms of the GNU General Public License as published by //
|
8 |
|
|
// the Free Software Foundation, either version 2 of the License, or //
|
9 |
|
|
// (at your option) any later version. //
|
10 |
|
|
// //
|
11 |
|
|
// Magic Cube is distributed in the hope that it will be useful, //
|
12 |
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
|
13 |
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
|
14 |
|
|
// GNU General Public License for more details. //
|
15 |
|
|
// //
|
16 |
|
|
// You should have received a copy of the GNU General Public License //
|
17 |
|
|
// along with Magic Cube. If not, see <http://www.gnu.org/licenses/>. //
|
18 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
19 |
|
|
|
20 |
|
|
package org.distorted.objectlib.objects;
|
21 |
|
|
|
22 |
c9c71c3f
|
Leszek Koltunski
|
import static org.distorted.objectlib.touchcontrol.TouchControl.TC_OCTAHEDRON;
|
23 |
|
|
import static org.distorted.objectlib.touchcontrol.TouchControl.TYPE_NOT_SPLIT;
|
24 |
29b82486
|
Leszek Koltunski
|
|
25 |
82eb152a
|
Leszek Koltunski
|
import java.io.InputStream;
|
26 |
29b82486
|
Leszek Koltunski
|
|
27 |
|
|
import org.distorted.library.type.Static3D;
|
28 |
|
|
import org.distorted.library.type.Static4D;
|
29 |
|
|
|
30 |
3ee1d662
|
Leszek Koltunski
|
import org.distorted.objectlib.helpers.ObjectFaceShape;
|
31 |
1d581993
|
Leszek Koltunski
|
import org.distorted.objectlib.helpers.ObjectSignature;
|
32 |
a8295031
|
Leszek Koltunski
|
import org.distorted.objectlib.main.InitData;
|
33 |
c9c71c3f
|
Leszek Koltunski
|
import org.distorted.objectlib.touchcontrol.TouchControlOctahedron;
|
34 |
8005e762
|
Leszek Koltunski
|
import org.distorted.objectlib.main.ObjectType;
|
35 |
198c5bf0
|
Leszek Koltunski
|
import org.distorted.objectlib.helpers.ObjectShape;
|
36 |
10b7e306
|
Leszek Koltunski
|
import org.distorted.objectlib.scrambling.ScrambleState;
|
37 |
386af988
|
Leszek Koltunski
|
import org.distorted.objectlib.main.ShapeOctahedron;
|
38 |
29b82486
|
Leszek Koltunski
|
|
39 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
40 |
|
|
|
41 |
386af988
|
Leszek Koltunski
|
public class TwistyDiamond extends ShapeOctahedron
|
42 |
29b82486
|
Leszek Koltunski
|
{
|
43 |
|
|
// the four rotation axis of a Diamond. Must be normalized.
|
44 |
|
|
static final Static3D[] ROT_AXIS = new Static3D[]
|
45 |
|
|
{
|
46 |
|
|
new Static3D(+SQ6/3,+SQ3/3, 0),
|
47 |
|
|
new Static3D(-SQ6/3,+SQ3/3, 0),
|
48 |
|
|
new Static3D( 0,-SQ3/3,-SQ6/3),
|
49 |
|
|
new Static3D( 0,-SQ3/3,+SQ6/3)
|
50 |
|
|
};
|
51 |
|
|
|
52 |
|
|
private ScrambleState[] mStates;
|
53 |
beee90ab
|
Leszek Koltunski
|
private int[][] mBasicAngle;
|
54 |
29b82486
|
Leszek Koltunski
|
private float[][] mCuts;
|
55 |
|
|
private int[] mTetraToFaceMap;
|
56 |
35ae98f0
|
Leszek Koltunski
|
private float[][] mPosition;
|
57 |
29b82486
|
Leszek Koltunski
|
|
58 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
59 |
|
|
|
60 |
a8295031
|
Leszek Koltunski
|
public TwistyDiamond(InitData data, int meshState, int iconMode, Static4D quat, Static3D move, float scale, InputStream stream)
|
61 |
29b82486
|
Leszek Koltunski
|
{
|
62 |
a8295031
|
Leszek Koltunski
|
super(data, meshState, iconMode, data.getNumLayers()[0], quat, move, scale, stream);
|
63 |
29b82486
|
Leszek Koltunski
|
}
|
64 |
|
|
|
65 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
66 |
|
|
|
67 |
f9a81f52
|
Leszek Koltunski
|
public ScrambleState[] getScrambleStates()
|
68 |
29b82486
|
Leszek Koltunski
|
{
|
69 |
|
|
if( mStates==null )
|
70 |
|
|
{
|
71 |
a57e6870
|
Leszek Koltunski
|
int[] numLayers = getNumLayers();
|
72 |
|
|
int numL = numLayers[0];
|
73 |
|
|
int[] tmp = new int[3*2*numL];
|
74 |
29b82486
|
Leszek Koltunski
|
|
75 |
a57e6870
|
Leszek Koltunski
|
for(int i=0; i<2*numL; i++)
|
76 |
29b82486
|
Leszek Koltunski
|
{
|
77 |
a57e6870
|
Leszek Koltunski
|
tmp[3*i ] = (i<numL) ? i:i-numL;
|
78 |
29b82486
|
Leszek Koltunski
|
tmp[3*i+1] = (i%2==0) ? -1:1;
|
79 |
|
|
tmp[3*i+2] = 0;
|
80 |
|
|
}
|
81 |
|
|
|
82 |
|
|
mStates = new ScrambleState[]
|
83 |
|
|
{
|
84 |
|
|
new ScrambleState( new int[][] {tmp,tmp,tmp,tmp} )
|
85 |
|
|
};
|
86 |
|
|
}
|
87 |
|
|
|
88 |
|
|
return mStates;
|
89 |
|
|
}
|
90 |
|
|
|
91 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
92 |
|
|
|
93 |
7bbfc84f
|
Leszek Koltunski
|
public float[][] getCuts(int[] numLayers)
|
94 |
29b82486
|
Leszek Koltunski
|
{
|
95 |
a57e6870
|
Leszek Koltunski
|
int numL = numLayers[0];
|
96 |
|
|
if( numL<2 ) return null;
|
97 |
29b82486
|
Leszek Koltunski
|
|
98 |
|
|
if( mCuts==null )
|
99 |
|
|
{
|
100 |
a57e6870
|
Leszek Koltunski
|
mCuts = new float[4][numL-1];
|
101 |
|
|
float cut = (SQ6/6)*(2-numL);
|
102 |
29b82486
|
Leszek Koltunski
|
|
103 |
a57e6870
|
Leszek Koltunski
|
for(int i=0; i<numL-1; i++)
|
104 |
29b82486
|
Leszek Koltunski
|
{
|
105 |
|
|
mCuts[0][i] = cut;
|
106 |
|
|
mCuts[1][i] = cut;
|
107 |
|
|
mCuts[2][i] = cut;
|
108 |
|
|
mCuts[3][i] = cut;
|
109 |
|
|
cut += SQ6/3;
|
110 |
|
|
}
|
111 |
|
|
}
|
112 |
|
|
|
113 |
|
|
return mCuts;
|
114 |
|
|
}
|
115 |
|
|
|
116 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
117 |
|
|
|
118 |
59c20632
|
Leszek Koltunski
|
public boolean[][] getLayerRotatable(int[] numLayers)
|
119 |
29b82486
|
Leszek Koltunski
|
{
|
120 |
59c20632
|
Leszek Koltunski
|
int numAxis = ROT_AXIS.length;
|
121 |
|
|
boolean[][] layerRotatable = new boolean[numAxis][];
|
122 |
a57e6870
|
Leszek Koltunski
|
|
123 |
59c20632
|
Leszek Koltunski
|
for(int i=0; i<numAxis; i++)
|
124 |
|
|
{
|
125 |
|
|
layerRotatable[i] = new boolean[numLayers[i]];
|
126 |
|
|
for(int j=0; j<numLayers[i]; j++) layerRotatable[i][j] = true;
|
127 |
29b82486
|
Leszek Koltunski
|
}
|
128 |
59c20632
|
Leszek Koltunski
|
|
129 |
|
|
return layerRotatable;
|
130 |
|
|
}
|
131 |
|
|
|
132 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
133 |
|
|
|
134 |
11fa413d
|
Leszek Koltunski
|
public int getTouchControlType()
|
135 |
59c20632
|
Leszek Koltunski
|
{
|
136 |
c9c71c3f
|
Leszek Koltunski
|
return TC_OCTAHEDRON;
|
137 |
59c20632
|
Leszek Koltunski
|
}
|
138 |
|
|
|
139 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
140 |
|
|
|
141 |
11fa413d
|
Leszek Koltunski
|
public int getTouchControlSplit()
|
142 |
59c20632
|
Leszek Koltunski
|
{
|
143 |
|
|
return TYPE_NOT_SPLIT;
|
144 |
|
|
}
|
145 |
|
|
|
146 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
147 |
|
|
|
148 |
|
|
public int[][][] getEnabled()
|
149 |
|
|
{
|
150 |
|
|
return new int[][][]
|
151 |
|
|
{
|
152 |
|
|
{{1,2,3}},{{1,2,3}},{{0,2,3}},{{0,2,3}},{{0,1,3}},{{0,1,3}},{{0,1,2}},{{0,1,2}}
|
153 |
|
|
};
|
154 |
|
|
}
|
155 |
|
|
|
156 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
157 |
|
|
|
158 |
|
|
public float[] getDist3D(int[] numLayers)
|
159 |
|
|
{
|
160 |
4c9ca251
|
Leszek Koltunski
|
return TouchControlOctahedron.D3D;
|
161 |
|
|
}
|
162 |
|
|
|
163 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
164 |
|
|
|
165 |
|
|
public Static3D[] getFaceAxis()
|
166 |
|
|
{
|
167 |
|
|
return TouchControlOctahedron.FACE_AXIS;
|
168 |
29b82486
|
Leszek Koltunski
|
}
|
169 |
|
|
|
170 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
171 |
|
|
|
172 |
|
|
private int getNumOctahedrons(int layers)
|
173 |
|
|
{
|
174 |
|
|
return layers==1 ? 1 : 4*(layers-1)*(layers-1) + 2;
|
175 |
|
|
}
|
176 |
|
|
|
177 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
178 |
|
|
|
179 |
|
|
private int getNumTetrahedrons(int layers)
|
180 |
|
|
{
|
181 |
|
|
return 4*layers*(layers-1);
|
182 |
|
|
}
|
183 |
|
|
|
184 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
185 |
|
|
|
186 |
|
|
private int createOctaPositions(float[][] centers, int index, int layers, float height)
|
187 |
|
|
{
|
188 |
|
|
float x = (layers-1)*0.5f;
|
189 |
|
|
float z = (layers+1)*0.5f;
|
190 |
|
|
|
191 |
|
|
for(int i=0; i<layers; i++, index++)
|
192 |
|
|
{
|
193 |
|
|
z -= 1;
|
194 |
|
|
centers[index][0] = x;
|
195 |
|
|
centers[index][1] = height;
|
196 |
|
|
centers[index][2] = z;
|
197 |
|
|
}
|
198 |
|
|
|
199 |
|
|
for(int i=0; i<layers-1; i++, index++)
|
200 |
|
|
{
|
201 |
|
|
x -= 1;
|
202 |
|
|
centers[index][0] = x;
|
203 |
|
|
centers[index][1] = height;
|
204 |
|
|
centers[index][2] = z;
|
205 |
|
|
}
|
206 |
|
|
|
207 |
|
|
for(int i=0; i<layers-1; i++, index++)
|
208 |
|
|
{
|
209 |
|
|
z += 1;
|
210 |
|
|
centers[index][0] = x;
|
211 |
|
|
centers[index][1] = height;
|
212 |
|
|
centers[index][2] = z;
|
213 |
|
|
}
|
214 |
|
|
|
215 |
|
|
for(int i=0; i<layers-2; i++, index++)
|
216 |
|
|
{
|
217 |
|
|
x += 1;
|
218 |
|
|
centers[index][0] = x;
|
219 |
|
|
centers[index][1] = height;
|
220 |
|
|
centers[index][2] = z;
|
221 |
|
|
}
|
222 |
|
|
|
223 |
|
|
return index;
|
224 |
|
|
}
|
225 |
|
|
|
226 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
227 |
|
|
|
228 |
|
|
private int createTetraPositions(float[][] centers, int index, int layers, float height)
|
229 |
|
|
{
|
230 |
|
|
float x = (layers-1)*0.5f;
|
231 |
|
|
float z = layers*0.5f;
|
232 |
|
|
|
233 |
|
|
for(int i=0; i<layers-1; i++, index++)
|
234 |
|
|
{
|
235 |
|
|
z -= 1;
|
236 |
|
|
centers[index][0] = x;
|
237 |
|
|
centers[index][1] = height;
|
238 |
|
|
centers[index][2] = z;
|
239 |
|
|
}
|
240 |
|
|
|
241 |
|
|
x += 0.5f;
|
242 |
|
|
z -= 0.5f;
|
243 |
|
|
|
244 |
|
|
for(int i=0; i<layers-1; i++, index++)
|
245 |
|
|
{
|
246 |
|
|
x -= 1;
|
247 |
|
|
centers[index][0] = x;
|
248 |
|
|
centers[index][1] = height;
|
249 |
|
|
centers[index][2] = z;
|
250 |
|
|
}
|
251 |
|
|
|
252 |
|
|
x -= 0.5f;
|
253 |
|
|
z -= 0.5f;
|
254 |
|
|
|
255 |
|
|
for(int i=0; i<layers-1; i++, index++)
|
256 |
|
|
{
|
257 |
|
|
z += 1;
|
258 |
|
|
centers[index][0] = x;
|
259 |
|
|
centers[index][1] = height;
|
260 |
|
|
centers[index][2] = z;
|
261 |
|
|
}
|
262 |
|
|
|
263 |
|
|
x -= 0.5f;
|
264 |
|
|
z += 0.5f;
|
265 |
|
|
|
266 |
|
|
for(int i=0; i<layers-1; i++, index++)
|
267 |
|
|
{
|
268 |
|
|
x += 1;
|
269 |
|
|
centers[index][0] = x;
|
270 |
|
|
centers[index][1] = height;
|
271 |
|
|
centers[index][2] = z;
|
272 |
|
|
}
|
273 |
|
|
|
274 |
|
|
return index;
|
275 |
|
|
}
|
276 |
|
|
|
277 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
278 |
|
|
|
279 |
7b832206
|
Leszek Koltunski
|
public float[][] getCubitPositions(int[] numLayers)
|
280 |
29b82486
|
Leszek Koltunski
|
{
|
281 |
35ae98f0
|
Leszek Koltunski
|
if( mPosition==null )
|
282 |
|
|
{
|
283 |
|
|
int layers = numLayers[0];
|
284 |
|
|
int numO = getNumOctahedrons(layers);
|
285 |
|
|
int numT = getNumTetrahedrons(layers);
|
286 |
|
|
int index = 0;
|
287 |
|
|
float height = 0.0f;
|
288 |
29b82486
|
Leszek Koltunski
|
|
289 |
35ae98f0
|
Leszek Koltunski
|
mPosition = new float[numO+numT][3];
|
290 |
29b82486
|
Leszek Koltunski
|
|
291 |
35ae98f0
|
Leszek Koltunski
|
index = createOctaPositions(mPosition,index,layers,height);
|
292 |
29b82486
|
Leszek Koltunski
|
|
293 |
35ae98f0
|
Leszek Koltunski
|
for(int i=layers-1; i>0; i--)
|
294 |
|
|
{
|
295 |
|
|
height += SQ2/2;
|
296 |
|
|
index = createOctaPositions(mPosition,index,i,+height);
|
297 |
|
|
index = createOctaPositions(mPosition,index,i,-height);
|
298 |
|
|
}
|
299 |
29b82486
|
Leszek Koltunski
|
|
300 |
35ae98f0
|
Leszek Koltunski
|
height = SQ2/4;
|
301 |
29b82486
|
Leszek Koltunski
|
|
302 |
35ae98f0
|
Leszek Koltunski
|
for(int i=layers; i>1; i--)
|
303 |
|
|
{
|
304 |
|
|
index = createTetraPositions(mPosition,index,i,+height);
|
305 |
|
|
index = createTetraPositions(mPosition,index,i,-height);
|
306 |
|
|
height += SQ2/2;
|
307 |
|
|
}
|
308 |
29b82486
|
Leszek Koltunski
|
}
|
309 |
|
|
|
310 |
35ae98f0
|
Leszek Koltunski
|
return mPosition;
|
311 |
29b82486
|
Leszek Koltunski
|
}
|
312 |
|
|
|
313 |
d0e6cf7f
|
Leszek Koltunski
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
314 |
|
|
|
315 |
|
|
public Static4D getCubitQuats(int cubit, int[] numLayers)
|
316 |
|
|
{
|
317 |
|
|
int numL = numLayers[0];
|
318 |
|
|
int numO = getNumOctahedrons(numL);
|
319 |
|
|
|
320 |
802fe251
|
Leszek Koltunski
|
if( cubit<numO ) return mObjectQuats[0];
|
321 |
d0e6cf7f
|
Leszek Koltunski
|
|
322 |
|
|
switch( retFaceTetraBelongsTo(cubit-numO, numL) )
|
323 |
|
|
{
|
324 |
802fe251
|
Leszek Koltunski
|
case 0: return mObjectQuats[0]; // unit quat
|
325 |
d0e6cf7f
|
Leszek Koltunski
|
case 1: return new Static4D(0,-SQ2/2,0,SQ2/2); // 90 along Y
|
326 |
802fe251
|
Leszek Koltunski
|
case 2: return mObjectQuats[10]; // 180 along Y
|
327 |
d0e6cf7f
|
Leszek Koltunski
|
case 3: return new Static4D(0,+SQ2/2,0,SQ2/2); // 90 along
|
328 |
|
|
case 4: return new Static4D(0, 0,1, 0); // 180 along Z
|
329 |
35ae98f0
|
Leszek Koltunski
|
case 5: return mObjectQuats[4];
|
330 |
d0e6cf7f
|
Leszek Koltunski
|
case 6: return new Static4D( 1,0,0, 0); // 180 along X
|
331 |
35ae98f0
|
Leszek Koltunski
|
case 7: return mObjectQuats[3];
|
332 |
d0e6cf7f
|
Leszek Koltunski
|
}
|
333 |
|
|
|
334 |
|
|
return null;
|
335 |
|
|
}
|
336 |
|
|
|
337 |
29b82486
|
Leszek Koltunski
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
338 |
|
|
|
339 |
|
|
private int retFaceTetraBelongsTo(int tetra, int numLayers)
|
340 |
|
|
{
|
341 |
|
|
if( mTetraToFaceMap==null ) mTetraToFaceMap = new int[] {1,2,3,0,5,6,7,4};
|
342 |
|
|
|
343 |
|
|
for(int i=numLayers-1; i>0; i--)
|
344 |
|
|
{
|
345 |
|
|
if( tetra < 8*i ) return mTetraToFaceMap[tetra/i];
|
346 |
|
|
tetra -= 8*i;
|
347 |
|
|
}
|
348 |
|
|
|
349 |
|
|
return -1;
|
350 |
|
|
}
|
351 |
|
|
|
352 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
353 |
|
|
|
354 |
e30c522a
|
Leszek Koltunski
|
public ObjectShape getObjectShape(int variant)
|
355 |
29b82486
|
Leszek Koltunski
|
{
|
356 |
|
|
if( variant==0 )
|
357 |
|
|
{
|
358 |
4e9f2df5
|
Leszek Koltunski
|
float[][] vertices =
|
359 |
29b82486
|
Leszek Koltunski
|
{
|
360 |
57ef6378
|
Leszek Koltunski
|
{ 0.5f, 0.0f, 0.5f},
|
361 |
|
|
{ 0.5f, 0.0f,-0.5f},
|
362 |
|
|
{-0.5f, 0.0f,-0.5f},
|
363 |
|
|
{-0.5f, 0.0f, 0.5f},
|
364 |
|
|
{ 0.0f, SQ2/2, 0.0f},
|
365 |
|
|
{ 0.0f,-SQ2/2, 0.0f}
|
366 |
29b82486
|
Leszek Koltunski
|
};
|
367 |
|
|
|
368 |
4e9f2df5
|
Leszek Koltunski
|
int[][] indices =
|
369 |
29b82486
|
Leszek Koltunski
|
{
|
370 |
|
|
{3,0,4},
|
371 |
|
|
{0,1,4},
|
372 |
|
|
{1,2,4},
|
373 |
|
|
{2,3,4},
|
374 |
|
|
{5,0,3},
|
375 |
|
|
{5,1,0},
|
376 |
|
|
{5,2,1},
|
377 |
|
|
{5,3,2}
|
378 |
|
|
};
|
379 |
|
|
|
380 |
59a971c1
|
Leszek Koltunski
|
return new ObjectShape(vertices, indices);
|
381 |
3ee1d662
|
Leszek Koltunski
|
}
|
382 |
|
|
else
|
383 |
|
|
{
|
384 |
4e9f2df5
|
Leszek Koltunski
|
float[][] vertices= { {-0.5f, SQ2/4, 0.0f}, { 0.5f, SQ2/4, 0.0f}, { 0.0f,-SQ2/4, 0.5f}, { 0.0f,-SQ2/4,-0.5f} };
|
385 |
|
|
int[][] indices = { {2,1,0}, {2,3,1}, {3,2,0}, {3,0,1} };
|
386 |
59a971c1
|
Leszek Koltunski
|
return new ObjectShape(vertices, indices);
|
387 |
3ee1d662
|
Leszek Koltunski
|
}
|
388 |
|
|
}
|
389 |
|
|
|
390 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
391 |
|
|
|
392 |
|
|
public ObjectFaceShape getObjectFaceShape(int variant)
|
393 |
|
|
{
|
394 |
|
|
int numL = getNumLayers()[0];
|
395 |
|
|
int N = numL>3 ? 5:6;
|
396 |
4e9f2df5
|
Leszek Koltunski
|
int E = numL>2 ? (numL>3 ? 0:1) : 2;
|
397 |
3bf19410
|
Leszek Koltunski
|
float height = isInIconMode() ? 0.001f : 0.05f;
|
398 |
3ee1d662
|
Leszek Koltunski
|
|
399 |
|
|
if( variant==0 )
|
400 |
|
|
{
|
401 |
3bf19410
|
Leszek Koltunski
|
float[][] bands = { {height,20,0.5f,0.8f,N,E,E} };
|
402 |
4e9f2df5
|
Leszek Koltunski
|
int[] bandIndices = { 0,0,0,0,0,0,0,0 };
|
403 |
|
|
float[][] corners = { {0.04f,0.20f} };
|
404 |
|
|
int[] cornerIndices = { 0,0,0,0,0,0 };
|
405 |
|
|
float[][] centers = { {0.0f, 0.0f, 0.0f} };
|
406 |
|
|
int[] centerIndices = { 0,0,0,0,0,0 };
|
407 |
3ee1d662
|
Leszek Koltunski
|
return new ObjectFaceShape(bands,bandIndices,corners,cornerIndices,centers,centerIndices,null);
|
408 |
29b82486
|
Leszek Koltunski
|
}
|
409 |
|
|
else
|
410 |
|
|
{
|
411 |
3bf19410
|
Leszek Koltunski
|
float[][] bands = { {height,35,0.5f,0.8f,N,E,E} };
|
412 |
4e9f2df5
|
Leszek Koltunski
|
int[] bandIndices = { 0,0,0,0 };
|
413 |
|
|
float[][] corners = { {0.08f,0.15f} };
|
414 |
|
|
int[] cornerIndices = { 0,0,0,0 };
|
415 |
|
|
float[][] centers = { {0.0f, 0.0f, 0.0f} };
|
416 |
|
|
int[] centerIndices = { 0,0,0,0 };
|
417 |
3ee1d662
|
Leszek Koltunski
|
return new ObjectFaceShape(bands,bandIndices,corners,cornerIndices,centers,centerIndices,null);
|
418 |
29b82486
|
Leszek Koltunski
|
}
|
419 |
|
|
}
|
420 |
|
|
|
421 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
422 |
|
|
|
423 |
e30c522a
|
Leszek Koltunski
|
public int getNumCubitVariants(int[] numLayers)
|
424 |
29b82486
|
Leszek Koltunski
|
{
|
425 |
|
|
return 2;
|
426 |
|
|
}
|
427 |
|
|
|
428 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
429 |
|
|
|
430 |
e30c522a
|
Leszek Koltunski
|
public int getCubitVariant(int cubit, int[] numLayers)
|
431 |
29b82486
|
Leszek Koltunski
|
{
|
432 |
a57e6870
|
Leszek Koltunski
|
return cubit<getNumOctahedrons(numLayers[0]) ? 0 : 1;
|
433 |
29b82486
|
Leszek Koltunski
|
}
|
434 |
|
|
|
435 |
3d766df3
|
Leszek Koltunski
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
436 |
|
|
|
437 |
d53fb890
|
Leszek Koltunski
|
public float getStickerRadius()
|
438 |
3d766df3
|
Leszek Koltunski
|
{
|
439 |
00f4980d
|
Leszek Koltunski
|
return 0.08f;
|
440 |
3d766df3
|
Leszek Koltunski
|
}
|
441 |
|
|
|
442 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
443 |
|
|
|
444 |
d53fb890
|
Leszek Koltunski
|
public float getStickerStroke()
|
445 |
3d766df3
|
Leszek Koltunski
|
{
|
446 |
|
|
float stroke = 0.08f;
|
447 |
|
|
|
448 |
3bf19410
|
Leszek Koltunski
|
if( isInIconMode() )
|
449 |
3d766df3
|
Leszek Koltunski
|
{
|
450 |
|
|
int[] numLayers = getNumLayers();
|
451 |
|
|
|
452 |
|
|
switch(numLayers[0])
|
453 |
|
|
{
|
454 |
|
|
case 2: stroke*=1.4f; break;
|
455 |
|
|
case 3: stroke*=2.0f; break;
|
456 |
|
|
case 4: stroke*=2.1f; break;
|
457 |
|
|
default:stroke*=2.2f; break;
|
458 |
|
|
}
|
459 |
|
|
}
|
460 |
|
|
|
461 |
|
|
return stroke;
|
462 |
|
|
}
|
463 |
|
|
|
464 |
00f4980d
|
Leszek Koltunski
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
465 |
|
|
|
466 |
d53fb890
|
Leszek Koltunski
|
public float[][] getStickerAngles()
|
467 |
00f4980d
|
Leszek Koltunski
|
{
|
468 |
|
|
return null;
|
469 |
|
|
}
|
470 |
29b82486
|
Leszek Koltunski
|
|
471 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
472 |
|
|
// PUBLIC API
|
473 |
|
|
|
474 |
|
|
public Static3D[] getRotationAxis()
|
475 |
|
|
{
|
476 |
|
|
return ROT_AXIS;
|
477 |
|
|
}
|
478 |
|
|
|
479 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
480 |
|
|
|
481 |
beee90ab
|
Leszek Koltunski
|
public int[][] getBasicAngles()
|
482 |
29b82486
|
Leszek Koltunski
|
{
|
483 |
beee90ab
|
Leszek Koltunski
|
if( mBasicAngle ==null )
|
484 |
|
|
{
|
485 |
|
|
int num = getNumLayers()[0];
|
486 |
|
|
int[] tmp = new int[num];
|
487 |
|
|
for(int i=0; i<num; i++) tmp[i] = 3;
|
488 |
|
|
mBasicAngle = new int[][] { tmp,tmp,tmp,tmp };
|
489 |
|
|
}
|
490 |
29b82486
|
Leszek Koltunski
|
return mBasicAngle;
|
491 |
|
|
}
|
492 |
|
|
|
493 |
61aa85e4
|
Leszek Koltunski
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
494 |
|
|
|
495 |
5f54927b
|
Leszek Koltunski
|
public String getShortName()
|
496 |
61aa85e4
|
Leszek Koltunski
|
{
|
497 |
5f54927b
|
Leszek Koltunski
|
switch(getNumLayers()[0])
|
498 |
|
|
{
|
499 |
|
|
case 2: return ObjectType.DIAM_2.name();
|
500 |
|
|
case 3: return ObjectType.DIAM_3.name();
|
501 |
|
|
case 4: return ObjectType.DIAM_4.name();
|
502 |
|
|
}
|
503 |
|
|
|
504 |
|
|
return ObjectType.DIAM_2.name();
|
505 |
|
|
}
|
506 |
|
|
|
507 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
508 |
|
|
|
509 |
1d581993
|
Leszek Koltunski
|
public ObjectSignature getSignature()
|
510 |
5f54927b
|
Leszek Koltunski
|
{
|
511 |
|
|
switch(getNumLayers()[0])
|
512 |
61aa85e4
|
Leszek Koltunski
|
{
|
513 |
1d581993
|
Leszek Koltunski
|
case 2: return new ObjectSignature(ObjectType.DIAM_2);
|
514 |
|
|
case 3: return new ObjectSignature(ObjectType.DIAM_3);
|
515 |
|
|
case 4: return new ObjectSignature(ObjectType.DIAM_4);
|
516 |
61aa85e4
|
Leszek Koltunski
|
}
|
517 |
|
|
|
518 |
1d581993
|
Leszek Koltunski
|
return null;
|
519 |
61aa85e4
|
Leszek Koltunski
|
}
|
520 |
|
|
|
521 |
29b82486
|
Leszek Koltunski
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
522 |
|
|
|
523 |
e26eb4e7
|
Leszek Koltunski
|
public String getObjectName()
|
524 |
29b82486
|
Leszek Koltunski
|
{
|
525 |
e26eb4e7
|
Leszek Koltunski
|
switch(getNumLayers()[0])
|
526 |
29b82486
|
Leszek Koltunski
|
{
|
527 |
e26eb4e7
|
Leszek Koltunski
|
case 2: return "Skewb Diamond";
|
528 |
|
|
case 3: return "Face Turning Octahedron";
|
529 |
|
|
case 4: return "Master Face Turning Octahedron";
|
530 |
29b82486
|
Leszek Koltunski
|
}
|
531 |
|
|
|
532 |
e26eb4e7
|
Leszek Koltunski
|
return "Skewb Diamond";
|
533 |
29b82486
|
Leszek Koltunski
|
}
|
534 |
|
|
|
535 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
536 |
|
|
|
537 |
e26eb4e7
|
Leszek Koltunski
|
public String getInventor()
|
538 |
29b82486
|
Leszek Koltunski
|
{
|
539 |
e26eb4e7
|
Leszek Koltunski
|
switch(getNumLayers()[0])
|
540 |
29b82486
|
Leszek Koltunski
|
{
|
541 |
e26eb4e7
|
Leszek Koltunski
|
case 2: return "Uwe Meffert";
|
542 |
|
|
case 3: return "David Pitcher";
|
543 |
|
|
case 4: return "Timur Evbatyrov";
|
544 |
29b82486
|
Leszek Koltunski
|
}
|
545 |
|
|
|
546 |
e26eb4e7
|
Leszek Koltunski
|
return "Uwe Meffert";
|
547 |
29b82486
|
Leszek Koltunski
|
}
|
548 |
|
|
|
549 |
59c20632
|
Leszek Koltunski
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
550 |
|
|
|
551 |
e26eb4e7
|
Leszek Koltunski
|
public int getYearOfInvention()
|
552 |
59c20632
|
Leszek Koltunski
|
{
|
553 |
e26eb4e7
|
Leszek Koltunski
|
switch(getNumLayers()[0])
|
554 |
59c20632
|
Leszek Koltunski
|
{
|
555 |
|
|
case 2: return 1984;
|
556 |
|
|
case 3: return 2003;
|
557 |
|
|
case 4: return 2011;
|
558 |
|
|
}
|
559 |
|
|
return 1984;
|
560 |
|
|
}
|
561 |
|
|
|
562 |
29b82486
|
Leszek Koltunski
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
563 |
|
|
|
564 |
e26eb4e7
|
Leszek Koltunski
|
public int getComplexity()
|
565 |
29b82486
|
Leszek Koltunski
|
{
|
566 |
e26eb4e7
|
Leszek Koltunski
|
switch(getNumLayers()[0])
|
567 |
29b82486
|
Leszek Koltunski
|
{
|
568 |
b4223a92
|
Leszek Koltunski
|
case 2: return 1;
|
569 |
577fcf3d
|
Leszek Koltunski
|
case 3: return 3;
|
570 |
|
|
case 4: return 4;
|
571 |
29b82486
|
Leszek Koltunski
|
}
|
572 |
|
|
|
573 |
|
|
return 0;
|
574 |
|
|
}
|
575 |
052e0362
|
Leszek Koltunski
|
|
576 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
577 |
|
|
|
578 |
|
|
public String[][] getTutorials()
|
579 |
|
|
{
|
580 |
|
|
int[] numLayers = getNumLayers();
|
581 |
|
|
|
582 |
|
|
switch(numLayers[0])
|
583 |
|
|
{
|
584 |
|
|
case 2: return new String[][] {
|
585 |
|
|
{"gb","R2wrbJJ3izM","How to Solve a Skewb Diamond","Dr. Penguin^3"},
|
586 |
|
|
{"es","2RCusYQdYYE","Como resolver Skewb Diamond","Tutoriales Rubik"},
|
587 |
|
|
{"ru","k8B6RFcNoGw","Как собрать Skewb Diamond","Алексей Ярыгин"},
|
588 |
|
|
{"fr","tqbkgwNcZCE","Comment résoudre le Skewb Diamond","Valentino Cube"},
|
589 |
|
|
{"de","6ewzrCOnZfg","Octagon lösen","JamesKnopf"},
|
590 |
|
|
{"pl","61_Z4TpLMBc","Diamond Skewb TUTORIAL PL","MrUk"},
|
591 |
|
|
{"br","UapwpXMYtH4","Como resolver o Octaedro Diamond","Rafael Cinoto"},
|
592 |
|
|
{"kr","hVBSlfHVTME","공식 하나만 사용 - 다이아몬드 스큐브","Denzel Washington"},
|
593 |
|
|
};
|
594 |
|
|
case 3: return new String[][] {
|
595 |
|
|
{"gb","n_mBSUDLUZw","Face Turning Octahedron Tutorial","SuperAntoniovivaldi"},
|
596 |
|
|
{"es","ogf0t6fGxZI","FTO - Tutorial en español","Gadi Rubik"},
|
597 |
|
|
{"ru","VXCjk0bVRoA","Как собрать Face Turning Octahedron","Алексей Ярыгин"},
|
598 |
|
|
{"de","6bO0AcwY5K8","Face Turning Octahedron - Tutorial","GerCubing"},
|
599 |
|
|
{"pl","huWg-ZfP-KY","Octahedron cube TUTORIAL PL","MrUk"},
|
600 |
|
|
{"br","WN3BoP4EbvM","Como resolver o octaedro 3x3 1/3","Rafael Cinoto"},
|
601 |
|
|
{"br","4zFlfANOliE","Como resolver o octaedro 3x3 2/3","Rafael Cinoto"},
|
602 |
|
|
{"br","6OvNzoHk7RU","Como resolver o octaedro 3x3 3/3","Rafael Cinoto"},
|
603 |
a399e91b
|
Leszek Koltunski
|
{"vn","KzGQ-mVRsss","Tutorial N.43 - FTO","Duy Thích Rubik"},
|
604 |
052e0362
|
Leszek Koltunski
|
};
|
605 |
|
|
case 4: return new String[][] {
|
606 |
|
|
{"gb","3GJkySk5zeQ","Master Face Turning Octahedron","SuperAntoniovivaldi"},
|
607 |
|
|
{"gb","zW_1htxy52k","Master FTO Tutorial","Michele Regano"},
|
608 |
|
|
{"es","3K8XL9SBSvs","Tutorial Master FTO de Mf8","Robert Cubes"},
|
609 |
|
|
{"ru","0CRwhZ2JNJA","Как собрать Master FTO","Алексей Ярыгин"},
|
610 |
a399e91b
|
Leszek Koltunski
|
{"vn","4XdeuGYDCJo","Tutorial N.141 - Master FTO","Duy Thích Rubik"},
|
611 |
052e0362
|
Leszek Koltunski
|
};
|
612 |
|
|
}
|
613 |
|
|
return null;
|
614 |
|
|
}
|
615 |
29b82486
|
Leszek Koltunski
|
}
|