1
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
2
|
// Copyright 2023 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 static org.distorted.objectlib.touchcontrol.TouchControl.TC_HEXAHEDRON;
|
13
|
import static org.distorted.objectlib.touchcontrol.TouchControl.TYPE_SPLIT_EDGE_COIN;
|
14
|
|
15
|
import org.distorted.library.helpers.QuatHelper;
|
16
|
import org.distorted.library.type.Static3D;
|
17
|
import org.distorted.library.type.Static4D;
|
18
|
import org.distorted.objectlib.helpers.FactoryCubit;
|
19
|
import org.distorted.objectlib.helpers.ObjectFaceShape;
|
20
|
import org.distorted.objectlib.helpers.ObjectShape;
|
21
|
import org.distorted.objectlib.helpers.ObjectSignature;
|
22
|
import org.distorted.objectlib.helpers.ObjectVertexEffects;
|
23
|
import org.distorted.objectlib.main.InitAssets;
|
24
|
import org.distorted.objectlib.main.InitData;
|
25
|
import org.distorted.objectlib.main.ObjectSignatures;
|
26
|
import org.distorted.objectlib.main.ObjectType;
|
27
|
import org.distorted.objectlib.scrambling.ScrambleEdgeGenerator;
|
28
|
import org.distorted.objectlib.shape.ShapeHexahedron;
|
29
|
import org.distorted.objectlib.touchcontrol.TouchControlHexahedron;
|
30
|
|
31
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
32
|
|
33
|
public class TwistyCoinHexahedron extends ShapeHexahedron
|
34
|
{
|
35
|
static final Static3D[] ROT_AXIS = new Static3D[]
|
36
|
{
|
37
|
new Static3D( SQ3/3, SQ3/3, SQ3/3),
|
38
|
new Static3D( SQ3/3, SQ3/3,-SQ3/3),
|
39
|
new Static3D( SQ3/3,-SQ3/3, SQ3/3),
|
40
|
new Static3D( SQ3/3,-SQ3/3,-SQ3/3),
|
41
|
new Static3D( 1, 0, 0),
|
42
|
new Static3D( 0, 1, 0),
|
43
|
new Static3D( 0, 0, 1),
|
44
|
};
|
45
|
|
46
|
private static final int N = 5;
|
47
|
private static final float C = 0.2f;
|
48
|
private static final float D = 0.85f;
|
49
|
|
50
|
private int[][] mEdges;
|
51
|
private int[][] mBasicAngle;
|
52
|
private float[][] mCuts;
|
53
|
private float[][] mPosition;
|
54
|
private int[] mQuatIndex;
|
55
|
private boolean[][] mRotatable;
|
56
|
|
57
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
58
|
|
59
|
public TwistyCoinHexahedron(int meshState, int iconMode, Static4D quat, Static3D move, float scale, InitData data, InitAssets asset)
|
60
|
{
|
61
|
super(meshState, iconMode, data.getNumLayers()[0], quat, move, scale, data, asset);
|
62
|
}
|
63
|
|
64
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
65
|
|
66
|
public int[][] getScrambleEdges()
|
67
|
{
|
68
|
if( mEdges==null )
|
69
|
{
|
70
|
setUpRotatable();
|
71
|
mEdges = ScrambleEdgeGenerator.getScrambleEdgesSingle(mBasicAngle, mRotatable);
|
72
|
}
|
73
|
|
74
|
return mEdges;
|
75
|
}
|
76
|
|
77
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
78
|
|
79
|
@Override
|
80
|
public int[][] getScrambleAlgorithms()
|
81
|
{
|
82
|
setUpRotatable();
|
83
|
return ScrambleEdgeGenerator.getScramblingAlgorithms(mBasicAngle, mRotatable);
|
84
|
}
|
85
|
|
86
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
87
|
|
88
|
public float[][] getCuts(int[] numLayers)
|
89
|
{
|
90
|
if( mCuts==null )
|
91
|
{
|
92
|
float C1 = 0.75f*SQ3;
|
93
|
float C2 = 1.49f;
|
94
|
float[] cut1 = new float[] { -C1,C1 };
|
95
|
float[] cut2 = new float[] { -C2,C2 };
|
96
|
mCuts = new float[][] { cut1,cut1,cut1,cut1,cut2,cut2,cut2 };
|
97
|
}
|
98
|
|
99
|
return mCuts;
|
100
|
}
|
101
|
|
102
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
103
|
|
104
|
private void setUpRotatable()
|
105
|
{
|
106
|
if( mRotatable==null )
|
107
|
{
|
108
|
boolean[] tmp = new boolean[] {true,false,true};
|
109
|
mRotatable = new boolean[][] { tmp,tmp,tmp,tmp,tmp,tmp,tmp };
|
110
|
}
|
111
|
}
|
112
|
|
113
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
114
|
|
115
|
public boolean[][] getLayerRotatable(int[] numLayers)
|
116
|
{
|
117
|
setUpRotatable();
|
118
|
return mRotatable;
|
119
|
}
|
120
|
|
121
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
122
|
|
123
|
public int getTouchControlType()
|
124
|
{
|
125
|
return TC_HEXAHEDRON;
|
126
|
}
|
127
|
|
128
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
129
|
|
130
|
public int getTouchControlSplit()
|
131
|
{
|
132
|
return TYPE_SPLIT_EDGE_COIN;
|
133
|
}
|
134
|
|
135
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
136
|
|
137
|
public int[][][] getEnabled()
|
138
|
{
|
139
|
return new int[][][]
|
140
|
{
|
141
|
{{4},{4},{4},{4},{1},{3},{2},{0}},
|
142
|
{{4},{4},{4},{4},{3},{1},{0},{2}},
|
143
|
{{5},{5},{5},{5},{1},{0},{3},{2}},
|
144
|
{{5},{5},{5},{5},{2},{3},{0},{1}},
|
145
|
{{6},{6},{6},{6},{0},{2},{1},{3}},
|
146
|
{{6},{6},{6},{6},{2},{0},{3},{1}},
|
147
|
};
|
148
|
}
|
149
|
|
150
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
151
|
|
152
|
public float[] getDist3D(int[] numLayers)
|
153
|
{
|
154
|
return TouchControlHexahedron.D3D;
|
155
|
}
|
156
|
|
157
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
158
|
|
159
|
public Static3D[] getFaceAxis()
|
160
|
{
|
161
|
return TouchControlHexahedron.FACE_AXIS;
|
162
|
}
|
163
|
|
164
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
165
|
|
166
|
public float[][] getCubitPositions(int[] numLayers)
|
167
|
{
|
168
|
if( mPosition==null )
|
169
|
{
|
170
|
final float A = 1.5f-C;
|
171
|
final float B = 1.52f;
|
172
|
final float E = 0.75f*D;
|
173
|
|
174
|
mPosition = new float[][]
|
175
|
{
|
176
|
{ A, A, A},
|
177
|
{ A, A,-A},
|
178
|
{ A,-A, A},
|
179
|
{ A,-A,-A},
|
180
|
{-A, A, A},
|
181
|
{-A, A,-A},
|
182
|
{-A,-A, A},
|
183
|
{-A,-A,-A},
|
184
|
|
185
|
{ 0, 0, B },
|
186
|
{ 0, 0,-B },
|
187
|
{ 0, B, 0 },
|
188
|
{ 0,-B, 0 },
|
189
|
{ B, 0, 0 },
|
190
|
{-B, 0, 0 },
|
191
|
|
192
|
{ E, E, B},
|
193
|
{ E,-E, B},
|
194
|
{-E, E, B},
|
195
|
{-E,-E, B},
|
196
|
{ E, E,-B},
|
197
|
{ E,-E,-B},
|
198
|
{-E, E,-B},
|
199
|
{-E,-E,-B},
|
200
|
{ E, B, E},
|
201
|
{ E, B,-E},
|
202
|
{-E, B, E},
|
203
|
{-E, B,-E},
|
204
|
{ E,-B, E},
|
205
|
{ E,-B,-E},
|
206
|
{-E,-B, E},
|
207
|
{-E,-B,-E},
|
208
|
{ B, E, E},
|
209
|
{ B, E,-E},
|
210
|
{ B,-E, E},
|
211
|
{ B,-E,-E},
|
212
|
{-B, E, E},
|
213
|
{-B, E,-E},
|
214
|
{-B,-E, E},
|
215
|
{-B,-E,-E},
|
216
|
};
|
217
|
}
|
218
|
|
219
|
return mPosition;
|
220
|
}
|
221
|
|
222
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
223
|
|
224
|
public Static4D getCubitQuats(int cubit, int[] numLayers)
|
225
|
{
|
226
|
if( mQuatIndex==null ) mQuatIndex = new int[] {0,9,11,4,12,3,6,21,
|
227
|
0,10,1,4,2,3,
|
228
|
0,15,17,16,19,10,13,23,1,9,20,7, 11,4,6,21,2,14,18,5,12,3,8,22 };
|
229
|
return mObjectQuats[mQuatIndex[cubit]];
|
230
|
}
|
231
|
|
232
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
233
|
|
234
|
private float[] rotateVertices(float angle, float[] vector, float[] center, float[] rotAxis)
|
235
|
{
|
236
|
float[] ret = new float[4];
|
237
|
float sin = (float)Math.sin(angle/2);
|
238
|
float cos = (float)Math.cos(angle/2);
|
239
|
float[] quat= new float[] { sin*rotAxis[0], sin*rotAxis[1], sin*rotAxis[2], cos};
|
240
|
QuatHelper.rotateVectorByQuat(ret,vector,quat);
|
241
|
|
242
|
ret[0] += center[0];
|
243
|
ret[1] += center[1];
|
244
|
ret[2] += center[2];
|
245
|
|
246
|
return ret;
|
247
|
}
|
248
|
|
249
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
250
|
|
251
|
private float[][] produceCorner()
|
252
|
{
|
253
|
final float angle = (float)Math.PI/(2*N);
|
254
|
final float A = 0.3f;
|
255
|
final int N1 = 4;
|
256
|
final int N2 = N1 + N + 1;
|
257
|
final int N3 = N2 + N + 1;
|
258
|
float[][] vertices= new float[3*N+8][3];
|
259
|
|
260
|
vertices[3*N+7][0] = -A;
|
261
|
vertices[3*N+7][1] = -A;
|
262
|
vertices[3*N+7][2] = -A;
|
263
|
|
264
|
vertices[0][0] = 0;
|
265
|
vertices[0][1] = 0;
|
266
|
vertices[0][2] = 0;
|
267
|
vertices[1][0] =-2;
|
268
|
vertices[1][1] = 0;
|
269
|
vertices[1][2] = 0;
|
270
|
vertices[2][0] = 0;
|
271
|
vertices[2][1] =-2;
|
272
|
vertices[2][2] = 0;
|
273
|
vertices[3][0] = 0;
|
274
|
vertices[3][1] = 0;
|
275
|
vertices[3][2] =-2;
|
276
|
|
277
|
for(int i=0; i<=N; i++)
|
278
|
{
|
279
|
float cos1 = (float)Math.cos((N-i)*angle);
|
280
|
float sin1 = (float)Math.sin((N-i)*angle);
|
281
|
float cos2 = (float)Math.cos(( i)*angle);
|
282
|
float sin2 = (float)Math.sin(( i)*angle);
|
283
|
|
284
|
vertices[N1+i][0] = 2*D*cos1-2;
|
285
|
vertices[N1+i][1] = 2*D*sin1-2;
|
286
|
vertices[N1+i][2] = 0;
|
287
|
|
288
|
vertices[N2+i][0] = 0;
|
289
|
vertices[N2+i][1] = 2*D*sin2-2;
|
290
|
vertices[N2+i][2] = 2*D*cos2-2;
|
291
|
|
292
|
vertices[N3+i][0] = 2*D*cos2-2;
|
293
|
vertices[N3+i][1] = 0;
|
294
|
vertices[N3+i][2] = 2*D*sin2-2;
|
295
|
}
|
296
|
|
297
|
for(int i=0; i<3*N+8; i++)
|
298
|
{
|
299
|
vertices[i][0] = 0.75f*vertices[i][0] + C;
|
300
|
vertices[i][1] = 0.75f*vertices[i][1] + C;
|
301
|
vertices[i][2] = 0.75f*vertices[i][2] + C;
|
302
|
}
|
303
|
|
304
|
return vertices;
|
305
|
}
|
306
|
|
307
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
308
|
|
309
|
private float[][] produceCenter()
|
310
|
{
|
311
|
float[][] ret = new float[4*N+1][];
|
312
|
|
313
|
float[] rot = new float[] { 0,0,-1 };
|
314
|
|
315
|
float[] center1 = { 1.5f*D, 1.5f*D, 0 };
|
316
|
float[] center2 = { 1.5f*D,-1.5f*D, 0 };
|
317
|
float[] center3 = {-1.5f*D,-1.5f*D, 0 };
|
318
|
float[] center4 = {-1.5f*D, 1.5f*D, 0 };
|
319
|
|
320
|
float[] vect1 = { -1.5f*D,0,0,0 };
|
321
|
float[] vect2 = { 0, 1.5f*D,0,0 };
|
322
|
float[] vect3 = { 1.5f*D,0,0,0 };
|
323
|
float[] vect4 = { 0,-1.5f*D,0,0 };
|
324
|
|
325
|
for(int i=0; i<N; i++)
|
326
|
{
|
327
|
float angle = (float)(Math.PI/2)*i/N;
|
328
|
|
329
|
ret[i ] = rotateVertices(angle, vect1, center1, rot);
|
330
|
ret[i+ N] = rotateVertices(angle, vect2, center2, rot);
|
331
|
ret[i+2*N] = rotateVertices(angle, vect3, center3, rot);
|
332
|
ret[i+3*N] = rotateVertices(angle, vect4, center4, rot);
|
333
|
}
|
334
|
|
335
|
ret[4*N] = new float[] { 0, 0, -1.5f };
|
336
|
|
337
|
return ret;
|
338
|
}
|
339
|
|
340
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
341
|
|
342
|
private float[][] produceLeaf()
|
343
|
{
|
344
|
float[][] ret = new float[2*N+1][];
|
345
|
|
346
|
float[] rot = new float[] { 0,0,1 };
|
347
|
|
348
|
float[] center1 = {-0.75f*D,-0.75f*D, 0 };
|
349
|
float[] center2 = { 0.75f*D, 0.75f*D, 0 };
|
350
|
|
351
|
float[] vect1 = { 0, 1.5f*D, 0, 0 };
|
352
|
float[] vect2 = { 0,-1.5f*D, 0, 0 };
|
353
|
|
354
|
for(int i=0; i<N; i++)
|
355
|
{
|
356
|
float angle = (float)(Math.PI/2)*i/N;
|
357
|
|
358
|
ret[ N-1-i] = rotateVertices(angle, vect1, center1, rot);
|
359
|
ret[2*N-1-i] = rotateVertices(angle, vect2, center2, rot);
|
360
|
}
|
361
|
|
362
|
ret[2*N] = new float[] { 0, 0, -1.5f/10 };
|
363
|
|
364
|
return ret;
|
365
|
}
|
366
|
|
367
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
368
|
|
369
|
private float[][] getVertices(int variant)
|
370
|
{
|
371
|
if( variant==0 ) return produceCorner();
|
372
|
else if( variant==1 ) return produceCenter();
|
373
|
else return produceLeaf();
|
374
|
}
|
375
|
|
376
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
377
|
|
378
|
private int[][] produceCornerShape()
|
379
|
{
|
380
|
int[][] indices = new int[3*N+9][];
|
381
|
|
382
|
indices[0] = new int[N+4];
|
383
|
indices[1] = new int[N+4];
|
384
|
indices[2] = new int[N+4];
|
385
|
|
386
|
indices[0][0] = 2;
|
387
|
indices[0][1] = 0;
|
388
|
indices[0][2] = 1;
|
389
|
indices[1][0] = 3;
|
390
|
indices[1][1] = 0;
|
391
|
indices[1][2] = 2;
|
392
|
indices[2][0] = 1;
|
393
|
indices[2][1] = 0;
|
394
|
indices[2][2] = 3;
|
395
|
|
396
|
int N1 = 4;
|
397
|
int N2 = N1 + N + 1;
|
398
|
int N3 = N2 + N + 1;
|
399
|
|
400
|
for(int i=0; i<=N; i++)
|
401
|
{
|
402
|
indices[0][i+3] = N1 + i;
|
403
|
indices[1][i+3] = N2 + i;
|
404
|
indices[2][i+3] = N3 + i;
|
405
|
}
|
406
|
|
407
|
for(int i=0; i<N; i++)
|
408
|
{
|
409
|
indices[3*i+3] = new int[] { N1+i+1, N1+i, 3*N+7 };
|
410
|
indices[3*i+4] = new int[] { N2+i+1, N2+i, 3*N+7 };
|
411
|
indices[3*i+5] = new int[] { N3+i+1, N3+i, 3*N+7 };
|
412
|
}
|
413
|
|
414
|
indices[3*N+3] = new int[] { 2 , 4+ N, 3*N+7 };
|
415
|
indices[3*N+4] = new int[] { 5 +N, 2 , 3*N+7 };
|
416
|
indices[3*N+5] = new int[] { 5+2*N, 3 , 3*N+7 };
|
417
|
indices[3*N+6] = new int[] { 3 , 6+2*N, 3*N+7 };
|
418
|
indices[3*N+7] = new int[] { 1 , 6+3*N, 3*N+7 };
|
419
|
indices[3*N+8] = new int[] { 4 , 1 , 3*N+7 };
|
420
|
|
421
|
return indices;
|
422
|
}
|
423
|
|
424
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
425
|
|
426
|
private int[][] produceCenterShape()
|
427
|
{
|
428
|
int[][] ret = new int[1+4*N][];
|
429
|
|
430
|
ret[0] = new int[4*N];
|
431
|
for(int i=0; i<4*N; i++) ret[0][i] = 4*N-1-i;
|
432
|
|
433
|
for(int i=0; i<N; i++)
|
434
|
{
|
435
|
ret[i+1] = new int[3];
|
436
|
ret[i+1][0] = i;
|
437
|
ret[i+1][1] = i+1;
|
438
|
ret[i+1][2] = 4*N;
|
439
|
|
440
|
ret[N+i+1] = new int[3];
|
441
|
ret[N+i+1][0] = N+i;
|
442
|
ret[N+i+1][1] = N+i+1;
|
443
|
ret[N+i+1][2] = 4*N;
|
444
|
|
445
|
ret[2*N+i+1] = new int[3];
|
446
|
ret[2*N+i+1][0] = 2*N+i;
|
447
|
ret[2*N+i+1][1] = 2*N+i+1;
|
448
|
ret[2*N+i+1][2] = 4*N;
|
449
|
|
450
|
ret[3*N+i+1] = new int[3];
|
451
|
ret[3*N+i+1][0] = 3*N+i;
|
452
|
ret[3*N+i+1][1] = i<N-1 ? 3*N+i+1 : 0;
|
453
|
ret[3*N+i+1][2] = 4*N;
|
454
|
}
|
455
|
|
456
|
return ret;
|
457
|
}
|
458
|
|
459
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
460
|
|
461
|
private int[][] produceLeafShape()
|
462
|
{
|
463
|
int[][] ret = new int[2*N+1][];
|
464
|
|
465
|
ret[0] = new int[2*N];
|
466
|
for(int i=0; i<2*N; i++) ret[0][i] = i;
|
467
|
|
468
|
for(int i=1; i<=N-1; i++)
|
469
|
{
|
470
|
ret[i] = new int[3];
|
471
|
ret[i][0] = i;
|
472
|
ret[i][1] = i-1;
|
473
|
ret[i][2] = 2*N;
|
474
|
|
475
|
ret[N-1+i] = new int[3];
|
476
|
ret[N-1+i][0] = N+i;
|
477
|
ret[N-1+i][1] = N+i-1;
|
478
|
ret[N-1+i][2] = 2*N;
|
479
|
}
|
480
|
|
481
|
ret[2*N-1] = new int[] { N, N-1, 2*N };
|
482
|
ret[2*N ] = new int[] { 0,2*N-1, 2*N };
|
483
|
|
484
|
return ret;
|
485
|
}
|
486
|
|
487
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
488
|
|
489
|
public ObjectShape getObjectShape(int variant)
|
490
|
{
|
491
|
if( variant==0 )
|
492
|
{
|
493
|
int[][] indices = produceCornerShape();
|
494
|
return new ObjectShape(getVertices(variant), indices);
|
495
|
}
|
496
|
else if( variant==1 )
|
497
|
{
|
498
|
int[][] indices = produceCenterShape();
|
499
|
return new ObjectShape(getVertices(variant), indices);
|
500
|
}
|
501
|
else
|
502
|
{
|
503
|
int[][] indices = produceLeafShape();
|
504
|
return new ObjectShape(getVertices(variant), indices);
|
505
|
}
|
506
|
}
|
507
|
|
508
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
509
|
|
510
|
public ObjectFaceShape getObjectFaceShape(int variant)
|
511
|
{
|
512
|
if( variant==0 )
|
513
|
{
|
514
|
float h1 = isInIconMode() ? 0.0001f : 0.03f;
|
515
|
float h2 = isInIconMode() ? 0.0001f : 0.01f;
|
516
|
float[][] bands = { {h1,35,0.2f,0.4f,5,2,1}, {h2,35,0.2f,0.4f,2,0,0} };
|
517
|
int num = 3*N+9;
|
518
|
int[] indices = new int[num];
|
519
|
for(int i=3; i<num; i++) indices[i] = 1;
|
520
|
float S = 1-SQ2/2 - C;
|
521
|
float[] convexCenter = {-S,-S,-S };
|
522
|
return new ObjectFaceShape(bands,indices,convexCenter);
|
523
|
}
|
524
|
else if( variant==1 )
|
525
|
{
|
526
|
float h1 = isInIconMode() ? 0.0001f : 0.0001f;
|
527
|
float h2 = 0.0001f;
|
528
|
float[][] bands = { {h1,15,0.2f,0.4f,5,0,0}, {h2,15,0.05f,0.1f,2,0,0} };
|
529
|
int num = 1+4*N;
|
530
|
int[] indices = new int[num];
|
531
|
for(int i=1; i<num; i++) indices[i] = 1;
|
532
|
return new ObjectFaceShape(bands,indices,null);
|
533
|
}
|
534
|
else
|
535
|
{
|
536
|
float h1 = isInIconMode() ? 0.0001f : 0.015f;
|
537
|
float h2 = isInIconMode() ? 0.0001f : 0.001f;
|
538
|
float[][] bands = { {h1,15,0.250f,0.7f,5,0,0}, {h2,15,0.125f,0.2f,2,0,0} };
|
539
|
int num = 1+2*N;
|
540
|
int[] indices = new int[num];
|
541
|
for(int i=1; i<num; i++) indices[i] = 1;
|
542
|
return new ObjectFaceShape(bands,indices,null);
|
543
|
}
|
544
|
}
|
545
|
|
546
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
547
|
|
548
|
public ObjectVertexEffects getVertexEffects(int variant)
|
549
|
{
|
550
|
if( variant==0 )
|
551
|
{
|
552
|
float[][] corners = { {0.10f,0.20f} };
|
553
|
int num = 8+3*N;
|
554
|
int[] indices = new int[num];
|
555
|
for(int i=1; i<num; i++) indices[i] = -1;
|
556
|
float[][] centers = {{ 0,0,0 }};
|
557
|
return FactoryCubit.generateVertexEffect(getVertices(variant),corners,indices,centers,indices);
|
558
|
}
|
559
|
else if( variant==1 )
|
560
|
{
|
561
|
float[][] corners = { {0.05f,0.20f} };
|
562
|
int num = 1+4*N;
|
563
|
int[] indices = new int[num];
|
564
|
for(int i=0; i<num; i++) indices[i] = -1;
|
565
|
float[][] centers = { { 0,0,0 } };
|
566
|
return FactoryCubit.generateVertexEffect(getVertices(variant),corners,indices,centers,indices);
|
567
|
}
|
568
|
else
|
569
|
{
|
570
|
float[][] corners = { {0.05f,0.20f} };
|
571
|
int num = 1+2*N;
|
572
|
int[] indices = new int[num];
|
573
|
for(int i=0; i<num; i++) indices[i] = -1;
|
574
|
float[][] centers = { { 0,0,0 } };
|
575
|
return FactoryCubit.generateVertexEffect(getVertices(variant),corners,indices,centers,indices);
|
576
|
}
|
577
|
}
|
578
|
|
579
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
580
|
|
581
|
public int getNumCubitVariants(int[] numLayers)
|
582
|
{
|
583
|
return 3;
|
584
|
}
|
585
|
|
586
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
587
|
|
588
|
public int getCubitVariant(int cubit, int[] numLayers)
|
589
|
{
|
590
|
return cubit<8 ? 0 : (cubit<14 ? 1:2);
|
591
|
}
|
592
|
|
593
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
594
|
|
595
|
public float getStickerRadius()
|
596
|
{
|
597
|
return 0.12f;
|
598
|
}
|
599
|
|
600
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
601
|
|
602
|
public float getStickerStroke()
|
603
|
{
|
604
|
return isInIconMode() ? 0.15f : 0.12f;
|
605
|
}
|
606
|
|
607
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
608
|
// ditto, manually provide the sticker coordinates.
|
609
|
|
610
|
@Override
|
611
|
public void adjustStickerCoords()
|
612
|
{
|
613
|
float A = 0.38f;
|
614
|
float B = 0.24f;
|
615
|
|
616
|
mStickerCoords = new float[][]
|
617
|
{
|
618
|
{ A,-0.5f, A, A, -0.5f, A, -0.5f, B, B, -0.5f },
|
619
|
{ 0.5f, 0.0f, 0.0f, 0.5f, -0.5f, 0.0f, 0.0f, -0.5f },
|
620
|
{ 0.5f, -0.5f, -0.5f, 0.5f }
|
621
|
};
|
622
|
}
|
623
|
|
624
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
625
|
|
626
|
public float[][] getStickerAngles()
|
627
|
{
|
628
|
float D = (float)(Math.PI/4);
|
629
|
return new float[][] { { 0,0,0,-D,0 },{-D,-D,-D,-D},{D,D} };
|
630
|
}
|
631
|
|
632
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
633
|
// PUBLIC API
|
634
|
|
635
|
public Static3D[] getRotationAxis()
|
636
|
{
|
637
|
return ROT_AXIS;
|
638
|
}
|
639
|
|
640
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
641
|
|
642
|
public int[][] getBasicAngles()
|
643
|
{
|
644
|
if( mBasicAngle ==null )
|
645
|
{
|
646
|
int[] tmp1 = {3,3,3};
|
647
|
int[] tmp2 = {4,4,4};
|
648
|
mBasicAngle = new int[][] { tmp1,tmp1,tmp1,tmp1,tmp2,tmp2,tmp2 };
|
649
|
}
|
650
|
|
651
|
return mBasicAngle;
|
652
|
}
|
653
|
|
654
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
655
|
|
656
|
public String getShortName()
|
657
|
{
|
658
|
return ObjectType.COIH_3.name();
|
659
|
}
|
660
|
|
661
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
662
|
|
663
|
public ObjectSignature getSignature()
|
664
|
{
|
665
|
return new ObjectSignature(ObjectSignatures.COIH_3);
|
666
|
}
|
667
|
|
668
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
669
|
|
670
|
public String getObjectName()
|
671
|
{
|
672
|
return "Ancient Coin Cube";
|
673
|
}
|
674
|
|
675
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
676
|
|
677
|
public String getInventor()
|
678
|
{
|
679
|
return "Yukang Wu";
|
680
|
}
|
681
|
|
682
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
683
|
|
684
|
public int getYearOfInvention()
|
685
|
{
|
686
|
return 2018;
|
687
|
}
|
688
|
|
689
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
690
|
|
691
|
public int getComplexity()
|
692
|
{
|
693
|
return 0;
|
694
|
}
|
695
|
|
696
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
697
|
|
698
|
public String[][] getTutorials()
|
699
|
{
|
700
|
return new String[][] {
|
701
|
{"gb","8hPxLbZDSLQ","Chinese Coin Cube","CanChrisSolve"},
|
702
|
{"es","rK0_IsjoZqM","Ancient Coin Cube","R de Rubik"},
|
703
|
{"ru","HVZj2vBxD5A","Как собрать Коин Куб","Алексей Ярыгин"},
|
704
|
{"pl","yaNeIw4C5Uk","Ancient coin cube TUTORIAL PL","MrUK"},
|
705
|
};
|
706
|
}
|
707
|
}
|