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 static org.distorted.objectlib.touchcontrol.TouchControlDodecahedron.COS54;
|
13
|
import static org.distorted.objectlib.touchcontrol.TouchControlDodecahedron.SIN54;
|
14
|
|
15
|
import org.distorted.library.type.Static3D;
|
16
|
import org.distorted.library.type.Static4D;
|
17
|
import org.distorted.library.main.QuatHelper;
|
18
|
|
19
|
import org.distorted.objectlib.helpers.FactoryCubit;
|
20
|
import org.distorted.objectlib.helpers.ObjectFaceShape;
|
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.helpers.ObjectShape;
|
28
|
|
29
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
30
|
|
31
|
public class TwistyKilominx extends TwistyDodecahedron
|
32
|
{
|
33
|
public TwistyKilominx(int meshState, int iconMode, Static4D quat, Static3D move, float scale, InitData data, InitAssets asset)
|
34
|
{
|
35
|
super(meshState, iconMode, quat, move, scale, data, asset);
|
36
|
}
|
37
|
|
38
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
39
|
// make the 'center' sticker artificially smaller, so that we paint over the area in the center of the face.
|
40
|
|
41
|
@Override
|
42
|
public void adjustStickerCoords()
|
43
|
{
|
44
|
int[] numLayers = getNumLayers();
|
45
|
int index = numLayers[0]==3 ? 0:3;
|
46
|
float CENTER_CORR = 0.87f;
|
47
|
|
48
|
mStickerCoords[index][2] *= CENTER_CORR;
|
49
|
mStickerCoords[index][3] *= CENTER_CORR;
|
50
|
}
|
51
|
|
52
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
53
|
|
54
|
private int numCubitsPerCorner(int numLayers)
|
55
|
{
|
56
|
return 3*((numLayers-3)/2)*((numLayers-5)/2) + (numLayers<5 ? 0:1);
|
57
|
}
|
58
|
|
59
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
60
|
|
61
|
private int numCubitsPerEdge(int numLayers)
|
62
|
{
|
63
|
return numLayers<5 ? 0 : 2*(numLayers-4);
|
64
|
}
|
65
|
|
66
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
67
|
|
68
|
public float[][] getCuts(int[] numLayers)
|
69
|
{
|
70
|
return genericGetCuts(numLayers[0],0.5f);
|
71
|
}
|
72
|
|
73
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
74
|
// Fill out mCurrCorner{X,Y,Z} by applying appropriate Quat to mBasicCorner{X,Y,Z}
|
75
|
// Appropriate one: QUATS[QUAT_INDICES[corner]].
|
76
|
|
77
|
private void computeBasicCornerVectors(int corner)
|
78
|
{
|
79
|
if( mQuatCornerIndices==null ) initializeQuatIndices();
|
80
|
if( mCurrCornerV==null || mBasicCornerV==null ) initializeCornerV();
|
81
|
|
82
|
Static4D quat = mObjectQuats[mQuatCornerIndices[corner]];
|
83
|
|
84
|
mCurrCornerV[0] = QuatHelper.rotateVectorByQuat(mBasicCornerV[0],quat);
|
85
|
mCurrCornerV[1] = QuatHelper.rotateVectorByQuat(mBasicCornerV[1],quat);
|
86
|
mCurrCornerV[2] = QuatHelper.rotateVectorByQuat(mBasicCornerV[2],quat);
|
87
|
}
|
88
|
|
89
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
90
|
|
91
|
private float[] computeCorner(int numCubitsPerCorner, int numLayers, int corner, int part)
|
92
|
{
|
93
|
if( mCorners==null ) initializeCorners();
|
94
|
if( mCurrCornerV==null || mBasicCornerV==null ) initializeCornerV();
|
95
|
|
96
|
float D = numLayers/3.0f;
|
97
|
float[] corn = mCorners[corner];
|
98
|
|
99
|
if( part==0 )
|
100
|
{
|
101
|
return new float[] { corn[0]*D, corn[1]*D, corn[2]*D };
|
102
|
}
|
103
|
else
|
104
|
{
|
105
|
float E = D/(0.5f*(numLayers-1)); // ?? maybe 0.5*
|
106
|
int N = (numCubitsPerCorner-1)/3;
|
107
|
int block = (part-1) % N;
|
108
|
int index = (part-1) / N;
|
109
|
Static4D pri = mCurrCornerV[index];
|
110
|
Static4D sec = mCurrCornerV[(index+2)%3];
|
111
|
|
112
|
int layers= (numLayers-5)/2;
|
113
|
int multP = (block % layers) + 1;
|
114
|
int multS = (block / layers);
|
115
|
|
116
|
return new float[] {
|
117
|
corn[0]*D + (pri.get0()*multP + sec.get0()*multS)*E,
|
118
|
corn[1]*D + (pri.get1()*multP + sec.get1()*multS)*E,
|
119
|
corn[2]*D + (pri.get2()*multP + sec.get2()*multS)*E
|
120
|
};
|
121
|
}
|
122
|
}
|
123
|
|
124
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
125
|
|
126
|
private float[] computeCenter(int numLayers, int center, int part)
|
127
|
{
|
128
|
if( mCenterCoords==null ) initializeCenterCoords();
|
129
|
if( mCorners ==null ) initializeCorners();
|
130
|
if( mCenterMap ==null ) initializeCenterMap();
|
131
|
|
132
|
int corner = mCenterMap[center][part];
|
133
|
float[] cent = mCenterCoords[center];
|
134
|
float[] corn = mCorners[corner];
|
135
|
float D = numLayers/3.0f;
|
136
|
float F = 1.0f - (2.0f*numLayers-6.0f)/(numLayers-1)*COS54*COS54;
|
137
|
|
138
|
return new float[]
|
139
|
{
|
140
|
D * ( cent[0] + (corn[0]-cent[0])*F),
|
141
|
D * ( cent[1] + (corn[1]-cent[1])*F),
|
142
|
D * ( cent[2] + (corn[2]-cent[2])*F)
|
143
|
};
|
144
|
}
|
145
|
|
146
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
147
|
|
148
|
private int computeEdgeType(int cubit, int numCubitsPerCorner, int numCubitsPerEdge)
|
149
|
{
|
150
|
int part = (cubit - NUM_CORNERS*numCubitsPerCorner) % numCubitsPerEdge;
|
151
|
return part - 2*(part/4);
|
152
|
}
|
153
|
|
154
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
155
|
|
156
|
private float[] computeEdge(int numLayers, int edge, int part)
|
157
|
{
|
158
|
if( mCenterCoords==null ) initializeCenterCoords();
|
159
|
if( mCorners==null ) initializeCorners();
|
160
|
if( mEdgeMap==null ) initializeEdgeMap();
|
161
|
|
162
|
float D = numLayers/3.0f;
|
163
|
float[] c1 = mCorners[ mEdgeMap[edge][0] ];
|
164
|
float[] c2 = mCorners[ mEdgeMap[edge][1] ];
|
165
|
|
166
|
int leftRight = 2*(part%2) -1;
|
167
|
part /= 2;
|
168
|
|
169
|
if( part==0 )
|
170
|
{
|
171
|
float T = 0.5f + leftRight/(numLayers-1.0f);
|
172
|
float x = D * (T*c1[0]+(1.0f-T)*c2[0]);
|
173
|
float y = D * (T*c1[1]+(1.0f-T)*c2[1]);
|
174
|
float z = D * (T*c1[2]+(1.0f-T)*c2[2]);
|
175
|
|
176
|
return new float[] { x, y, z };
|
177
|
}
|
178
|
else
|
179
|
{
|
180
|
int mult = (part+1)/2;
|
181
|
int dir = (part+1)%2;
|
182
|
float[] center = mCenterCoords[ mEdgeMap[edge][dir+2] ];
|
183
|
float x = 0.5f * D * (c1[0]+c2[0]);
|
184
|
float y = 0.5f * D * (c1[1]+c2[1]);
|
185
|
float z = 0.5f * D * (c1[2]+c2[2]);
|
186
|
|
187
|
float vX = D*center[0] - x;
|
188
|
float vY = D*center[1] - y;
|
189
|
float vZ = D*center[2] - z;
|
190
|
|
191
|
float T = 0.5f + leftRight*(mult*SIN18 + 1.0f)/(numLayers-1);
|
192
|
|
193
|
x = D * (T*c1[0]+(1.0f-T)*c2[0]);
|
194
|
y = D * (T*c1[1]+(1.0f-T)*c2[1]);
|
195
|
z = D * (T*c1[2]+(1.0f-T)*c2[2]);
|
196
|
|
197
|
float H = mult*D*COS18/(numLayers-1);
|
198
|
H /= (float)Math.sqrt(vX*vX+vY*vY+vZ*vZ);
|
199
|
|
200
|
return new float[] { x + H*vX, y + H*vY, z + H*vZ };
|
201
|
}
|
202
|
}
|
203
|
|
204
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
205
|
|
206
|
public float[][] getCubitPositions(int[] numLayers)
|
207
|
{
|
208
|
if( mCorners==null ) initializeCorners();
|
209
|
|
210
|
int numL = numLayers[0];
|
211
|
if( numL<5 ) return mCorners;
|
212
|
|
213
|
int numCubitsPerCorner = numCubitsPerCorner(numL);
|
214
|
int numCubitsPerEdge = numCubitsPerEdge(numL);
|
215
|
int numCubitsPerCenter = 5;
|
216
|
int numCubits = NUM_CORNERS*numCubitsPerCorner + NUM_EDGES*numCubitsPerEdge + NUM_CENTERS*numCubitsPerCenter;
|
217
|
int index=0;
|
218
|
|
219
|
final float[][] CENTERS = new float[numCubits][];
|
220
|
|
221
|
for(int corner=0; corner<NUM_CORNERS; corner++)
|
222
|
{
|
223
|
computeBasicCornerVectors(corner);
|
224
|
|
225
|
for(int part=0; part<numCubitsPerCorner; part++, index++)
|
226
|
{
|
227
|
CENTERS[index] = computeCorner(numCubitsPerCorner,numL,corner,part);
|
228
|
}
|
229
|
}
|
230
|
|
231
|
for(int edge=0; edge<NUM_EDGES; edge++)
|
232
|
{
|
233
|
for(int part=0; part<numCubitsPerEdge; part++, index++)
|
234
|
{
|
235
|
CENTERS[index] = computeEdge(numL, edge, part );
|
236
|
}
|
237
|
}
|
238
|
|
239
|
for(int center=0; center<NUM_CENTERS; center++)
|
240
|
{
|
241
|
for(int part=0; part<numCubitsPerCenter; part++, index++)
|
242
|
{
|
243
|
CENTERS[index] = computeCenter(numL,center, part);
|
244
|
}
|
245
|
}
|
246
|
|
247
|
return CENTERS;
|
248
|
}
|
249
|
|
250
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
251
|
|
252
|
public Static4D getCubitQuats(int cubit, int[] numLayers)
|
253
|
{
|
254
|
int numL = numLayers[0];
|
255
|
int numCubitsPerCorner = numCubitsPerCorner(numL);
|
256
|
int numCubitsPerEdge = numCubitsPerEdge(numL);
|
257
|
int q = getQuat(cubit,numCubitsPerCorner,numCubitsPerEdge);
|
258
|
return mObjectQuats[q];
|
259
|
}
|
260
|
|
261
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
262
|
|
263
|
private int getQuat(int cubit, int numCubitsPerCorner, int numCubitsPerEdge)
|
264
|
{
|
265
|
if( mQuatCornerIndices==null || mQuatEdgeIndices==null ) initializeQuatIndices();
|
266
|
if( mCenterMap==null ) initializeCenterMap();
|
267
|
|
268
|
if( cubit < NUM_CORNERS*numCubitsPerCorner )
|
269
|
{
|
270
|
int corner = cubit/numCubitsPerCorner;
|
271
|
return mQuatCornerIndices[corner];
|
272
|
}
|
273
|
|
274
|
if( cubit < NUM_CORNERS*numCubitsPerCorner + NUM_EDGES*numCubitsPerEdge )
|
275
|
{
|
276
|
int edge = (cubit-NUM_CORNERS*numCubitsPerCorner)/numCubitsPerEdge;
|
277
|
return mQuatEdgeIndices[edge];
|
278
|
}
|
279
|
|
280
|
if( numCubitsPerCorner==0 )
|
281
|
{
|
282
|
return mQuatCornerIndices[cubit];
|
283
|
}
|
284
|
else
|
285
|
{
|
286
|
cubit -= (NUM_CORNERS*numCubitsPerCorner + NUM_EDGES*numCubitsPerEdge);
|
287
|
int numCubitsPerCenter = 5;
|
288
|
int face = cubit/numCubitsPerCenter;
|
289
|
int index= cubit%numCubitsPerCenter;
|
290
|
int center=mCenterMap[face][index];
|
291
|
return mQuatCornerIndices[center];
|
292
|
}
|
293
|
}
|
294
|
|
295
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
296
|
|
297
|
private float[][] getVertices(int variant)
|
298
|
{
|
299
|
int[] numLayers = getNumLayers();
|
300
|
int numVariants = getNumCubitVariants(numLayers);
|
301
|
int numL = numLayers[0];
|
302
|
boolean small = numL<=3;
|
303
|
|
304
|
if( variant==0 && !small )
|
305
|
{
|
306
|
float width = numL/(numL-1.0f);
|
307
|
float X = width*COS18*SIN_HALFD;
|
308
|
float Y = width*SIN18;
|
309
|
float Z = width*COS18*COS_HALFD;
|
310
|
|
311
|
return new float[][]
|
312
|
{
|
313
|
{ 0, 0 , 0 },
|
314
|
{ X, Y , -Z },
|
315
|
{ 0, 2*Y ,-2*Z },
|
316
|
{ -X, Y , -Z },
|
317
|
{ 0, 0-width, 0 },
|
318
|
{ X, Y-width, -Z },
|
319
|
{ 0, 2*Y-width,-2*Z },
|
320
|
{ -X, Y-width, -Z },
|
321
|
};
|
322
|
}
|
323
|
else if( variant<numVariants-1 )
|
324
|
{
|
325
|
int type = variant-1;
|
326
|
float tmpVal= numL/(numL-1.0f);
|
327
|
float height= tmpVal*COS18;
|
328
|
float width = tmpVal + (type/2)*tmpVal*SIN18;
|
329
|
boolean left = (type%2)==0;
|
330
|
|
331
|
float X = height*SIN_HALFD;
|
332
|
float Y = height*SIN18/COS18;
|
333
|
float Z = height*COS_HALFD;
|
334
|
|
335
|
float[][] vertices =
|
336
|
{
|
337
|
{ 0, 0 , 0 },
|
338
|
{ X, Y , -Z },
|
339
|
{ 0, 2*Y ,-2*Z },
|
340
|
{ -X, Y , -Z },
|
341
|
{ 0, -width, 0 },
|
342
|
{ X, -width, -Z },
|
343
|
{ 0, -width,-2*Z },
|
344
|
{ -X, -width, -Z },
|
345
|
};
|
346
|
|
347
|
if( !left )
|
348
|
{
|
349
|
int len = vertices.length;
|
350
|
for(int i=0; i<len; i++) vertices[i][1] = -vertices[i][1];
|
351
|
}
|
352
|
return vertices;
|
353
|
}
|
354
|
else
|
355
|
{
|
356
|
float width = (1+0.5f*(numL-3)*SIN18)*numL/(numL-1);
|
357
|
float X = width*COS18*SIN_HALFD;
|
358
|
float Y = width*SIN18;
|
359
|
float Z = width*COS18*COS_HALFD;
|
360
|
float H = width*(SIN54/COS54);
|
361
|
float H3= H/COS_HALFD;
|
362
|
float X3= H*SIN_HALFD;
|
363
|
float Z3= H*COS_HALFD;
|
364
|
float C = 1/(COS54*(float)Math.sqrt(2-2*SIN18));
|
365
|
|
366
|
return new float[][]
|
367
|
{
|
368
|
{ 0, 0 , 0 },
|
369
|
{ X, Y , -Z },
|
370
|
{ 0,C*2*Y ,-2*C*Z },
|
371
|
{ -X, Y , -Z },
|
372
|
{ 0,-width, 0 },
|
373
|
{ X3,-width, -Z3 },
|
374
|
{ 0,-width, -H3 },
|
375
|
{ -X3,-width, -Z3 }
|
376
|
};
|
377
|
}
|
378
|
}
|
379
|
|
380
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
381
|
|
382
|
public ObjectShape getObjectShape(int variant)
|
383
|
{
|
384
|
int[] numLayers = getNumLayers();
|
385
|
int numVariants = getNumCubitVariants(numLayers);
|
386
|
int numL = numLayers[0];
|
387
|
boolean small = numL<=3;
|
388
|
|
389
|
if( variant==0 && !small )
|
390
|
{
|
391
|
int[][] indices =
|
392
|
{
|
393
|
{4,5,1,0},
|
394
|
{7,4,0,3},
|
395
|
{0,1,2,3},
|
396
|
{7,6,5,4},
|
397
|
{2,1,5,6},
|
398
|
{3,2,6,7}
|
399
|
};
|
400
|
|
401
|
return new ObjectShape(getVertices(variant), indices);
|
402
|
}
|
403
|
if( variant<numVariants-1 )
|
404
|
{
|
405
|
boolean left = (variant%2)==1;
|
406
|
|
407
|
int[][] indices =
|
408
|
{
|
409
|
{4,5,1,0},
|
410
|
{7,4,0,3},
|
411
|
{3,2,6,7},
|
412
|
{2,1,5,6},
|
413
|
{0,1,2,3},
|
414
|
{7,6,5,4}
|
415
|
};
|
416
|
|
417
|
if( !left )
|
418
|
{
|
419
|
int tmp, len = indices.length;
|
420
|
|
421
|
for(int i=0; i<len; i++)
|
422
|
{
|
423
|
tmp = indices[i][0];
|
424
|
indices[i][0] = indices[i][3];
|
425
|
indices[i][3] = tmp;
|
426
|
tmp = indices[i][1];
|
427
|
indices[i][1] = indices[i][2];
|
428
|
indices[i][2] = tmp;
|
429
|
}
|
430
|
}
|
431
|
|
432
|
return new ObjectShape(getVertices(variant), indices);
|
433
|
}
|
434
|
else
|
435
|
{
|
436
|
int[][] indices =
|
437
|
{
|
438
|
{4,5,1,0},
|
439
|
{7,4,0,3},
|
440
|
{0,1,2,3},
|
441
|
{3,2,6,7},
|
442
|
{2,1,5,6},
|
443
|
{7,6,5,4}
|
444
|
};
|
445
|
|
446
|
return new ObjectShape(getVertices(variant), indices);
|
447
|
}
|
448
|
}
|
449
|
|
450
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
451
|
|
452
|
public ObjectFaceShape getObjectFaceShape(int variant)
|
453
|
{
|
454
|
int[] numLayers = getNumLayers();
|
455
|
int numVariants = getNumCubitVariants(numLayers);
|
456
|
int numL = numLayers[0];
|
457
|
boolean small = numL<=3;
|
458
|
|
459
|
if( variant==0 && !small )
|
460
|
{
|
461
|
float h1 = isInIconMode() ? 0.001f : 0.04f;
|
462
|
float[][] bands = { {h1,34,0.3f,0.2f, 3, 0, 0}, {0.001f,34,0.0f,0.0f, 2, 0, 0} };
|
463
|
int[] indices = { 0,0,0,1,1,1};
|
464
|
return new ObjectFaceShape(bands,indices,null);
|
465
|
}
|
466
|
if( variant<numVariants-1 )
|
467
|
{
|
468
|
int E = small ? 1 : 0;
|
469
|
int N0 = small ? 4 : 3;
|
470
|
int N1 = small ? 3 : 2;
|
471
|
float h1 = isInIconMode() ? 0.001f : 0.04f;
|
472
|
|
473
|
float[][] bands = { {h1,34,0.2f,0.2f,N0,E,E}, {0.001f,34,0.0f,0.0f,N1,0,0} };
|
474
|
int[] indices = { 0,0,1,1,1,1};
|
475
|
|
476
|
return new ObjectFaceShape(bands,indices,null);
|
477
|
}
|
478
|
else
|
479
|
{
|
480
|
int N = small ? 4 : 3;
|
481
|
int E = small ? 1 : 0;
|
482
|
float h1 = isInIconMode() ? 0.001f : 0.04f;
|
483
|
float h2 = isInIconMode() ? 0.001f : 0.01f;
|
484
|
|
485
|
float[][] bands = { {h1,17,0.3f,0.2f,N,E,E},{h2,17,0.3f,0.2f,N,E,E} };
|
486
|
int[] indices = { 0,0,0,1,1,1};
|
487
|
|
488
|
return new ObjectFaceShape(bands,indices,null);
|
489
|
}
|
490
|
}
|
491
|
|
492
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
493
|
|
494
|
public ObjectVertexEffects getVertexEffects(int variant)
|
495
|
{
|
496
|
int[] numLayers = getNumLayers();
|
497
|
int numVariants = getNumCubitVariants(numLayers);
|
498
|
int numL = numLayers[0];
|
499
|
boolean small = numL<=3;
|
500
|
|
501
|
if( variant==0 && !small )
|
502
|
{
|
503
|
float A = (2*SQ3/3)*SIN54;
|
504
|
float B = 0.4f;
|
505
|
float[][] corners = { {0.06f,0.15f} };
|
506
|
int[] indices = { 0,-1,-1,-1,-1,-1,-1,-1 };
|
507
|
float[][] centers = { {0.0f, -(float)Math.sqrt(1-A*A)*B,-A*B} };
|
508
|
return FactoryCubit.generateVertexEffect(getVertices(variant),corners,indices,centers,indices);
|
509
|
}
|
510
|
if( variant<numVariants-1 )
|
511
|
{
|
512
|
int type = variant-1;
|
513
|
float tmpVal= numL/(numL-1.0f);
|
514
|
float height= tmpVal*COS18;
|
515
|
float width = tmpVal + (type/2)*tmpVal*SIN18;
|
516
|
float Z = height*COS_HALFD;
|
517
|
float[][] corners = { {0.02f,0.15f} };
|
518
|
int[] indices = { 0,-1,-1,-1, 0,-1,-1,-1 };
|
519
|
float[][] centers = { {0.0f, -width/2, -2*Z} };
|
520
|
return FactoryCubit.generateVertexEffect(getVertices(variant),corners,indices,centers,indices);
|
521
|
}
|
522
|
else
|
523
|
{
|
524
|
float A = (2*SQ3/3)*SIN54;
|
525
|
float B = 0.4f;
|
526
|
float[][] corners = { {0.10f,0.30f},{0.05f,0.15f} };
|
527
|
int[] cornerIndices = { 0, 1,-1, 1, 1,-1,-1,-1 };
|
528
|
float[][] centers = { {0.0f, -(float)Math.sqrt(1-A*A)*B,-A*B} };
|
529
|
int[] centerIndices = { 0, 0,-1, 0, 0,-1,-1,-1 };
|
530
|
return FactoryCubit.generateVertexEffect(getVertices(variant),corners,cornerIndices,centers,centerIndices);
|
531
|
}
|
532
|
}
|
533
|
|
534
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
535
|
|
536
|
public int getNumCubitVariants(int[] numLayers)
|
537
|
{
|
538
|
switch(numLayers[0])
|
539
|
{
|
540
|
case 3: return 1;
|
541
|
case 5: return 4;
|
542
|
}
|
543
|
|
544
|
return 1;
|
545
|
}
|
546
|
|
547
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
548
|
|
549
|
public int getCubitVariant(int cubit, int[] numLayers)
|
550
|
{
|
551
|
int numL = numLayers[0];
|
552
|
int numCubitsPerCorner = numCubitsPerCorner(numL);
|
553
|
|
554
|
if( cubit<NUM_CORNERS*numCubitsPerCorner ) return 0;
|
555
|
|
556
|
int numCubitsPerEdge = numCubitsPerEdge(numL);
|
557
|
|
558
|
if( cubit<NUM_CORNERS*numCubitsPerCorner + NUM_EDGES*numCubitsPerEdge )
|
559
|
{
|
560
|
int type = computeEdgeType(cubit,numCubitsPerCorner,numCubitsPerEdge);
|
561
|
return type+1;
|
562
|
}
|
563
|
|
564
|
return getNumCubitVariants(numLayers)-1;
|
565
|
}
|
566
|
|
567
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
568
|
|
569
|
public float getStickerRadius()
|
570
|
{
|
571
|
return 0.18f;
|
572
|
}
|
573
|
|
574
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
575
|
|
576
|
public float getStickerStroke()
|
577
|
{
|
578
|
float stroke = 0.25f;
|
579
|
|
580
|
if( isInIconMode() )
|
581
|
{
|
582
|
int[] numLayers = getNumLayers();
|
583
|
if( numLayers[0]>3 ) stroke*=1.5f;
|
584
|
}
|
585
|
|
586
|
return stroke;
|
587
|
}
|
588
|
|
589
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
590
|
|
591
|
public float[][] getStickerAngles()
|
592
|
{
|
593
|
return null;
|
594
|
}
|
595
|
|
596
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
597
|
|
598
|
public String getShortName()
|
599
|
{
|
600
|
switch(getNumLayers()[0])
|
601
|
{
|
602
|
case 3: return ObjectType.KILO_3.name();
|
603
|
case 5: return ObjectType.KILO_5.name();
|
604
|
}
|
605
|
|
606
|
return ObjectType.KILO_3.name();
|
607
|
}
|
608
|
|
609
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
610
|
|
611
|
public ObjectSignature getSignature()
|
612
|
{
|
613
|
switch(getNumLayers()[0])
|
614
|
{
|
615
|
case 3: return new ObjectSignature(ObjectSignatures.KILO_3);
|
616
|
case 5: return new ObjectSignature(ObjectSignatures.KILO_5);
|
617
|
}
|
618
|
|
619
|
return null;
|
620
|
}
|
621
|
|
622
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
623
|
|
624
|
public String getObjectName()
|
625
|
{
|
626
|
switch(getNumLayers()[0])
|
627
|
{
|
628
|
case 3: return "Kilominx";
|
629
|
case 5: return "Master Kilominx";
|
630
|
}
|
631
|
return null;
|
632
|
}
|
633
|
|
634
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
635
|
|
636
|
public String getInventor()
|
637
|
{
|
638
|
switch(getNumLayers()[0])
|
639
|
{
|
640
|
case 3: return "Thomas de Bruin";
|
641
|
case 5: return "David Gugl";
|
642
|
}
|
643
|
return "Thomas de Bruin";
|
644
|
}
|
645
|
|
646
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
647
|
|
648
|
public int getYearOfInvention()
|
649
|
{
|
650
|
switch(getNumLayers()[0])
|
651
|
{
|
652
|
case 3: return 2008;
|
653
|
case 5: return 2010;
|
654
|
}
|
655
|
return 2008;
|
656
|
}
|
657
|
|
658
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
659
|
|
660
|
public int getComplexity()
|
661
|
{
|
662
|
switch(getNumLayers()[0])
|
663
|
{
|
664
|
case 3: return 2;
|
665
|
case 5: return 3;
|
666
|
}
|
667
|
return 8;
|
668
|
}
|
669
|
|
670
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
671
|
|
672
|
public String[][] getTutorials()
|
673
|
{
|
674
|
int[] numLayers = getNumLayers();
|
675
|
|
676
|
switch(numLayers[0])
|
677
|
{
|
678
|
case 3: return new String[][] {
|
679
|
{"gb","grgGgUSxiQg","How to Solve the Kilominx","Z3"},
|
680
|
{"es","g6WMYjkCLok","Resolver Kilominx","Cuby"},
|
681
|
{"ru","gjaknjuZXPs","Киломинкс как собрать","CUBES WORLD"},
|
682
|
{"fr","F7z6LztN-7A","Résoudre le Kilominx","Twins Cuber"},
|
683
|
{"de","fcmJdpLfZwk","Megaminx 2x2 lösen","JamesKnopf"},
|
684
|
{"pl","tdWh8f8qpq4","Kilominx TUTORIAL PL","MrUK"},
|
685
|
{"kr","8-X4GhQnE5I","2X2 킬로밍크스 TUTORIAL","큐브놀이터"},
|
686
|
{"vn","eW7RLayPPmA","Tutorial N.11 - Kilominx","Duy Thích Rubik"},
|
687
|
};
|
688
|
case 5: return new String[][] {
|
689
|
{"gb","VAnzC2SYVc4","How To Solve A Master Kilominx","Grizz Media"},
|
690
|
{"es","ozINTg-61Fs","Tutorial Master Kilominx","RubikArt"},
|
691
|
{"ru","0aemQayCZRc","Как собрать Мастер Киломинкс ч.1","Артем Мартиросов"},
|
692
|
{"ru","ohOUFTx-oQI","Как собрать Мастер Киломинкс ч.2","Артем Мартиросов"},
|
693
|
{"ru","YRXRdT2jCn8","Как собрать Мастер Киломинкс ч.3","Артем Мартиросов"},
|
694
|
{"fr","usMiWt44aqo","Résolution du Master Kilominx","Asthalis"},
|
695
|
{"pl","rdln0IG86_s","Master Kilominx TUTORIAL PL","MrUK"},
|
696
|
{"br","0nmaZf2-44M","Como resolver o Master Kilominx 1/3","Rafael Cinoto"},
|
697
|
{"br","SkR6RybAKHc","Como resolver o Master Kilominx 2/3","Rafael Cinoto"},
|
698
|
{"br","5C7J7Cb4a7Q","Como resolver o Master Kilominx 3/3","Rafael Cinoto"},
|
699
|
{"kr","dvy-GxCjm5c","마스터 킬로밍크스 배우기 1","vincentcube"},
|
700
|
{"kr","Jm0B12vNxsE","마스터 킬로밍크스 배우기 2","vincentcube"},
|
701
|
{"kr","H1I18FVpr6g","마스터 킬로밍크스 배우기 3","vincentcube"},
|
702
|
};
|
703
|
}
|
704
|
return null;
|
705
|
}
|
706
|
}
|