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