1
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
2
|
// Copyright 2022 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 org.distorted.library.type.Static3D;
|
23
|
import org.distorted.library.type.Static4D;
|
24
|
import org.distorted.objectlib.helpers.ObjectFaceShape;
|
25
|
import org.distorted.objectlib.helpers.ObjectShape;
|
26
|
import org.distorted.objectlib.scrambling.ScrambleState;
|
27
|
import org.distorted.objectlib.main.ObjectControl;
|
28
|
import org.distorted.objectlib.main.ObjectType;
|
29
|
import org.distorted.objectlib.main.ShapeTetrahedron;
|
30
|
import org.distorted.objectlib.touchcontrol.TouchControlTetrahedron;
|
31
|
|
32
|
import java.io.InputStream;
|
33
|
|
34
|
import static org.distorted.objectlib.touchcontrol.TouchControl.TC_CHANGING_SHAPEMOD;
|
35
|
import static org.distorted.objectlib.touchcontrol.TouchControl.TYPE_NOT_SPLIT;
|
36
|
|
37
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
38
|
|
39
|
public class TwistyMorphix extends ShapeTetrahedron
|
40
|
{
|
41
|
static final Static3D[] ROT_AXIS = new Static3D[]
|
42
|
{
|
43
|
new Static3D( SQ2/2, 0.0f, SQ2/2),
|
44
|
new Static3D( 0.0f, 1.0f, 0.0f),
|
45
|
new Static3D( SQ2/2, 0.0f,-SQ2/2),
|
46
|
};
|
47
|
|
48
|
private ScrambleState[] mStates;
|
49
|
private int[] mBasicAngle;
|
50
|
private float[][] mCuts;
|
51
|
private float[][] mCenters;
|
52
|
private int[] mQuatIndex;
|
53
|
|
54
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
55
|
|
56
|
public TwistyMorphix(int[] numL, int meshState, Static4D quat, Static3D move, float scale, InputStream stream)
|
57
|
{
|
58
|
super(numL, meshState, numL[0], quat, move, scale, stream);
|
59
|
}
|
60
|
|
61
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
62
|
// same as in a 2x2
|
63
|
|
64
|
public ScrambleState[] getScrambleStates()
|
65
|
{
|
66
|
if( mStates==null )
|
67
|
{
|
68
|
int[] tmp = { 0,-1,0,0,1,0,0,2,0, 1,-1,0,1,1,0,1,2,0 };
|
69
|
|
70
|
mStates = new ScrambleState[]
|
71
|
{
|
72
|
new ScrambleState( new int[][] { tmp,tmp,tmp } )
|
73
|
};
|
74
|
}
|
75
|
|
76
|
return mStates;
|
77
|
}
|
78
|
|
79
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
80
|
|
81
|
public float[][] getCuts(int[] numLayers)
|
82
|
{
|
83
|
if( mCuts==null )
|
84
|
{
|
85
|
float[] cut = new float[] {0};
|
86
|
mCuts = new float[][] { cut,cut,cut };
|
87
|
}
|
88
|
|
89
|
return mCuts;
|
90
|
}
|
91
|
|
92
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
93
|
|
94
|
public boolean[][] getLayerRotatable(int[] numLayers)
|
95
|
{
|
96
|
boolean[] tmp = new boolean[] {true,true};
|
97
|
return new boolean[][] { tmp,tmp,tmp };
|
98
|
}
|
99
|
|
100
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
101
|
|
102
|
public int getTouchControlType()
|
103
|
{
|
104
|
return TC_CHANGING_SHAPEMOD;
|
105
|
}
|
106
|
|
107
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
108
|
|
109
|
public int getTouchControlSplit()
|
110
|
{
|
111
|
return TYPE_NOT_SPLIT;
|
112
|
}
|
113
|
|
114
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
115
|
|
116
|
public int[][][] getEnabled()
|
117
|
{
|
118
|
return null;
|
119
|
}
|
120
|
|
121
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
122
|
|
123
|
public float[] getDist3D(int[] numLayers)
|
124
|
{
|
125
|
return TouchControlTetrahedron.D3D;
|
126
|
}
|
127
|
|
128
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
129
|
|
130
|
public Static3D[] getFaceAxis()
|
131
|
{
|
132
|
return TouchControlTetrahedron.FACE_AXIS;
|
133
|
}
|
134
|
|
135
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
136
|
|
137
|
public float[][] getCubitPositions(int[] numLayers)
|
138
|
{
|
139
|
if( mCenters==null )
|
140
|
{
|
141
|
final float A = SQ2/6;
|
142
|
final float B = 1.0f/3;
|
143
|
|
144
|
mCenters = new float[][]
|
145
|
{
|
146
|
{0.0f, -A, +B},
|
147
|
{0.0f, -A, -B},
|
148
|
{ +B, A, 0.0f},
|
149
|
{ -B, A, 0.0f},
|
150
|
{0.0f, A, +B},
|
151
|
{0.0f, A, -B},
|
152
|
{ +B, -A, 0.0f},
|
153
|
{ -B, -A, 0.0f}
|
154
|
};
|
155
|
}
|
156
|
|
157
|
return mCenters;
|
158
|
}
|
159
|
|
160
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
161
|
|
162
|
public Static4D getCubitQuats(int cubit, int[] numLayers)
|
163
|
{
|
164
|
int I=5; int J=2; int K=8;
|
165
|
if( mQuatIndex==null ) mQuatIndex = new int[] { 0,I,J,K,0,I,J,K };
|
166
|
return mObjectQuats[mQuatIndex[cubit]];
|
167
|
}
|
168
|
|
169
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
170
|
|
171
|
public ObjectShape getObjectShape(int variant)
|
172
|
{
|
173
|
if( variant==0 )
|
174
|
{
|
175
|
final float Y = SQ2/2;
|
176
|
final float Z = 1.0f;
|
177
|
|
178
|
float[][] vertices =
|
179
|
{
|
180
|
{0.0f,-2*Y/3, 2*Z/3 },
|
181
|
{0.0f,-2*Y/3, -Z/3 },
|
182
|
{ Z/2, Y/3, Z/6 },
|
183
|
{-Z/2, Y/3, Z/6 },
|
184
|
{0.0f, Y/3, -Z/3 }
|
185
|
};
|
186
|
|
187
|
int[][] indices = { {0,2,3},{0,1,2},{0,3,1},{4,2,1},{4,1,3},{4,3,2} };
|
188
|
|
189
|
return new ObjectShape(vertices, indices);
|
190
|
}
|
191
|
else
|
192
|
{
|
193
|
final float X = 1.0f;
|
194
|
final float Y = SQ2/2;
|
195
|
final float Z = 0.5f;
|
196
|
|
197
|
float[][] vertices =
|
198
|
{
|
199
|
{-X/2, -Y/3, Z/3 },
|
200
|
{ X/2, -Y/3, Z/3 },
|
201
|
{0.0f, 2*Y/3,-2*Z/3 },
|
202
|
{0.0f, -Y/3,-2*Z/3 }
|
203
|
};
|
204
|
|
205
|
int[][] indices = { {1,2,0},{3,1,0},{1,3,2},{3,0,2} };
|
206
|
|
207
|
return new ObjectShape(vertices, indices);
|
208
|
}
|
209
|
}
|
210
|
|
211
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
212
|
|
213
|
public ObjectFaceShape getObjectFaceShape(int variant)
|
214
|
{
|
215
|
if( variant==0 )
|
216
|
{
|
217
|
float[][] bands = { {0.03f,30,0.15f,0.5f,5,1,2}, {0.001f,30,0.2f,0.4f,5,1,2} };
|
218
|
int[] bandIndices = { 0,0,0,1,1,1 };
|
219
|
float[][] corners = { {0.08f,0.13f} };
|
220
|
int[] indices = { 0,0,0,0,-1 };
|
221
|
float[][] centers = { { 0.0f,0.0f,0.0f } };
|
222
|
return new ObjectFaceShape(bands,bandIndices,corners,indices,centers,indices,null);
|
223
|
}
|
224
|
else
|
225
|
{
|
226
|
final float Y = SQ2/2;
|
227
|
final float Z = 0.5f;
|
228
|
float[][] bands = { {0.03f,30,0.15f,0.5f,5,1,1}, {0.001f,30,0.25f,0.5f,5,1,1} };
|
229
|
int[] bandIndices = { 0,1,1,1 };
|
230
|
float[][] corners = { {0.08f,0.13f} };
|
231
|
int[] indices = { 0,0,0,-1 };
|
232
|
float[][] centers = { { 0.0f,-Y/3,-2*Z/3 } };
|
233
|
return new ObjectFaceShape(bands,bandIndices,corners,indices,centers,indices,null);
|
234
|
}
|
235
|
}
|
236
|
|
237
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
238
|
|
239
|
public int getNumCubitVariants(int[] numLayers)
|
240
|
{
|
241
|
return 2;
|
242
|
}
|
243
|
|
244
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
245
|
|
246
|
public int getCubitVariant(int cubit, int[] numLayers)
|
247
|
{
|
248
|
return cubit<4 ? 0 : 1;
|
249
|
}
|
250
|
|
251
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
252
|
|
253
|
public float getStickerRadius()
|
254
|
{
|
255
|
return 0.10f;
|
256
|
}
|
257
|
|
258
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
259
|
|
260
|
public float getStickerStroke()
|
261
|
{
|
262
|
return ObjectControl.isInIconMode() ? 0.12f : 0.07f;
|
263
|
}
|
264
|
|
265
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
266
|
|
267
|
public float[][] getStickerAngles()
|
268
|
{
|
269
|
return null;
|
270
|
}
|
271
|
|
272
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
273
|
// PUBLIC API
|
274
|
|
275
|
public Static3D[] getRotationAxis()
|
276
|
{
|
277
|
return ROT_AXIS;
|
278
|
}
|
279
|
|
280
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
281
|
|
282
|
public int[] getBasicAngles()
|
283
|
{
|
284
|
if( mBasicAngle ==null ) mBasicAngle = new int[] { 4,4,4 };
|
285
|
return mBasicAngle;
|
286
|
}
|
287
|
|
288
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
289
|
|
290
|
public String getShortName()
|
291
|
{
|
292
|
return ObjectType.MORP_2.name();
|
293
|
}
|
294
|
|
295
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
296
|
|
297
|
public long getSignature()
|
298
|
{
|
299
|
return ObjectType.MORP_2.ordinal();
|
300
|
}
|
301
|
|
302
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
303
|
|
304
|
public String getObjectName()
|
305
|
{
|
306
|
return "Pyramorphix";
|
307
|
}
|
308
|
|
309
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
310
|
|
311
|
public String getInventor()
|
312
|
{
|
313
|
return "Manfred Fritsche";
|
314
|
}
|
315
|
|
316
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
317
|
|
318
|
public int getYearOfInvention()
|
319
|
{
|
320
|
return 0;
|
321
|
}
|
322
|
|
323
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
324
|
|
325
|
public int getComplexity()
|
326
|
{
|
327
|
return 1;
|
328
|
}
|
329
|
|
330
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
331
|
|
332
|
public String[][] getTutorials()
|
333
|
{
|
334
|
return new String[][] {
|
335
|
{"gb","dD67B3cRaFw","Pyramorphix Solve Tutorial","SpeedCubeReview"},
|
336
|
{"es","RA37LhYlEW8","Resolver Pyramorphix","Cuby"},
|
337
|
{"ru","fTNXLAAuGAI","Как собрать Пираморфикс 2х2","Алексей Ярыгин"},
|
338
|
{"fr","SfEqoud5KRc","Résolution du Pyramorphix","Asthalis"},
|
339
|
{"de","1VDGoVJZCug","Pyramorphix - Tutorial","GerCubing"},
|
340
|
{"pl","b7VpuXloBNU","Mastermorphix 2x2 TUTORIAL PL","MrUK"},
|
341
|
{"br","wByfDxTrbC8","Como resolver o Pyramorphix","Rafael Cinoto"},
|
342
|
{"kr","WIy5ZvTXsOY","피라몰픽스 쉽게 맞추기","큐브놀이터"},
|
343
|
{"vn","6CuTRLjKHho","Tutorial N.14 - Pyramorphix","Duy Thích Rubik"},
|
344
|
};
|
345
|
}
|
346
|
}
|