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