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 java.io.InputStream;
|
13
|
|
14
|
import org.distorted.library.type.Static3D;
|
15
|
import org.distorted.library.type.Static4D;
|
16
|
import org.distorted.objectlib.helpers.FactoryCubit;
|
17
|
import org.distorted.objectlib.helpers.ObjectFaceShape;
|
18
|
import org.distorted.objectlib.helpers.ObjectShape;
|
19
|
import org.distorted.objectlib.helpers.ObjectSignature;
|
20
|
import org.distorted.objectlib.helpers.ObjectVertexEffects;
|
21
|
import org.distorted.objectlib.main.InitData;
|
22
|
import org.distorted.objectlib.main.ObjectSignatures;
|
23
|
import org.distorted.objectlib.main.ObjectType;
|
24
|
|
25
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
26
|
|
27
|
public class TwistyMixup3x3Plus extends TwistyMixup
|
28
|
{
|
29
|
private static final float SHORT_EDGE = (6*SQ2-3)/14;
|
30
|
private static final float LONG_EDGE = (12-3*SQ2)/14;
|
31
|
|
32
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
33
|
|
34
|
public TwistyMixup3x3Plus(InitData data, int meshState, int iconMode, Static4D quat, Static3D move, float scale, InputStream stream)
|
35
|
{
|
36
|
super(data, meshState, iconMode, quat, move, scale, stream);
|
37
|
}
|
38
|
|
39
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
40
|
|
41
|
public float[][] getCuts(int[] numLayers)
|
42
|
{
|
43
|
if( mCuts==null )
|
44
|
{
|
45
|
float[] cut = new float[] {-SHORT_EDGE,+SHORT_EDGE};
|
46
|
mCuts = new float[][] { cut,cut,cut };
|
47
|
}
|
48
|
|
49
|
return mCuts;
|
50
|
}
|
51
|
|
52
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
53
|
|
54
|
public float[][] getCubitPositions(int[] numLayers)
|
55
|
{
|
56
|
if( mPosition==null )
|
57
|
{
|
58
|
final float DIST_CORNER = LONG_EDGE+SHORT_EDGE;
|
59
|
final float DIST_EDGE = 1.5f*LONG_EDGE+SHORT_EDGE;
|
60
|
final float DIST_CENTER = LONG_EDGE+SHORT_EDGE;
|
61
|
final float DIST_SMALL = 2.0f*LONG_EDGE+SHORT_EDGE;
|
62
|
final float DIST = 0.5f*LONG_EDGE+SHORT_EDGE;
|
63
|
|
64
|
mPosition = new float[][]
|
65
|
{
|
66
|
{ DIST_CORNER, DIST_CORNER, DIST_CORNER },
|
67
|
{ DIST_CORNER, DIST_CORNER,-DIST_CORNER },
|
68
|
{ DIST_CORNER,-DIST_CORNER, DIST_CORNER },
|
69
|
{ DIST_CORNER,-DIST_CORNER,-DIST_CORNER },
|
70
|
{-DIST_CORNER, DIST_CORNER, DIST_CORNER },
|
71
|
{-DIST_CORNER, DIST_CORNER,-DIST_CORNER },
|
72
|
{-DIST_CORNER,-DIST_CORNER, DIST_CORNER },
|
73
|
{-DIST_CORNER,-DIST_CORNER,-DIST_CORNER },
|
74
|
|
75
|
{ 0.0f, DIST_EDGE, DIST_EDGE },
|
76
|
{ DIST_EDGE, 0.0f, DIST_EDGE },
|
77
|
{ 0.0f,-DIST_EDGE, DIST_EDGE },
|
78
|
{-DIST_EDGE, 0.0f, DIST_EDGE },
|
79
|
{ DIST_EDGE, DIST_EDGE, 0.0f },
|
80
|
{ DIST_EDGE,-DIST_EDGE, 0.0f },
|
81
|
{-DIST_EDGE,-DIST_EDGE, 0.0f },
|
82
|
{-DIST_EDGE, DIST_EDGE, 0.0f },
|
83
|
{ 0.0f, DIST_EDGE,-DIST_EDGE },
|
84
|
{ DIST_EDGE, 0.0f,-DIST_EDGE },
|
85
|
{ 0.0f,-DIST_EDGE,-DIST_EDGE },
|
86
|
{-DIST_EDGE, 0.0f,-DIST_EDGE },
|
87
|
|
88
|
{ 0, DIST, DIST_SMALL },
|
89
|
{ DIST, 0, DIST_SMALL },
|
90
|
{ 0, -DIST, DIST_SMALL },
|
91
|
{ -DIST, 0, DIST_SMALL },
|
92
|
{ 0, DIST, -DIST_SMALL },
|
93
|
{ DIST, 0, -DIST_SMALL },
|
94
|
{ 0, -DIST, -DIST_SMALL },
|
95
|
{ -DIST, 0, -DIST_SMALL },
|
96
|
{ 0, DIST_SMALL, -DIST },
|
97
|
{ DIST, DIST_SMALL, 0 },
|
98
|
{ 0, DIST_SMALL, DIST },
|
99
|
{ -DIST, DIST_SMALL, 0 },
|
100
|
{ 0, -DIST_SMALL, -DIST },
|
101
|
{ DIST, -DIST_SMALL, 0 },
|
102
|
{ 0, -DIST_SMALL, DIST },
|
103
|
{ -DIST, -DIST_SMALL, 0 },
|
104
|
{ DIST_SMALL, DIST, 0 },
|
105
|
{ DIST_SMALL, 0, -DIST },
|
106
|
{ DIST_SMALL, -DIST, 0 },
|
107
|
{ DIST_SMALL, 0, DIST },
|
108
|
{ -DIST_SMALL, DIST, 0 },
|
109
|
{ -DIST_SMALL, 0, -DIST },
|
110
|
{ -DIST_SMALL, -DIST, 0 },
|
111
|
{ -DIST_SMALL, 0, DIST },
|
112
|
|
113
|
{ 0, 0, DIST_CENTER },
|
114
|
{ 0, 0,-DIST_CENTER },
|
115
|
{ 0, DIST_CENTER, 0 },
|
116
|
{ 0,-DIST_CENTER, 0 },
|
117
|
{ DIST_CENTER, 0, 0 },
|
118
|
{-DIST_CENTER, 0, 0 },
|
119
|
};
|
120
|
}
|
121
|
|
122
|
return mPosition;
|
123
|
}
|
124
|
|
125
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
126
|
|
127
|
public Static4D getCubitQuats(int cubit, int[] numLayers)
|
128
|
{
|
129
|
if( mQuatIndex==null )
|
130
|
{
|
131
|
mQuatIndex = new int[] { 0,10,11,3,6,2,1,8,
|
132
|
0,4,11,5,7,12,13,6,10,20,3,18,
|
133
|
0,4,0,4, 3,15,3,15, 10,16,10,16, 11,19,11,19, 7,17,7,17, 6,18,6,18,
|
134
|
0,3,10,11,7,6 };
|
135
|
}
|
136
|
|
137
|
return mObjectQuats[mQuatIndex[cubit]];
|
138
|
}
|
139
|
|
140
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
141
|
|
142
|
private float[][] getVertices(int variant)
|
143
|
{
|
144
|
if( variant==0 || variant==3 )
|
145
|
{
|
146
|
float X = variant==0 ? LONG_EDGE : SHORT_EDGE;
|
147
|
float Y = variant==0 ? LONG_EDGE : SHORT_EDGE;
|
148
|
float Z = LONG_EDGE;
|
149
|
|
150
|
return new float[][]
|
151
|
{
|
152
|
{ -X,-Y,-Z },
|
153
|
{ -X,-Y,+Z },
|
154
|
{ -X,+Y,-Z },
|
155
|
{ -X,+Y,+Z },
|
156
|
{ +X,-Y,-Z },
|
157
|
{ +X,-Y,+Z },
|
158
|
{ +X,+Y,-Z },
|
159
|
{ +X,+Y,+Z },
|
160
|
};
|
161
|
}
|
162
|
else if( variant==1 )
|
163
|
{
|
164
|
float X = SHORT_EDGE;
|
165
|
float Y = LONG_EDGE/2;
|
166
|
float Z = LONG_EDGE/2;
|
167
|
|
168
|
return new float[][]
|
169
|
{
|
170
|
{ -X,+Y,+Z },
|
171
|
{ -X,+Y,-Z },
|
172
|
{ +X,+Y,-Z },
|
173
|
{ +X,+Y,+Z },
|
174
|
{ -X,-Y,+Z },
|
175
|
{ +X,-Y,+Z },
|
176
|
{ -X,-Y,-3*Z },
|
177
|
{ +X,-Y,-3*Z },
|
178
|
{ +X,-3*Y,-Z },
|
179
|
{ -X,-3*Y,-Z },
|
180
|
};
|
181
|
}
|
182
|
else
|
183
|
{
|
184
|
float X = SHORT_EDGE;
|
185
|
float Y = LONG_EDGE/2;
|
186
|
|
187
|
return new float[][]
|
188
|
{
|
189
|
{ -X,-Y, 0 },
|
190
|
{ -X,+Y, 0 },
|
191
|
{ +X,-Y, 0 },
|
192
|
{ +X,+Y, 0 },
|
193
|
{ -X, 0,-Y },
|
194
|
{ +X, 0,-Y }
|
195
|
};
|
196
|
}
|
197
|
}
|
198
|
|
199
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
200
|
|
201
|
public ObjectShape getObjectShape(int variant)
|
202
|
{
|
203
|
if( variant==0 || variant==3 )
|
204
|
{
|
205
|
int[][] indices =
|
206
|
{
|
207
|
{1,5,7,3},
|
208
|
{3,7,6,2},
|
209
|
{5,4,6,7},
|
210
|
{0,1,3,2},
|
211
|
{4,0,2,6},
|
212
|
{0,4,5,1}
|
213
|
};
|
214
|
|
215
|
return new ObjectShape(getVertices(variant), indices);
|
216
|
}
|
217
|
else if( variant==1 )
|
218
|
{
|
219
|
int[][] indices =
|
220
|
{
|
221
|
{0,3,2,1},
|
222
|
{4,5,3,0},
|
223
|
{8,7,2,3,5},
|
224
|
{6,9,4,0,1},
|
225
|
{9,8,5,4},
|
226
|
{7,6,1,2},
|
227
|
{6,7,8,9}
|
228
|
};
|
229
|
|
230
|
return new ObjectShape(getVertices(variant), indices);
|
231
|
}
|
232
|
else
|
233
|
{
|
234
|
int[][] indices =
|
235
|
{
|
236
|
{0,2,3,1},
|
237
|
{2,5,3},
|
238
|
{1,4,0},
|
239
|
{0,4,5,2},
|
240
|
{3,5,4,1}
|
241
|
};
|
242
|
|
243
|
return new ObjectShape(getVertices(variant), indices);
|
244
|
}
|
245
|
}
|
246
|
|
247
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
248
|
|
249
|
public ObjectFaceShape getObjectFaceShape(int variant)
|
250
|
{
|
251
|
float h1 = isInIconMode() ? 0.001f : 0.06f;
|
252
|
float h2 = 0.001f;
|
253
|
float[][] bands = { {h1,45,0.3f,0.5f,5,1,0}, {h2,45,0.3f,0.5f,5,1,0} };
|
254
|
|
255
|
if( variant==0 )
|
256
|
{
|
257
|
int[] bandIndices = { 0,0,0,1,1,1 };
|
258
|
return new ObjectFaceShape(bands,bandIndices,null);
|
259
|
}
|
260
|
if( variant==1 )
|
261
|
{
|
262
|
int[] bandIndices = { 0,0,1,1,1,1,1 };
|
263
|
return new ObjectFaceShape(bands,bandIndices,null);
|
264
|
}
|
265
|
if( variant==2 )
|
266
|
{
|
267
|
int[] bandIndices = { 0,1,1,1,1 };
|
268
|
return new ObjectFaceShape(bands,bandIndices,null);
|
269
|
}
|
270
|
else
|
271
|
{
|
272
|
int[] bandIndices = { 0,1,1,1,1,1 };
|
273
|
return new ObjectFaceShape(bands,bandIndices,null);
|
274
|
}
|
275
|
}
|
276
|
|
277
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
278
|
|
279
|
public ObjectVertexEffects getVertexEffects(int variant)
|
280
|
{
|
281
|
float[][] centers = { { 0.0f, 0.0f, 0.0f} };
|
282
|
float[][] corners = { {0.04f,0.10f} };
|
283
|
|
284
|
if( variant==0 )
|
285
|
{
|
286
|
int[] indices = { -1,0,0,0,0,0,0,0 };
|
287
|
return FactoryCubit.generateVertexEffect(getVertices(variant),corners,indices,centers,indices);
|
288
|
}
|
289
|
if( variant==1 )
|
290
|
{
|
291
|
int[] indices = { 0,0,0,0,0,0,-1,-1,-1,-1 };
|
292
|
return FactoryCubit.generateVertexEffect(getVertices(variant),corners,indices,centers,indices);
|
293
|
}
|
294
|
if( variant==2 )
|
295
|
{
|
296
|
int[] indices = { 0,0,0,0,-1,-1 };
|
297
|
return FactoryCubit.generateVertexEffect(getVertices(variant),corners,indices,centers,indices);
|
298
|
}
|
299
|
else
|
300
|
{
|
301
|
int[] indices = { -1,0,-1,0,-1,0,-1,0 };
|
302
|
return FactoryCubit.generateVertexEffect(getVertices(variant),corners,indices,centers,indices);
|
303
|
}
|
304
|
}
|
305
|
|
306
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
307
|
|
308
|
public int getNumCubitVariants(int[] numLayers)
|
309
|
{
|
310
|
return 4;
|
311
|
}
|
312
|
|
313
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
314
|
|
315
|
public int getCubitVariant(int cubit, int[] numLayers)
|
316
|
{
|
317
|
return cubit<8 ? 0 : (cubit<20 ? 1 : (cubit<44?2:3));
|
318
|
}
|
319
|
|
320
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
321
|
// PUBLIC API
|
322
|
|
323
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
324
|
|
325
|
public String getShortName()
|
326
|
{
|
327
|
return ObjectType.MIXP_3.name();
|
328
|
}
|
329
|
|
330
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
331
|
|
332
|
public ObjectSignature getSignature()
|
333
|
{
|
334
|
return new ObjectSignature(ObjectSignatures.MIXP_3);
|
335
|
}
|
336
|
|
337
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
338
|
|
339
|
public String getObjectName()
|
340
|
{
|
341
|
return "Mixup Plus Cube";
|
342
|
}
|
343
|
|
344
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
345
|
|
346
|
public String getInventor()
|
347
|
{
|
348
|
return "Guan Yang";
|
349
|
}
|
350
|
|
351
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
352
|
|
353
|
public int getYearOfInvention()
|
354
|
{
|
355
|
return 2012;
|
356
|
}
|
357
|
|
358
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
359
|
|
360
|
public int getComplexity()
|
361
|
{
|
362
|
return 3;
|
363
|
}
|
364
|
|
365
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
366
|
|
367
|
public String[][] getTutorials()
|
368
|
{
|
369
|
return new String[][]{
|
370
|
{"gb","0ABxlmD6AYQ","3x3 Mixup Plus Tutorial","Superantoniovivaldi"},
|
371
|
{"es","s19NAGbkbw4","Tutorial Mixup Plus 3x3x3","Kubekings"},
|
372
|
{"fr","QWsFaw0zUJU","Résolution du Mixup Plus","skieur cubb"},
|
373
|
{"ru","cdtK86ZeF2w","Как собрать Mixup plus 1/3","Иван Циков"},
|
374
|
{"ru","OHg0MfM2iEU","Как собрать Mixup plus 2/3","Иван Циков"},
|
375
|
{"ru","rtQoRAoMRS8","Как собрать Mixup plus 3/3","Иван Циков"},
|
376
|
{"pl","8Bm0LNsGfIs","Mixup 3x3x3 Plus TUTORIAL PL","MrUK"},
|
377
|
{"kr","80QKOZXGtBs","믹스업 플러스 (Mix-up Plus) 해법","듀나메스 큐브 해법연구소"},
|
378
|
{"vn","vuIfGk1Asmc","Tutorial N.206 - Mixup Plus","Duy Thích Rubik"},
|
379
|
};
|
380
|
}
|
381
|
}
|