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.TouchControl.TC_HEXAHEDRON;
|
13
|
import static org.distorted.objectlib.touchcontrol.TouchControl.TYPE_SPLIT_CORNER;
|
14
|
|
15
|
import org.distorted.library.type.Static3D;
|
16
|
import org.distorted.library.type.Static4D;
|
17
|
import org.distorted.objectlib.helpers.FactoryCubit;
|
18
|
import org.distorted.objectlib.helpers.ObjectFaceShape;
|
19
|
import org.distorted.objectlib.helpers.ObjectShape;
|
20
|
import org.distorted.objectlib.signature.ObjectSignature;
|
21
|
import org.distorted.objectlib.helpers.ObjectVertexEffects;
|
22
|
import org.distorted.objectlib.main.InitAssets;
|
23
|
import org.distorted.objectlib.main.InitData;
|
24
|
import org.distorted.objectlib.signature.ObjectConstants;
|
25
|
import org.distorted.objectlib.main.ObjectType;
|
26
|
import org.distorted.objectlib.scrambling.ScrambleEdgeGenerator;
|
27
|
import org.distorted.objectlib.shape.ShapeHexahedron;
|
28
|
import org.distorted.objectlib.touchcontrol.TouchControlHexahedron;
|
29
|
|
30
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
31
|
|
32
|
public class TwistyDinoSkewb extends ShapeHexahedron
|
33
|
{
|
34
|
static final Static3D[] ROT_AXIS = new Static3D[]
|
35
|
{
|
36
|
new Static3D( SQ3/3, SQ3/3, SQ3/3),
|
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
|
};
|
41
|
|
42
|
private int[][] mEdges;
|
43
|
private int[][] mBasicAngle;
|
44
|
private float[][] mCuts;
|
45
|
private float[][] mPositions;
|
46
|
private int[] mQuatIndex;
|
47
|
private boolean[][] mRotatable;
|
48
|
|
49
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
50
|
|
51
|
public TwistyDinoSkewb(int iconMode, Static4D quat, Static3D move, float scale, InitData data, InitAssets asset)
|
52
|
{
|
53
|
super(iconMode, data.getNumLayers()[0], quat, move, scale, data, asset);
|
54
|
}
|
55
|
|
56
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
57
|
|
58
|
@Override
|
59
|
public float[][] returnRotationFactor()
|
60
|
{
|
61
|
int numL = getNumLayers()[0];
|
62
|
float[] f = new float[numL];
|
63
|
for(int i=0; i<numL; i++) f[i] = 1.7f;
|
64
|
return new float[][] { f,f,f,f };
|
65
|
}
|
66
|
|
67
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
68
|
|
69
|
public int[][] getScrambleEdges()
|
70
|
{
|
71
|
if( mEdges==null )
|
72
|
{
|
73
|
mEdges = new int[][]
|
74
|
{
|
75
|
{ 0,0,1,0, 2,1,3,1, 4,1,5,1, 6,0,7,0, 8,1,9,1, 10,0,11,0, 12,0,13,0, 14,1,15,1 },
|
76
|
{ 0,0,1,0, 6,0,7,0, 10,0,11,0, 12,0,13,0 },
|
77
|
};
|
78
|
}
|
79
|
return mEdges;
|
80
|
}
|
81
|
|
82
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
83
|
|
84
|
@Override
|
85
|
public int[][] getScrambleAlgorithms()
|
86
|
{
|
87
|
if( mRotatable==null ) mRotatable = createRotatable();
|
88
|
return ScrambleEdgeGenerator.getScramblingAlgorithms(mBasicAngle, mRotatable);
|
89
|
}
|
90
|
|
91
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
92
|
|
93
|
public float[][] getCuts(int[] numLayers)
|
94
|
{
|
95
|
if( mCuts==null )
|
96
|
{
|
97
|
final float s = SQ3/6;
|
98
|
final float d = SQ3/2;
|
99
|
|
100
|
float[] c0 = new float[] {-s, d};
|
101
|
float[] c1 = new float[] {-d, s};
|
102
|
mCuts = new float[][] {c0,c1,c1,c0};
|
103
|
}
|
104
|
|
105
|
return mCuts;
|
106
|
}
|
107
|
|
108
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
109
|
|
110
|
private boolean[][] createRotatable()
|
111
|
{
|
112
|
boolean[] tmp = new boolean[] {true,false,true};
|
113
|
return new boolean[][] { tmp,tmp,tmp,tmp };
|
114
|
}
|
115
|
|
116
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
117
|
|
118
|
public boolean[][] getLayerRotatable(int[] numLayers)
|
119
|
{
|
120
|
if( mRotatable==null ) mRotatable = createRotatable();
|
121
|
return mRotatable;
|
122
|
}
|
123
|
|
124
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
125
|
|
126
|
public int getTouchControlType()
|
127
|
{
|
128
|
return TC_HEXAHEDRON;
|
129
|
}
|
130
|
|
131
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
132
|
|
133
|
public int getTouchControlSplit()
|
134
|
{
|
135
|
return TYPE_SPLIT_CORNER;
|
136
|
}
|
137
|
|
138
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
139
|
|
140
|
public int[][][] getEnabled()
|
141
|
{
|
142
|
return new int[][][]
|
143
|
{
|
144
|
{{0,1},{3,1},{2,3},{0,2}},
|
145
|
{{2,3},{3,1},{0,1},{0,2}},
|
146
|
{{1,2},{0,1},{0,3},{2,3}},
|
147
|
{{1,2},{2,3},{0,3},{0,1}},
|
148
|
{{0,3},{0,2},{1,2},{1,3}},
|
149
|
{{1,2},{0,2},{0,3},{1,3}},
|
150
|
};
|
151
|
}
|
152
|
|
153
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
154
|
|
155
|
public float[] getDist3D(int[] numLayers)
|
156
|
{
|
157
|
return TouchControlHexahedron.D3D;
|
158
|
}
|
159
|
|
160
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
161
|
|
162
|
public Static3D[] getFaceAxis()
|
163
|
{
|
164
|
return TouchControlHexahedron.FACE_AXIS;
|
165
|
}
|
166
|
|
167
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
168
|
|
169
|
public float[][] getCubitPositions(int[] numLayers)
|
170
|
{
|
171
|
if( mPositions==null )
|
172
|
{
|
173
|
final float A = 1.5f;
|
174
|
final float B = 0.5f;
|
175
|
|
176
|
mPositions = new float[][]
|
177
|
{
|
178
|
{ A, A, A },
|
179
|
{-A, A,-A },
|
180
|
{-A,-A, A },
|
181
|
{ A,-A,-A },
|
182
|
|
183
|
{ B, B, A },
|
184
|
{-B,-B, A },
|
185
|
{-B, B,-A },
|
186
|
{ B,-B,-A },
|
187
|
{ A, B, B },
|
188
|
{ A,-B,-B },
|
189
|
{-A,-B, B },
|
190
|
{-A, B,-B },
|
191
|
{ B, A, B },
|
192
|
{-B, A,-B },
|
193
|
{-B,-A, B },
|
194
|
{ B,-A,-B },
|
195
|
|
196
|
{-B, A, A },
|
197
|
{-A, A, B },
|
198
|
{-A, B, A },
|
199
|
{ B,-A, A },
|
200
|
{ A,-A, B },
|
201
|
{ A,-B, A },
|
202
|
{ B, A,-A },
|
203
|
{ A, A,-B },
|
204
|
{ A, B,-A },
|
205
|
{-B,-A,-A },
|
206
|
{-A,-A,-B },
|
207
|
{-A,-B,-A },
|
208
|
};
|
209
|
}
|
210
|
|
211
|
return mPositions;
|
212
|
}
|
213
|
|
214
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
215
|
|
216
|
public Static4D getCubitQuats(int cubit, int[] numLayers)
|
217
|
{
|
218
|
if( mQuatIndex==null )
|
219
|
{
|
220
|
mQuatIndex = new int[] { 0,3,6,4,
|
221
|
0,0, 9,9, 2,2, 3,3, 1,1, 4,4,
|
222
|
0,7,8, 10,4,2, 11,1,5, 9,6,3,
|
223
|
};
|
224
|
}
|
225
|
|
226
|
return mObjectQuats[mQuatIndex[cubit]];
|
227
|
}
|
228
|
|
229
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
230
|
|
231
|
private float[][] getVertices(int variant)
|
232
|
{
|
233
|
if( variant==0 )
|
234
|
{
|
235
|
return new float[][] { {-1,0,0},{0,-1,0},{0,0,-1},{-1,-1,-1},{0,0,0} };
|
236
|
}
|
237
|
else if( variant==1 )
|
238
|
{
|
239
|
return new float[][] { {-1,0,0},{0,-1,0},{1,0,0},{0,1,0},{0,0,-1} };
|
240
|
}
|
241
|
else
|
242
|
{
|
243
|
return new float[][] { {-1,0,0},{1,0,0},{0,-1,0},{0,0,-1} };
|
244
|
}
|
245
|
}
|
246
|
|
247
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
248
|
|
249
|
public ObjectShape getObjectShape(int variant)
|
250
|
{
|
251
|
if( variant==0 )
|
252
|
{
|
253
|
int[][] indices = { {0,1,4},{2,0,4},{1,2,4},{3,1,0},{3,2,1},{3,0,2} };
|
254
|
return new ObjectShape(getVertices(variant), indices);
|
255
|
}
|
256
|
else if( variant==1 )
|
257
|
{
|
258
|
int[][] indices = { {0,1,2,3},{4,1,0},{4,2,1},{4,3,2},{4,0,3} };
|
259
|
return new ObjectShape(getVertices(variant), indices);
|
260
|
}
|
261
|
else
|
262
|
{
|
263
|
int[][] indices = { {2,1,0},{3,0,1},{2,3,1},{3,2,0} };
|
264
|
return new ObjectShape(getVertices(variant), indices);
|
265
|
}
|
266
|
}
|
267
|
|
268
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
269
|
|
270
|
public ObjectFaceShape getObjectFaceShape(int variant)
|
271
|
{
|
272
|
int numL = getNumLayers()[0];
|
273
|
|
274
|
if( variant==0 )
|
275
|
{
|
276
|
int N = numL==2 ? 7:5;
|
277
|
int E1= numL==2 ? 3:2;
|
278
|
int E2= numL==2 ? 5:3;
|
279
|
float height = isInIconMode() ? 0.001f : 0.02f;
|
280
|
float[][] bands = { {height,35,0.16f,0.7f,N,E1,E1}, {0.001f, 35,1.00f,0.0f,3,1,E2} };
|
281
|
int[] indices = { 0,0,0,1,1,1 };
|
282
|
return new ObjectFaceShape(bands,indices,null);
|
283
|
}
|
284
|
else if( variant==1 )
|
285
|
{
|
286
|
int N = numL==2 ? 6:5;
|
287
|
int E = numL==2 ? 2:1;
|
288
|
float height = isInIconMode() ? 0.001f : 0.04f;
|
289
|
float[][] bands = { {height,35,SQ2/8,0.9f,N,E,E}, {0.001f,35,1,0.0f,3,0,0} };
|
290
|
int[] indices = { 0,1,1,1,1 };
|
291
|
return new ObjectFaceShape(bands,indices,null);
|
292
|
}
|
293
|
else
|
294
|
{
|
295
|
int N = numL==2 ? 6:5;
|
296
|
int E = numL==2 ? 3:2;
|
297
|
float h1 = isInIconMode() ? 0.001f : 0.035f;
|
298
|
float h2 = isInIconMode() ? 0.001f : 0.020f;
|
299
|
float[][] bands = { {h1,30,0.16f,0.8f,N,2,E}, {h2,45,0.16f,0.2f,3,1,2} };
|
300
|
int[] indices = { 0,0,1,1 };
|
301
|
return new ObjectFaceShape(bands,indices,null);
|
302
|
}
|
303
|
}
|
304
|
|
305
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
306
|
|
307
|
public ObjectVertexEffects getVertexEffects(int variant)
|
308
|
{
|
309
|
if( variant==0 )
|
310
|
{
|
311
|
float[][] corners = { {0.05f,0.25f}, {0.05f,0.20f} };
|
312
|
int[] cornerIndices = { 1,1,1,0,0 };
|
313
|
float[][] centers = { {-0.5f, -0.5f, -0.5f} };
|
314
|
int[] centerIndices = { 0,0,0,-1,0 };
|
315
|
return FactoryCubit.generateVertexEffect(getVertices(variant),corners,cornerIndices,centers,centerIndices);
|
316
|
}
|
317
|
else if( variant==1 )
|
318
|
{
|
319
|
float[][] corners = { {0.03f,0.15f} };
|
320
|
int[] cornerIndices = { 0,0,0,0,0 };
|
321
|
float[][] centers = { {0,0,-0.4f} };
|
322
|
int[] centerIndices = { 0,0,0,0,-1 };
|
323
|
return FactoryCubit.generateVertexEffect(getVertices(variant),corners,cornerIndices,centers,centerIndices);
|
324
|
}
|
325
|
else
|
326
|
{
|
327
|
float[][] corners = { {0.04f,0.20f}, {0.02f,0.30f} };
|
328
|
int[] cornerIndices = { 0,0,1,1 };
|
329
|
float[][] centers = { {0.0f, -0.5f, -0.5f} };
|
330
|
int[] centerIndices = { 0,0,0,0 };
|
331
|
return FactoryCubit.generateVertexEffect(getVertices(variant),corners,cornerIndices,centers,centerIndices);
|
332
|
}
|
333
|
}
|
334
|
|
335
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
336
|
|
337
|
public int getNumCubitVariants(int[] numLayers)
|
338
|
{
|
339
|
return 3;
|
340
|
}
|
341
|
|
342
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
343
|
|
344
|
public int getCubitVariant(int cubit, int[] numLayers)
|
345
|
{
|
346
|
return cubit<4 ? 0 : (cubit<16 ? 1:2);
|
347
|
}
|
348
|
|
349
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
350
|
|
351
|
public float getStickerRadius()
|
352
|
{
|
353
|
return 0.10f;
|
354
|
}
|
355
|
|
356
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
357
|
|
358
|
public float getStickerStroke()
|
359
|
{
|
360
|
return isInIconMode() ? 0.18f : 0.10f;
|
361
|
}
|
362
|
|
363
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
364
|
|
365
|
public float[][][] getStickerAngles()
|
366
|
{
|
367
|
return null;
|
368
|
}
|
369
|
|
370
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
371
|
// PUBLIC API
|
372
|
|
373
|
public Static3D[] getRotationAxis()
|
374
|
{
|
375
|
return ROT_AXIS;
|
376
|
}
|
377
|
|
378
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
379
|
|
380
|
public int[][] getBasicAngles()
|
381
|
{
|
382
|
if( mBasicAngle ==null )
|
383
|
{
|
384
|
int[] tmp = new int[] {3,3,3};
|
385
|
mBasicAngle = new int[][] { tmp,tmp,tmp,tmp };
|
386
|
}
|
387
|
|
388
|
return mBasicAngle;
|
389
|
}
|
390
|
|
391
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
392
|
|
393
|
public String getShortName()
|
394
|
{
|
395
|
return ObjectType.DSKE_3.name();
|
396
|
}
|
397
|
|
398
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
399
|
|
400
|
public ObjectSignature getSignature()
|
401
|
{
|
402
|
return new ObjectSignature(ObjectConstants.DSKE_3);
|
403
|
}
|
404
|
|
405
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
406
|
|
407
|
public String getObjectName()
|
408
|
{
|
409
|
return "Dino Skewb";
|
410
|
}
|
411
|
|
412
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
413
|
|
414
|
public String getInventor()
|
415
|
{
|
416
|
return "Timur Evbatyrov";
|
417
|
}
|
418
|
|
419
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
420
|
|
421
|
public int getYearOfInvention()
|
422
|
{
|
423
|
return 2010;
|
424
|
}
|
425
|
|
426
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
427
|
|
428
|
public int getComplexity()
|
429
|
{
|
430
|
return 3;
|
431
|
}
|
432
|
|
433
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
434
|
|
435
|
public String[][] getTutorials()
|
436
|
{
|
437
|
return new String[][] {
|
438
|
{"gb","NoYdr3eley0","Tutorial: Dino Skewb","PeteTheGeek196"},
|
439
|
{"gb","FYHdSpeMdqA","F-Skewb Solve","Superantoniovivaldi"},
|
440
|
{"es","R6deZc7wGaY","Tutorial Dino Skewb","QBAndo"},
|
441
|
{"ru","8nxHDHXypRE","Как собрать F-skewb (1/2)","Илья Топор-Гилка"},
|
442
|
{"ru","_nhpnjPGric","Как собрать F-skewb (2/2)","Илья Топор-Гилка"},
|
443
|
{"pl","yWGAF8qndww","Dino Skewb Tutorial PL","MrUK"},
|
444
|
{"br","_N5Vx29YEt4","Como resolver o Dino Skewb (1/3)","Rafael Cinoto"},
|
445
|
{"br","aVhl4vAB15w","Como resolver o Dino Skewb (2/3)","Rafael Cinoto"},
|
446
|
{"br","5nKwAkxu2Pg","Como resolver o Dino Skewb (3/3)","Rafael Cinoto"},
|
447
|
{"vn","STg0nMd18cQ","Dino F-Skewb tutorial","VĂN CÔNG TÙNG"},
|
448
|
{"tw","EoQFcqRGVdw","四階斜轉方塊 教學","不正常魔術方塊研究中心"},
|
449
|
};
|
450
|
}
|
451
|
}
|