1
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
2
|
// Copyright 2020 Leszek Koltunski //
|
3
|
// //
|
4
|
// This file is part of Magic Cube. //
|
5
|
// //
|
6
|
// Magic Cube is free software: you can redistribute it and/or modify //
|
7
|
// it under the terms of the GNU General Public License as published by //
|
8
|
// the Free Software Foundation, either version 2 of the License, or //
|
9
|
// (at your option) any later version. //
|
10
|
// //
|
11
|
// Magic Cube is distributed in the hope that it will be useful, //
|
12
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
|
13
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
|
14
|
// GNU General Public License for more details. //
|
15
|
// //
|
16
|
// You should have received a copy of the GNU General Public License //
|
17
|
// along with Magic Cube. If not, see <http://www.gnu.org/licenses/>. //
|
18
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
19
|
|
20
|
package org.distorted.objectlib.objects;
|
21
|
|
22
|
import static org.distorted.objectlib.touchcontrol.TouchControl.TC_HEXAHEDRON;
|
23
|
import static org.distorted.objectlib.touchcontrol.TouchControl.TYPE_SPLIT_EDGE;
|
24
|
|
25
|
import java.io.InputStream;
|
26
|
|
27
|
import org.distorted.library.type.Static3D;
|
28
|
import org.distorted.library.type.Static4D;
|
29
|
|
30
|
import org.distorted.objectlib.helpers.ObjectFaceShape;
|
31
|
import org.distorted.objectlib.helpers.ObjectSignature;
|
32
|
import org.distorted.objectlib.main.InitData;
|
33
|
import org.distorted.objectlib.touchcontrol.TouchControlHexahedron;
|
34
|
import org.distorted.objectlib.main.ObjectType;
|
35
|
import org.distorted.objectlib.helpers.ObjectShape;
|
36
|
import org.distorted.objectlib.scrambling.ScrambleState;
|
37
|
import org.distorted.objectlib.main.ShapeHexahedron;
|
38
|
|
39
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
40
|
|
41
|
public class TwistyHelicopter extends ShapeHexahedron
|
42
|
{
|
43
|
static final Static3D[] ROT_AXIS = new Static3D[]
|
44
|
{
|
45
|
new Static3D( 0, +SQ2/2, -SQ2/2),
|
46
|
new Static3D( 0, -SQ2/2, -SQ2/2),
|
47
|
new Static3D(+SQ2/2, 0, -SQ2/2),
|
48
|
new Static3D(-SQ2/2, 0, -SQ2/2),
|
49
|
new Static3D(+SQ2/2, -SQ2/2, 0),
|
50
|
new Static3D(-SQ2/2, -SQ2/2, 0)
|
51
|
};
|
52
|
|
53
|
private ScrambleState[] mStates;
|
54
|
private int[][] mBasicAngle;
|
55
|
private float[][] mCuts;
|
56
|
private float[][] mCenters;
|
57
|
private int[] mQuatIndices;
|
58
|
|
59
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
60
|
|
61
|
public TwistyHelicopter(InitData data, int meshState, int iconMode, Static4D quat, Static3D move, float scale, InputStream stream)
|
62
|
{
|
63
|
super(data, meshState, iconMode, data.getNumLayers()[0], quat, move, scale, stream);
|
64
|
}
|
65
|
|
66
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
67
|
|
68
|
public ScrambleState[] getScrambleStates()
|
69
|
{
|
70
|
if( mStates==null )
|
71
|
{
|
72
|
mStates = new ScrambleState[]
|
73
|
{
|
74
|
new ScrambleState( new int[][] { {0,1,1,2,1,2},{0,1,3,2,1,4},{0,1,5,2,1,6},{0,1,7,2,1,8},{0,1,9,2,1,10},{0,1,11,2,1,12} } ),
|
75
|
new ScrambleState( new int[][] { { },{ },{0,1,5 },{0,1,7 },{ 2,1,10},{ 2,1,12} } ),
|
76
|
new ScrambleState( new int[][] { { },{ },{ 2,1,6},{ 2,1,8},{0,1,9 },{0,1,11 } } ),
|
77
|
new ScrambleState( new int[][] { { },{ },{0,1,5 },{0,1,7 },{0,1,9 },{0,1,11 } } ),
|
78
|
new ScrambleState( new int[][] { { },{ },{ 2,1,6},{ 2,1,8},{ 2,1,10},{ 2,1,12} } ),
|
79
|
new ScrambleState( new int[][] { {0,1,1 },{0,1,3 },{ },{ },{0,1,9 },{ 2,1,12} } ),
|
80
|
new ScrambleState( new int[][] { { 2,1,2},{ 2,1,4},{ },{ },{ 2,1,10},{0,1,11 } } ),
|
81
|
new ScrambleState( new int[][] { {0,1,1 },{0,1,3 },{ },{ },{ 2,1,10},{0,1,11 } } ),
|
82
|
new ScrambleState( new int[][] { { 2,1,2},{ 2,1,4},{ },{ },{0,1,9 },{ 2,1,12} } ),
|
83
|
new ScrambleState( new int[][] { { 2,1,2},{0,1,3 },{0,1,5 },{ 2,1,8},{ },{ } } ),
|
84
|
new ScrambleState( new int[][] { {0,1,1 },{ 2,1,4},{ 2,1,6},{0,1,7 },{ },{ } } ),
|
85
|
new ScrambleState( new int[][] { { 2,1,2},{0,1,3 },{ 2,1,6},{0,1,7 },{ },{ } } ),
|
86
|
new ScrambleState( new int[][] { {0,1,1 },{ 2,1,4},{0,1,5 },{ 2,1,8},{ },{ } } ),
|
87
|
};
|
88
|
}
|
89
|
|
90
|
return mStates;
|
91
|
}
|
92
|
|
93
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
94
|
|
95
|
public float[][] getCuts(int[] numLayers)
|
96
|
{
|
97
|
if( mCuts==null )
|
98
|
{
|
99
|
float[] cut = new float[] { -3*SQ2/4, +3*SQ2/4 };
|
100
|
mCuts = new float[][] { cut,cut,cut,cut,cut,cut };
|
101
|
}
|
102
|
|
103
|
return mCuts;
|
104
|
}
|
105
|
|
106
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
107
|
|
108
|
public boolean[][] getLayerRotatable(int[] numLayers)
|
109
|
{
|
110
|
boolean[] tmp = new boolean[] {true,false,true};
|
111
|
return new boolean[][] { tmp,tmp,tmp,tmp,tmp,tmp };
|
112
|
}
|
113
|
|
114
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
115
|
|
116
|
public int getTouchControlType()
|
117
|
{
|
118
|
return TC_HEXAHEDRON;
|
119
|
}
|
120
|
|
121
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
122
|
|
123
|
public int getTouchControlSplit()
|
124
|
{
|
125
|
return TYPE_SPLIT_EDGE;
|
126
|
}
|
127
|
|
128
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
129
|
|
130
|
public int[][][] getEnabled()
|
131
|
{
|
132
|
return new int[][][]
|
133
|
{
|
134
|
{{2,5},{2,4},{3,4},{3,5}},
|
135
|
{{2,4},{2,5},{3,5},{3,4}},
|
136
|
{{0,5},{1,5},{1,4},{0,4}},
|
137
|
{{0,4},{1,4},{1,5},{0,5}},
|
138
|
{{1,3},{0,3},{0,2},{1,2}},
|
139
|
{{0,3},{1,3},{1,2},{0,2}},
|
140
|
};
|
141
|
}
|
142
|
|
143
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
144
|
|
145
|
public float[] getDist3D(int[] numLayers)
|
146
|
{
|
147
|
return TouchControlHexahedron.D3D;
|
148
|
}
|
149
|
|
150
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
151
|
|
152
|
public Static3D[] getFaceAxis()
|
153
|
{
|
154
|
return TouchControlHexahedron.FACE_AXIS;
|
155
|
}
|
156
|
|
157
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
158
|
|
159
|
public float[][] getCubitPositions(int[] numLayers)
|
160
|
{
|
161
|
if( mCenters==null )
|
162
|
{
|
163
|
float DIST_CORNER = 1.50f;
|
164
|
float DIST_CENTER = 1.50f;
|
165
|
float XY_CENTER = DIST_CORNER/3;
|
166
|
|
167
|
mCenters = new float[][]
|
168
|
{
|
169
|
{ DIST_CORNER, DIST_CORNER, DIST_CORNER },
|
170
|
{ DIST_CORNER, DIST_CORNER, -DIST_CORNER },
|
171
|
{ DIST_CORNER, -DIST_CORNER, DIST_CORNER },
|
172
|
{ DIST_CORNER, -DIST_CORNER, -DIST_CORNER },
|
173
|
{ -DIST_CORNER, DIST_CORNER, DIST_CORNER },
|
174
|
{ -DIST_CORNER, DIST_CORNER, -DIST_CORNER },
|
175
|
{ -DIST_CORNER, -DIST_CORNER, DIST_CORNER },
|
176
|
{ -DIST_CORNER, -DIST_CORNER, -DIST_CORNER },
|
177
|
|
178
|
{ -XY_CENTER , -XY_CENTER, DIST_CENTER },
|
179
|
{ -XY_CENTER , XY_CENTER, DIST_CENTER },
|
180
|
{ XY_CENTER , -XY_CENTER, DIST_CENTER },
|
181
|
{ XY_CENTER , XY_CENTER, DIST_CENTER },
|
182
|
{ -XY_CENTER , -XY_CENTER, -DIST_CENTER },
|
183
|
{ -XY_CENTER , XY_CENTER, -DIST_CENTER },
|
184
|
{ XY_CENTER , -XY_CENTER, -DIST_CENTER },
|
185
|
{ XY_CENTER , XY_CENTER, -DIST_CENTER },
|
186
|
|
187
|
{ -XY_CENTER , DIST_CENTER, -XY_CENTER },
|
188
|
{ -XY_CENTER , DIST_CENTER, XY_CENTER },
|
189
|
{ XY_CENTER , DIST_CENTER, -XY_CENTER },
|
190
|
{ XY_CENTER , DIST_CENTER, XY_CENTER },
|
191
|
{ -XY_CENTER , -DIST_CENTER, -XY_CENTER },
|
192
|
{ -XY_CENTER , -DIST_CENTER, XY_CENTER },
|
193
|
{ XY_CENTER , -DIST_CENTER, -XY_CENTER },
|
194
|
{ XY_CENTER , -DIST_CENTER, XY_CENTER },
|
195
|
|
196
|
{ DIST_CENTER, -XY_CENTER, -XY_CENTER },
|
197
|
{ DIST_CENTER, -XY_CENTER, XY_CENTER },
|
198
|
{ DIST_CENTER, XY_CENTER, -XY_CENTER },
|
199
|
{ DIST_CENTER, XY_CENTER, XY_CENTER },
|
200
|
{ -DIST_CENTER, -XY_CENTER, -XY_CENTER },
|
201
|
{ -DIST_CENTER, -XY_CENTER, XY_CENTER },
|
202
|
{ -DIST_CENTER, XY_CENTER, -XY_CENTER },
|
203
|
{ -DIST_CENTER, XY_CENTER, XY_CENTER },
|
204
|
};
|
205
|
}
|
206
|
|
207
|
return mCenters;
|
208
|
}
|
209
|
|
210
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
211
|
|
212
|
public Static4D getCubitQuats(int cubit, int[] numLayers)
|
213
|
{
|
214
|
if( mQuatIndices==null ) mQuatIndices = new int[] { 0,19,21, 7,18,16,17, 3,
|
215
|
|
216
|
0,21,20,17, 6, 7,16, 5,
|
217
|
10,22, 2,11,23,14,15, 1,
|
218
|
8,19, 4,12,18,13, 9, 3
|
219
|
};
|
220
|
return mObjectQuats[mQuatIndices[cubit]];
|
221
|
}
|
222
|
|
223
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
224
|
|
225
|
public ObjectShape getObjectShape(int variant)
|
226
|
{
|
227
|
if( variant==0 )
|
228
|
{
|
229
|
float[][] vertices =
|
230
|
{ {-1.50f, 0.00f, 0.00f},{ 0.00f,-1.50f, 0.00f},{ 0.00f, 0.00f,-1.50f},{-0.75f,-0.75f,-0.75f},{ 0.00f, 0.00f, 0.00f} };
|
231
|
int[][] indices = { {0,1,4},{2,0,4},{1,2,4},{3,1,0},{3,2,1},{3,0,2} };
|
232
|
return new ObjectShape(vertices, indices);
|
233
|
}
|
234
|
else
|
235
|
{
|
236
|
float[][] vertices =
|
237
|
{ { 0.50f, 0.50f, 0.00f }, {-1.00f, 0.50f, 0.00f }, { 0.50f,-1.00f, 0.00f }, {-0.25f,-0.25f,-0.75f } };
|
238
|
int[][] indices = { { 0,1,2 },{ 2,1,3 },{ 3,1,0 },{ 3,0,2 } };
|
239
|
return new ObjectShape(vertices, indices);
|
240
|
}
|
241
|
}
|
242
|
|
243
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
244
|
|
245
|
public ObjectFaceShape getObjectFaceShape(int variant)
|
246
|
{
|
247
|
float height = isInIconMode() ? 0.001f : 0.028f;
|
248
|
|
249
|
if( variant==0 )
|
250
|
{
|
251
|
float[][] bands = { {height,35,0.16f,0.7f,7,3,3}, {0.001f, 0,1.00f,0.0f,3,1,5} };
|
252
|
int[] bandIndices = { 0,0,0,1,1,1 };
|
253
|
float[][] corners = { {0.08f,0.20f} };
|
254
|
int[] cornerIndices = { 0,0,0,0,0 };
|
255
|
float[][] centers = { {-0.75f, -0.75f, -0.75f} };
|
256
|
int[] centerIndices = { 0,0,0,-1,0 };
|
257
|
return new ObjectFaceShape(bands,bandIndices,corners,cornerIndices,centers,centerIndices,null);
|
258
|
}
|
259
|
else
|
260
|
{
|
261
|
float[][] bands = { {height,35,0.16f,0.7f,7,3,3}, {0.001f, 0,1.00f,0.0f,3,1,3} };
|
262
|
int[] bandIndices = { 0,1,1,1 };
|
263
|
float[][] corners = { {0.06f,0.20f} };
|
264
|
int[] cornerIndices = { 0,0,0,-1 };
|
265
|
float[][] centers = { {-0.25f, -0.25f, -0.75f} };
|
266
|
int[] centerIndices = { 0,0,0,-1 };
|
267
|
return new ObjectFaceShape(bands,bandIndices,corners,cornerIndices,centers,centerIndices,null);
|
268
|
}
|
269
|
}
|
270
|
|
271
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
272
|
|
273
|
public int getNumCubitVariants(int[] numLayers)
|
274
|
{
|
275
|
return 2;
|
276
|
}
|
277
|
|
278
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
279
|
|
280
|
public int getCubitVariant(int cubit, int[] numLayers)
|
281
|
{
|
282
|
return cubit<8 ? 0:1;
|
283
|
}
|
284
|
|
285
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
286
|
|
287
|
public float getStickerRadius()
|
288
|
{
|
289
|
return 0.08f;
|
290
|
}
|
291
|
|
292
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
293
|
|
294
|
public float getStickerStroke()
|
295
|
{
|
296
|
return isInIconMode() ? 0.20f : 0.10f;
|
297
|
}
|
298
|
|
299
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
300
|
|
301
|
public float[][] getStickerAngles()
|
302
|
{
|
303
|
return null;
|
304
|
}
|
305
|
|
306
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
307
|
// PUBLIC API
|
308
|
|
309
|
public Static3D[] getRotationAxis()
|
310
|
{
|
311
|
return ROT_AXIS;
|
312
|
}
|
313
|
|
314
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
315
|
|
316
|
public int[][] getBasicAngles()
|
317
|
{
|
318
|
if( mBasicAngle ==null )
|
319
|
{
|
320
|
int num = getNumLayers()[0];
|
321
|
int[] tmp = new int[num];
|
322
|
for(int i=0; i<num; i++) tmp[i] = 2;
|
323
|
mBasicAngle = new int[][] { tmp,tmp,tmp,tmp,tmp,tmp };
|
324
|
}
|
325
|
return mBasicAngle;
|
326
|
}
|
327
|
|
328
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
329
|
|
330
|
public String getShortName()
|
331
|
{
|
332
|
return ObjectType.HELI_3.name();
|
333
|
}
|
334
|
|
335
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
336
|
|
337
|
public ObjectSignature getSignature()
|
338
|
{
|
339
|
return new ObjectSignature(ObjectType.HELI_3);
|
340
|
}
|
341
|
|
342
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
343
|
|
344
|
public String getObjectName()
|
345
|
{
|
346
|
return "Helicopter Cube";
|
347
|
}
|
348
|
|
349
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
350
|
|
351
|
public String getInventor()
|
352
|
{
|
353
|
return "Adam G. Cowan";
|
354
|
}
|
355
|
|
356
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
357
|
|
358
|
public int getYearOfInvention()
|
359
|
{
|
360
|
return 2006;
|
361
|
}
|
362
|
|
363
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
364
|
|
365
|
public int getComplexity()
|
366
|
{
|
367
|
return 3;
|
368
|
}
|
369
|
|
370
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
371
|
|
372
|
public String[][] getTutorials()
|
373
|
{
|
374
|
return new String[][]{
|
375
|
{"gb","-suwJpd_PO8","Helicopter Cube Tutorial","Bearded Cubing"},
|
376
|
{"es","DWG9n_YyGPA","Resolver Helicopter Cube","Cuby"},
|
377
|
{"ru","V4lJ3pg7Hio","Как собрать Куб Вертолет","Алексей Ярыгин"},
|
378
|
{"fr","Zk8zWBWD2Ow","Comment résoudre le Helicopter Cube","Julien"},
|
379
|
{"de","6VUH_FkBTlw","Helicopter Cube Tutorial","GerCubing"},
|
380
|
{"pl","zoBZame4gFo","Helicopter Cube TUTORIAL PL","MrUk"},
|
381
|
{"br","k8PVOARh6Kk","Como resolver o Helicopter Cube 1/3","Rafael Cinoto"},
|
382
|
{"br","6d4JLfuIwOQ","Como resolver o Helicopter Cube 2/3","Rafael Cinoto"},
|
383
|
{"br","moiV-2oWgrA","Como resolver o Helicopter Cube 3/3","Rafael Cinoto"},
|
384
|
{"kr","xsXQSrEbgag","헬리콥터 큐브를 맞추는 법","연서큐브박"},
|
385
|
{"vn","Ff6-IHhQHGY","Tutorial N.89 - Helicopter","Duy Thích Rubik"},
|
386
|
};
|
387
|
}
|
388
|
}
|