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