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