1
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
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
|
import org.distorted.library.type.Static3D;
|
23
|
import org.distorted.library.type.Static4D;
|
24
|
import org.distorted.objectlib.helpers.ObjectFaceShape;
|
25
|
import org.distorted.objectlib.helpers.ObjectShape;
|
26
|
import org.distorted.objectlib.helpers.ObjectSignature;
|
27
|
import org.distorted.objectlib.scrambling.ScrambleState;
|
28
|
import org.distorted.objectlib.main.ObjectType;
|
29
|
import org.distorted.objectlib.main.ShapeOctahedron;
|
30
|
import org.distorted.objectlib.touchcontrol.TouchControlOctahedron;
|
31
|
|
32
|
import java.io.InputStream;
|
33
|
|
34
|
import static org.distorted.objectlib.touchcontrol.TouchControl.TC_OCTAHEDRON;
|
35
|
import static org.distorted.objectlib.touchcontrol.TouchControl.TYPE_NOT_SPLIT;
|
36
|
|
37
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
38
|
|
39
|
public class TwistyTrajber extends ShapeOctahedron
|
40
|
{
|
41
|
// Trajber 3x3: each cut is at 1/5 of the length of the segment from the center to a vertex.
|
42
|
private static final float CUT3 = 0.20f;
|
43
|
// Trajber 4x4: each cut is at 0.27 of the length of the segment from the center to a vertex.
|
44
|
private static final float CUT4 = 0.27f;
|
45
|
|
46
|
static final Static3D[] ROT_AXIS = new Static3D[]
|
47
|
{
|
48
|
new Static3D(SQ2/2, 0, SQ2/2),
|
49
|
new Static3D( 0, 1, 0),
|
50
|
new Static3D(SQ2/2, 0,-SQ2/2)
|
51
|
};
|
52
|
|
53
|
private ScrambleState[] mStates;
|
54
|
private int[][] mBasicAngle;
|
55
|
private float[][] mCuts;
|
56
|
private float[][] mPositions;
|
57
|
private int[] mQuatIndex;
|
58
|
|
59
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
60
|
|
61
|
public TwistyTrajber(int[] numL, int meshState, int iconMode, Static4D quat, Static3D move, float scale, InputStream stream)
|
62
|
{
|
63
|
super(numL, meshState, iconMode, numL[0], quat, move, scale, stream);
|
64
|
}
|
65
|
|
66
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
67
|
|
68
|
@Override
|
69
|
public int[][] getSolvedQuats()
|
70
|
{
|
71
|
int[] numLayers = getNumLayers();
|
72
|
int numL = numLayers[0];
|
73
|
|
74
|
if( numL==3 )
|
75
|
{
|
76
|
return super.getSolvedQuats();
|
77
|
}
|
78
|
else
|
79
|
{
|
80
|
// special SolvedQuats for the case where there are no corner of edge cubits.
|
81
|
// first row {0} - means there are no corners or edges.
|
82
|
// each next defines all cubits of a singe face
|
83
|
// (numCubits, firstCubit, cubit1,..,cubitN-1, quat0,..., quatM)
|
84
|
|
85
|
return new int[][] {
|
86
|
{0},
|
87
|
{7, 0, 8,20,26,34,41,49, 10,23},
|
88
|
{7, 4,13,16,29,37,47,54, 10,23},
|
89
|
{7, 5, 9,17,25,36,45,52, 13,20},
|
90
|
{7, 1,12,21,30,35,43,51, 13,20},
|
91
|
{7, 6,11,23,27,38,44,53, 12,22},
|
92
|
{7, 2,14,19,28,33,42,50, 12,22},
|
93
|
{7, 3,10,18,24,32,40,48, 15,21},
|
94
|
{7, 7,15,22,31,39,46,55, 15,21},
|
95
|
};
|
96
|
}
|
97
|
}
|
98
|
|
99
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
100
|
|
101
|
public ScrambleState[] getScrambleStates()
|
102
|
{
|
103
|
if( mStates==null )
|
104
|
{
|
105
|
int[][] m = new int[16][];
|
106
|
|
107
|
for(int i=0; i<16; i++) m[i] = new int[] { 0,-1,i,0,1,i,0,2,i, 1,-1,i,1,1,i,1,2,i, 2,-1,i,2,1,i,2,2,i};
|
108
|
|
109
|
mStates = new ScrambleState[]
|
110
|
{
|
111
|
new ScrambleState( new int[][] { m[ 1], m[ 2], m[ 3] } ), // 0 0
|
112
|
new ScrambleState( new int[][] { null, m[ 4], m[ 5] } ), // 1 x
|
113
|
new ScrambleState( new int[][] { m[ 6], null, m[ 7] } ), // 2 y
|
114
|
new ScrambleState( new int[][] { m[ 8], m[ 9], null } ), // 3 z
|
115
|
new ScrambleState( new int[][] { m[10], null, m[ 7] } ), // 4 xy
|
116
|
new ScrambleState( new int[][] { m[11], m[ 9], null } ), // 5 xz
|
117
|
new ScrambleState( new int[][] { null, m[12], m[ 5] } ), // 6 yx
|
118
|
new ScrambleState( new int[][] { m[ 8], m[13], null } ), // 7 yz
|
119
|
new ScrambleState( new int[][] { null, m[ 4], m[14] } ), // 8 zx
|
120
|
new ScrambleState( new int[][] { m[ 6], null, m[15] } ), // 9 zy
|
121
|
new ScrambleState( new int[][] { null, null, m[ 5] } ), // 10 xyx
|
122
|
new ScrambleState( new int[][] { null, m[ 4], null } ), // 11 xzx
|
123
|
new ScrambleState( new int[][] { null, null, m[ 7] } ), // 12 yxy
|
124
|
new ScrambleState( new int[][] { m[ 6], null, null } ), // 13 yzy
|
125
|
new ScrambleState( new int[][] { null, m[ 9], null } ), // 14 zxz
|
126
|
new ScrambleState( new int[][] { m[ 8], null, null } ), // 15 zyz
|
127
|
};
|
128
|
}
|
129
|
|
130
|
return mStates;
|
131
|
}
|
132
|
|
133
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
134
|
|
135
|
public float[][] getCuts(int[] numLayers)
|
136
|
{
|
137
|
if( mCuts==null )
|
138
|
{
|
139
|
float[] tmp;
|
140
|
|
141
|
if( numLayers[0]==3 )
|
142
|
{
|
143
|
final float cut= CUT3*numLayers[0]*SQ2/2;
|
144
|
tmp = new float[] {-cut,+cut};
|
145
|
}
|
146
|
else
|
147
|
{
|
148
|
final float cut= CUT4*numLayers[0]*SQ2/2;
|
149
|
tmp = new float[] {-cut,0,+cut};
|
150
|
}
|
151
|
|
152
|
mCuts = new float[][] { tmp,tmp,tmp };
|
153
|
}
|
154
|
|
155
|
return mCuts;
|
156
|
}
|
157
|
|
158
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
159
|
|
160
|
public boolean[][] getLayerRotatable(int[] numLayers)
|
161
|
{
|
162
|
int numL = numLayers[0];
|
163
|
boolean[] tmp = new boolean[numL];
|
164
|
for(int i=0; i<numL; i++) tmp[i] = true;
|
165
|
return new boolean[][] { tmp,tmp,tmp };
|
166
|
}
|
167
|
|
168
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
169
|
|
170
|
public int getTouchControlType()
|
171
|
{
|
172
|
return TC_OCTAHEDRON;
|
173
|
}
|
174
|
|
175
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
176
|
|
177
|
public int getTouchControlSplit()
|
178
|
{
|
179
|
return TYPE_NOT_SPLIT;
|
180
|
}
|
181
|
|
182
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
183
|
|
184
|
public int[][][] getEnabled()
|
185
|
{
|
186
|
return new int[][][]
|
187
|
{
|
188
|
{{0,1,2}},{{0,1,2}},{{0,1,2}},{{0,1,2}},{{0,1,2}},{{0,1,2}},{{0,1,2}},{{0,1,2}}
|
189
|
};
|
190
|
}
|
191
|
|
192
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
193
|
|
194
|
public float[] getDist3D(int[] numLayers)
|
195
|
{
|
196
|
return TouchControlOctahedron.D3D;
|
197
|
}
|
198
|
|
199
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
200
|
|
201
|
public Static3D[] getFaceAxis()
|
202
|
{
|
203
|
return TouchControlOctahedron.FACE_AXIS;
|
204
|
}
|
205
|
|
206
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
207
|
|
208
|
public float[][] getCubitPositions(int[] numLayers)
|
209
|
{
|
210
|
if( mPositions==null )
|
211
|
{
|
212
|
int numL = numLayers[0];
|
213
|
float LEN = numL*0.5f;
|
214
|
|
215
|
if( numL==3 )
|
216
|
{
|
217
|
mPositions = new float[][]
|
218
|
{
|
219
|
{ -LEN, 0, LEN},
|
220
|
{ LEN, 0, -LEN},
|
221
|
{ LEN, 0, LEN},
|
222
|
{ -LEN, 0, -LEN},
|
223
|
{ 0, SQ2*LEN, 0},
|
224
|
{ 0,-SQ2*LEN, 0},
|
225
|
|
226
|
{ 0, 0, LEN},
|
227
|
{ LEN, 0, 0},
|
228
|
{ -LEN, 0, 0},
|
229
|
{ 0, 0, -LEN},
|
230
|
{-LEN/2, (SQ2/2)*LEN, LEN/2},
|
231
|
{ LEN/2, (SQ2/2)*LEN,-LEN/2},
|
232
|
{-LEN/2,-(SQ2/2)*LEN, LEN/2},
|
233
|
{ LEN/2,-(SQ2/2)*LEN,-LEN/2},
|
234
|
{ LEN/2, (SQ2/2)*LEN, LEN/2},
|
235
|
{ LEN/2,-(SQ2/2)*LEN, LEN/2},
|
236
|
{-LEN/2, (SQ2/2)*LEN,-LEN/2},
|
237
|
{-LEN/2,-(SQ2/2)*LEN,-LEN/2},
|
238
|
|
239
|
{ 0, SQ2*LEN/3, 2*LEN/3},
|
240
|
{ 2*LEN/3, SQ2*LEN/3, 0},
|
241
|
{ 0,-SQ2*LEN/3, 2*LEN/3},
|
242
|
{ 2*LEN/3,-SQ2*LEN/3, 0},
|
243
|
{-2*LEN/3, SQ2*LEN/3, 0},
|
244
|
{ 0, SQ2*LEN/3,-2*LEN/3},
|
245
|
{-2*LEN/3,-SQ2*LEN/3, 0},
|
246
|
{ 0,-SQ2*LEN/3,-2*LEN/3},
|
247
|
};
|
248
|
}
|
249
|
else
|
250
|
{
|
251
|
final float A = 0.5f*SQ2*CUT4*LEN;
|
252
|
final float B = CUT4*LEN;
|
253
|
final float C = CUT4/2;
|
254
|
final float D =-1.5f*C+0.5f;
|
255
|
final float E = 0.5f*C+0.5f;
|
256
|
final float F = (SQ2/2)*(1-C);
|
257
|
final float G = C*SQ2;
|
258
|
final float H = 1-C;
|
259
|
final float I = LEN-0.5f*B;
|
260
|
final float J = SQ2*(LEN-B);
|
261
|
|
262
|
mPositions = new float[][]
|
263
|
{
|
264
|
{ -I+B, A, I },
|
265
|
{ -I+B, -A, I },
|
266
|
{ I , A, -I+B },
|
267
|
{ I , -A, -I+B },
|
268
|
{ I-B, -A, -I },
|
269
|
{ I-B, A, -I },
|
270
|
{ I , A, I-B },
|
271
|
{ I , -A, I-B },
|
272
|
{ I-B, -A, I },
|
273
|
{ I-B, A, I },
|
274
|
{ -I , -A, -I+B },
|
275
|
{ -I , A, -I+B },
|
276
|
{ -I+B, A, -I },
|
277
|
{ -I+B, -A, -I },
|
278
|
{ B, J, 0 },
|
279
|
{ -B, J, 0 },
|
280
|
{ 0, J, B },
|
281
|
{ 0, J, -B },
|
282
|
{ B, -J, 0 },
|
283
|
{ -B, -J, 0 },
|
284
|
{ 0, -J, B },
|
285
|
{ 0, -J, -B },
|
286
|
{ -I , -A, I-B },
|
287
|
{ -I , A, I-B },
|
288
|
|
289
|
{ 0, G*LEN, H*LEN},
|
290
|
{ 0,-G*LEN, H*LEN},
|
291
|
{ H*LEN, G*LEN, 0},
|
292
|
{ H*LEN,-G*LEN, 0},
|
293
|
{-H*LEN, G*LEN, 0},
|
294
|
{-H*LEN,-G*LEN, 0},
|
295
|
{ 0, G*LEN,-H*LEN},
|
296
|
{ 0,-G*LEN,-H*LEN},
|
297
|
|
298
|
{-D*LEN, F*LEN, E*LEN },
|
299
|
{-E*LEN, F*LEN, D*LEN },
|
300
|
{ E*LEN, F*LEN,-D*LEN},
|
301
|
{ D*LEN, F*LEN,-E*LEN},
|
302
|
{-D*LEN,-F*LEN, E*LEN },
|
303
|
{-E*LEN,-F*LEN, D*LEN },
|
304
|
{ E*LEN,-F*LEN,-D*LEN},
|
305
|
{ D*LEN,-F*LEN,-E*LEN},
|
306
|
|
307
|
{+D*LEN, F*LEN,+E*LEN},
|
308
|
{+E*LEN, F*LEN,+D*LEN},
|
309
|
{+D*LEN,-F*LEN,+E*LEN},
|
310
|
{+E*LEN,-F*LEN,+D*LEN},
|
311
|
{-D*LEN, F*LEN,-E*LEN},
|
312
|
{-E*LEN, F*LEN,-D*LEN},
|
313
|
{-D*LEN,-F*LEN,-E*LEN},
|
314
|
{-E*LEN,-F*LEN,-D*LEN},
|
315
|
|
316
|
{ 0, SQ2*LEN/3, 2*LEN/3},
|
317
|
{ 2*LEN/3, SQ2*LEN/3, 0},
|
318
|
{ 0,-SQ2*LEN/3, 2*LEN/3},
|
319
|
{ 2*LEN/3,-SQ2*LEN/3, 0},
|
320
|
{-2*LEN/3, SQ2*LEN/3, 0},
|
321
|
{ 0, SQ2*LEN/3,-2*LEN/3},
|
322
|
{-2*LEN/3,-SQ2*LEN/3, 0},
|
323
|
{ 0,-SQ2*LEN/3,-2*LEN/3},
|
324
|
};
|
325
|
}
|
326
|
}
|
327
|
|
328
|
return mPositions;
|
329
|
}
|
330
|
|
331
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
332
|
|
333
|
public Static4D getCubitQuats(int cubit, int[] numLayers)
|
334
|
{
|
335
|
if( mQuatIndex==null )
|
336
|
{
|
337
|
if( numLayers[0]==3 )
|
338
|
{
|
339
|
mQuatIndex = new int[] { 0, 2, 6, 4, 1, 3,
|
340
|
0, 2, 8, 5, 7,19, 9,18, 1, 3,14,11,
|
341
|
0, 1, 3, 2, 7, 5, 8,16 };
|
342
|
}
|
343
|
else
|
344
|
{
|
345
|
mQuatIndex = new int[] { 0, 9,19, 2,18, 5, 6,12,17,21,20, 4,10,16, 1,14,15,13,23,22, 3,11, 8, 7,
|
346
|
0,17, 6, 2, 4, 8, 5,16,15, 7,19,13, 9,22,23,18,21, 1, 3,12,10,14,11,20,
|
347
|
0, 1, 3, 2, 7, 5, 8,16 };
|
348
|
}
|
349
|
}
|
350
|
|
351
|
return mObjectQuats[mQuatIndex[cubit]];
|
352
|
}
|
353
|
|
354
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
355
|
|
356
|
public ObjectShape getObjectShape(int variant)
|
357
|
{
|
358
|
float numL = getNumLayers()[0];
|
359
|
final float LEN = numL*0.5f;
|
360
|
final float CUT = numL==3 ? CUT3 : CUT4;
|
361
|
|
362
|
if( variant==0 )
|
363
|
{
|
364
|
final float A = SQ2*CUT*LEN;
|
365
|
final float B = CUT*LEN;
|
366
|
|
367
|
float[][] vertices = numL==3 ?
|
368
|
|
369
|
new float[][]
|
370
|
{
|
371
|
{ 0, 0, 0},
|
372
|
{ B, A, -B},
|
373
|
{ B, -A, -B},
|
374
|
{ 2*B, 0, 0},
|
375
|
{ 0, 0, -2*B},
|
376
|
{ 3*B, A, -B},
|
377
|
{ 3*B, -A, -B},
|
378
|
{ B, A, -3*B},
|
379
|
{ B, -A, -3*B},
|
380
|
|
381
|
{ LEN , A, 2*B-LEN},
|
382
|
{ LEN , -A, 2*B-LEN},
|
383
|
{ LEN-2*B, A, -LEN},
|
384
|
{ LEN-2*B, -A, -LEN},
|
385
|
}
|
386
|
:
|
387
|
new float[][]
|
388
|
{
|
389
|
{ -1.5f*B, -0.5f*A, 0.5f*B},
|
390
|
{ -0.5f*B, 0.5f*A, -0.5f*B},
|
391
|
{ 0.5f*B, -0.5f*A, 0.5f*B},
|
392
|
{ 1.5f*B, 0.5f*A, -0.5f*B},
|
393
|
|
394
|
{ LEN-1.5f*B, 0.5f*A, 2.5f*B-LEN},
|
395
|
{ LEN-2.5f*B, 0.5f*A, 1.5f*B-LEN},
|
396
|
{ LEN-2.5f*B, -0.5f*A, 1.5f*B-LEN},
|
397
|
{ LEN-1.5f*B, -0.5f*A, 2.5f*B-LEN},
|
398
|
};
|
399
|
|
400
|
int[][] indices = numL==3 ?
|
401
|
|
402
|
new int[][]
|
403
|
{
|
404
|
{0,3,5,1},
|
405
|
{0,2,6,3},
|
406
|
{0,4,8,2},
|
407
|
{0,1,7,4},
|
408
|
{3,6,10,9,5},
|
409
|
{2,8,12,10,6},
|
410
|
{4,7,11,12,8},
|
411
|
{1,5,9,11,7},
|
412
|
{9,10,12,11}
|
413
|
}
|
414
|
:
|
415
|
new int[][]
|
416
|
{
|
417
|
{0,2,3,1},
|
418
|
{2,7,4,3},
|
419
|
{3,4,5,1},
|
420
|
{0,1,5,6},
|
421
|
{0,6,7,2},
|
422
|
{7,6,5,4}
|
423
|
};
|
424
|
|
425
|
return new ObjectShape(vertices, indices);
|
426
|
}
|
427
|
if( variant==1 )
|
428
|
{
|
429
|
final float A = SQ2*CUT*LEN;
|
430
|
final float B = LEN*(1-2*CUT);
|
431
|
final float C = (SQ2/2)*A;
|
432
|
|
433
|
float[][] vertices = numL==3 ?
|
434
|
|
435
|
new float[][]
|
436
|
{
|
437
|
{ -B, 0, 0 },
|
438
|
{ -B+C, A, -C },
|
439
|
{ -B+C,-A, -C },
|
440
|
{ B, 0, 0 },
|
441
|
{ B-C, A, -C },
|
442
|
{ B-C,-A, -C },
|
443
|
{ 0, A, -B },
|
444
|
{ 0,-A, -B },
|
445
|
}
|
446
|
:
|
447
|
new float[][]
|
448
|
{
|
449
|
{ -B, -0.5f*A, C/2 },
|
450
|
{ -B+C, +0.5f*A, -C/2 },
|
451
|
{ B, -0.5f*A, C/2 },
|
452
|
{ B-C, +0.5f*A, -C/2 },
|
453
|
{ 0, +0.5f*A, -B+C/2 },
|
454
|
{ 0, -0.5f*A, -B+C/2 }
|
455
|
};
|
456
|
|
457
|
int[][] indices = numL==3 ?
|
458
|
|
459
|
new int[][]
|
460
|
{
|
461
|
{0,3,4,1},
|
462
|
{0,2,5,3},
|
463
|
{1,4,6},
|
464
|
{2,7,5},
|
465
|
{0,1,6,7,2},
|
466
|
{3,5,7,6,4}
|
467
|
}
|
468
|
:
|
469
|
new int[][]
|
470
|
{
|
471
|
{0,2,3,1},
|
472
|
{1,3,4},
|
473
|
{0,5,2},
|
474
|
{0,1,4,5},
|
475
|
{2,5,4,3}
|
476
|
};
|
477
|
|
478
|
return new ObjectShape(vertices, indices);
|
479
|
}
|
480
|
else
|
481
|
{
|
482
|
final float L = LEN*(1-3*CUT);
|
483
|
|
484
|
float[][] vertices =
|
485
|
{
|
486
|
{ -L, -(SQ2/3)*L, L/3 },
|
487
|
{ L, -(SQ2/3)*L, L/3 },
|
488
|
{ 0,(2*SQ2/3)*L,-2*L/3 },
|
489
|
{ 0, -(SQ2/3)*L,-2*L/3 },
|
490
|
};
|
491
|
|
492
|
int[][] indices =
|
493
|
{
|
494
|
{0,1,2},
|
495
|
{3,1,0},
|
496
|
{0,2,3},
|
497
|
{1,3,2},
|
498
|
};
|
499
|
|
500
|
return new ObjectShape(vertices, indices);
|
501
|
}
|
502
|
}
|
503
|
|
504
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
505
|
|
506
|
public ObjectFaceShape getObjectFaceShape(int variant)
|
507
|
{
|
508
|
int numL = getNumLayers()[0];
|
509
|
final float LEN = numL*0.5f;
|
510
|
final float CUT = numL==3 ? CUT3 : CUT4;
|
511
|
|
512
|
if( variant==0 )
|
513
|
{
|
514
|
float height = isInIconMode() ? 0.001f : 0.05f;
|
515
|
float[][] bands = { {height,35,0.15f,0.3f,4,1,1},{0.001f,35,0.15f,0.3f,4,1,1} };
|
516
|
float[][] corners = { {0.03f,0.10f} };
|
517
|
float[][] centers = { { LEN/2, 0.0f, -LEN/2} };
|
518
|
int[] bandIndices = numL==3 ? new int[] { 0,0,0,0,1,1,1,1,1 } : new int[] { 0,1,1,1,1,1 };
|
519
|
int[] indices = numL==3 ? new int[] { 0,-1,-1,-1,-1,0,0,0,0,-1,-1,-1,-1 } : new int[] { 0,0,0,-1,-1,-1,-1,-1 };
|
520
|
return new ObjectFaceShape(bands,bandIndices,corners,indices,centers,indices,null);
|
521
|
}
|
522
|
if( variant==1 )
|
523
|
{
|
524
|
float height = isInIconMode() ? 0.001f : 0.03f;
|
525
|
final float B = LEN*(1-2*CUT);
|
526
|
float[][] bands = { {height,35,0.15f,0.3f,3,1,1},{0.001f,35,0.15f,0.3f,3,1,1} };
|
527
|
float[][] corners = { {0.02f,0.10f} };
|
528
|
float[][] centers = { { 0, 0, -B} };
|
529
|
int[] bandIndices = numL==3 ? new int[] { 0,0,1,1,1,1 } : new int[] { 0,1,1,1,1 };
|
530
|
int[] indices = numL==3 ? new int[] { 0,0,0,0,0,0,-1,-1 } : new int[] { 0,0,0,0,-1,-1 };
|
531
|
return new ObjectFaceShape(bands,bandIndices,corners,indices,centers,indices,null);
|
532
|
}
|
533
|
else
|
534
|
{
|
535
|
float height = isInIconMode() ? 0.001f : 0.03f;
|
536
|
final float L = LEN*(1-3*CUT);
|
537
|
float[][] bands = { {height,35,0.15f,0.3f,4,1,1},{0.001f,35,0.15f,0.3f,4,0,0} };
|
538
|
float[][] corners = { {0.02f,0.10f} };
|
539
|
float[][] centers = { {0, -(SQ2/3)*L,-2*L/3} };
|
540
|
int[] bandIndices = { 0,1,1,1 };
|
541
|
int[] indices = { 0,0,0,-1 };
|
542
|
return new ObjectFaceShape(bands,bandIndices,corners,indices,centers,indices,null);
|
543
|
}
|
544
|
}
|
545
|
|
546
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
547
|
|
548
|
public int getNumCubitVariants(int[] numLayers)
|
549
|
{
|
550
|
return 3;
|
551
|
}
|
552
|
|
553
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
554
|
|
555
|
public int getCubitVariant(int cubit, int[] numLayers)
|
556
|
{
|
557
|
if( numLayers[0]==3 ) return cubit< 6 ? 0 : cubit<18 ? 1 : 2;
|
558
|
else return cubit<24 ? 0 : cubit<48 ? 1 : 2;
|
559
|
}
|
560
|
|
561
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
562
|
|
563
|
public float getStickerRadius()
|
564
|
{
|
565
|
return 0.12f;
|
566
|
}
|
567
|
|
568
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
569
|
|
570
|
public float getStickerStroke()
|
571
|
{
|
572
|
return isInIconMode() ? 0.20f : 0.10f;
|
573
|
}
|
574
|
|
575
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
576
|
|
577
|
public float[][] getStickerAngles()
|
578
|
{
|
579
|
return null;
|
580
|
}
|
581
|
|
582
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
583
|
// PUBLIC API
|
584
|
|
585
|
public Static3D[] getRotationAxis()
|
586
|
{
|
587
|
return ROT_AXIS;
|
588
|
}
|
589
|
|
590
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
591
|
|
592
|
public int[][] getBasicAngles()
|
593
|
{
|
594
|
if( mBasicAngle ==null )
|
595
|
{
|
596
|
int num = getNumLayers()[0];
|
597
|
int[] tmp = new int[num];
|
598
|
for(int i=0; i<num; i++) tmp[i] = 4;
|
599
|
mBasicAngle = new int[][] { tmp,tmp,tmp };
|
600
|
}
|
601
|
|
602
|
return mBasicAngle;
|
603
|
}
|
604
|
|
605
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
606
|
|
607
|
public String getShortName()
|
608
|
{
|
609
|
int[] numLayers = getNumLayers();
|
610
|
return numLayers[0]==3 ? ObjectType.TRAJ_3.name() : ObjectType.TRAJ_4.name();
|
611
|
}
|
612
|
|
613
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
614
|
|
615
|
public ObjectSignature getSignature()
|
616
|
{
|
617
|
int[] numLayers = getNumLayers();
|
618
|
|
619
|
switch(numLayers[0])
|
620
|
{
|
621
|
case 3: return new ObjectSignature(ObjectType.TRAJ_3);
|
622
|
case 4: return new ObjectSignature(ObjectType.TRAJ_4);
|
623
|
}
|
624
|
|
625
|
return null;
|
626
|
}
|
627
|
|
628
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
629
|
|
630
|
public String getObjectName()
|
631
|
{
|
632
|
int[] numLayers = getNumLayers();
|
633
|
|
634
|
switch(numLayers[0])
|
635
|
{
|
636
|
case 3: return "Trajber's Octahedron";
|
637
|
case 4: return "Trajber 4x4";
|
638
|
}
|
639
|
|
640
|
return null;
|
641
|
}
|
642
|
|
643
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
644
|
|
645
|
public String getInventor()
|
646
|
{
|
647
|
int[] numLayers = getNumLayers();
|
648
|
|
649
|
switch(numLayers[0])
|
650
|
{
|
651
|
case 3: return "Josef Trajber";
|
652
|
case 4: return "Jürgen Brandt";
|
653
|
}
|
654
|
|
655
|
return null;
|
656
|
}
|
657
|
|
658
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
659
|
|
660
|
public int getYearOfInvention()
|
661
|
{
|
662
|
int[] numLayers = getNumLayers();
|
663
|
return numLayers[0]==3 ? 1982 : 2001;
|
664
|
}
|
665
|
|
666
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
667
|
|
668
|
public int getComplexity()
|
669
|
{
|
670
|
int[] numLayers = getNumLayers();
|
671
|
return numLayers[0]==3 ? 2 : 3;
|
672
|
}
|
673
|
|
674
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
675
|
|
676
|
public String[][] getTutorials()
|
677
|
{
|
678
|
int[] numLayers = getNumLayers();
|
679
|
|
680
|
switch(numLayers[0])
|
681
|
{
|
682
|
case 3: return new String[][] {
|
683
|
{"gb","Q2NSiuJWVvk","Trajber and UFO Tutorial","SuperAntoniovivaldi"},
|
684
|
{"es","FPBirEJ8ZfY","Resolver Octaedro 3x3","Solución Rubik"},
|
685
|
{"de","FjQXlwJGniQ","Trajbers Octahedron Tutorial","GerCubing"},
|
686
|
{"br","kO3nMpZKv3Q","Resolver Octaedro Trajber","Rafael Cinoto"},
|
687
|
};
|
688
|
case 4: return new String[][] {
|
689
|
{"gb","FZlw68I7snM","4x4 Trajber's Tutorial (1/2)","SuperAntoniovivaldi"},
|
690
|
{"gb","VM0XFu7gAII","4x4 Trajber's Tutorial (2/2)","SuperAntoniovivaldi"},
|
691
|
{"es","Q8ljV-feLpU","Tutorial Octaedro 4x4 (1/2)","Dany Cuber"},
|
692
|
{"es","QyWpDLa1eZQ","Tutorial Octaedro 4x4 (2/2)","Dany Cuber"},
|
693
|
{"ru","ikUogVow-58","Как собрать Октаэдр 4х4","RBcuber"},
|
694
|
{"fr","4hxZyMVGiTA","Résolution de l'Octaèdre 4x4","asthalis"},
|
695
|
{"pl","oPBvAT9lwt4","Octahedron 4x4 TUTORIAL PL","MrUK"},
|
696
|
{"br","0ZgaoQ6IS2w","Resolver o octaedro Trajber 4x4 (1/3)","Rafael Cinoto"},
|
697
|
{"br","TjxTx3IJy6M","Resolver o octaedro Trajber 4x4 (2/3)","Rafael Cinoto"},
|
698
|
{"br","E8k2TXfUS8g","Resolver o octaedro Trajber 4x4 (3/3)","Rafael Cinoto"},
|
699
|
{"vn","yorULpIm6Yw","Tutorial N.22 - Octahedron 4x4","Duy Thích Rubik"},
|
700
|
};
|
701
|
}
|
702
|
|
703
|
return null;
|
704
|
}
|
705
|
}
|