1 |
29b82486
|
Leszek Koltunski
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
2 |
|
|
// Copyright 2020 Leszek Koltunski //
|
3 |
|
|
// //
|
4 |
|
|
// This file is part of Magic Cube. //
|
5 |
|
|
// //
|
6 |
6133be67
|
Leszek Koltunski
|
// 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 |
29b82486
|
Leszek Koltunski
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
9 |
|
|
|
10 |
|
|
package org.distorted.objectlib.objects;
|
11 |
|
|
|
12 |
c9c71c3f
|
Leszek Koltunski
|
import static org.distorted.objectlib.touchcontrol.TouchControl.TC_OCTAHEDRON;
|
13 |
|
|
import static org.distorted.objectlib.touchcontrol.TouchControl.TYPE_NOT_SPLIT;
|
14 |
29b82486
|
Leszek Koltunski
|
|
15 |
82eb152a
|
Leszek Koltunski
|
import java.io.InputStream;
|
16 |
29b82486
|
Leszek Koltunski
|
|
17 |
|
|
import org.distorted.library.type.Static3D;
|
18 |
|
|
import org.distorted.library.type.Static4D;
|
19 |
|
|
|
20 |
84a17011
|
Leszek Koltunski
|
import org.distorted.objectlib.helpers.FactoryCubit;
|
21 |
3ee1d662
|
Leszek Koltunski
|
import org.distorted.objectlib.helpers.ObjectFaceShape;
|
22 |
1d581993
|
Leszek Koltunski
|
import org.distorted.objectlib.helpers.ObjectSignature;
|
23 |
84a17011
|
Leszek Koltunski
|
import org.distorted.objectlib.helpers.ObjectVertexEffects;
|
24 |
9ba7f3f6
|
Leszek Koltunski
|
import org.distorted.objectlib.scrambling.ScrambleEdgeGenerator;
|
25 |
a8295031
|
Leszek Koltunski
|
import org.distorted.objectlib.main.InitData;
|
26 |
c9c71c3f
|
Leszek Koltunski
|
import org.distorted.objectlib.touchcontrol.TouchControlOctahedron;
|
27 |
8005e762
|
Leszek Koltunski
|
import org.distorted.objectlib.main.ObjectType;
|
28 |
198c5bf0
|
Leszek Koltunski
|
import org.distorted.objectlib.helpers.ObjectShape;
|
29 |
b31249d6
|
Leszek Koltunski
|
import org.distorted.objectlib.shape.ShapeOctahedron;
|
30 |
29b82486
|
Leszek Koltunski
|
|
31 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
32 |
|
|
|
33 |
386af988
|
Leszek Koltunski
|
public class TwistyDiamond extends ShapeOctahedron
|
34 |
29b82486
|
Leszek Koltunski
|
{
|
35 |
|
|
// the four rotation axis of a Diamond. Must be normalized.
|
36 |
|
|
static final Static3D[] ROT_AXIS = new Static3D[]
|
37 |
|
|
{
|
38 |
84a17011
|
Leszek Koltunski
|
new Static3D( SQ6/3, SQ3/3, 0),
|
39 |
|
|
new Static3D(-SQ6/3, SQ3/3, 0),
|
40 |
29b82486
|
Leszek Koltunski
|
new Static3D( 0,-SQ3/3,-SQ6/3),
|
41 |
84a17011
|
Leszek Koltunski
|
new Static3D( 0,-SQ3/3, SQ6/3)
|
42 |
29b82486
|
Leszek Koltunski
|
};
|
43 |
|
|
|
44 |
9ba7f3f6
|
Leszek Koltunski
|
private int[][] mEdges;
|
45 |
beee90ab
|
Leszek Koltunski
|
private int[][] mBasicAngle;
|
46 |
29b82486
|
Leszek Koltunski
|
private float[][] mCuts;
|
47 |
|
|
private int[] mTetraToFaceMap;
|
48 |
35ae98f0
|
Leszek Koltunski
|
private float[][] mPosition;
|
49 |
29b82486
|
Leszek Koltunski
|
|
50 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
51 |
|
|
|
52 |
a8295031
|
Leszek Koltunski
|
public TwistyDiamond(InitData data, int meshState, int iconMode, Static4D quat, Static3D move, float scale, InputStream stream)
|
53 |
29b82486
|
Leszek Koltunski
|
{
|
54 |
a8295031
|
Leszek Koltunski
|
super(data, meshState, iconMode, data.getNumLayers()[0], quat, move, scale, stream);
|
55 |
29b82486
|
Leszek Koltunski
|
}
|
56 |
|
|
|
57 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
58 |
|
|
|
59 |
9ba7f3f6
|
Leszek Koltunski
|
public int[][] getScrambleEdges()
|
60 |
29b82486
|
Leszek Koltunski
|
{
|
61 |
9ba7f3f6
|
Leszek Koltunski
|
if( mEdges==null ) mEdges = ScrambleEdgeGenerator.getScrambleEdgesSingle(mBasicAngle);
|
62 |
|
|
return mEdges;
|
63 |
29b82486
|
Leszek Koltunski
|
}
|
64 |
|
|
|
65 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
66 |
|
|
|
67 |
7bbfc84f
|
Leszek Koltunski
|
public float[][] getCuts(int[] numLayers)
|
68 |
29b82486
|
Leszek Koltunski
|
{
|
69 |
a57e6870
|
Leszek Koltunski
|
int numL = numLayers[0];
|
70 |
|
|
if( numL<2 ) return null;
|
71 |
29b82486
|
Leszek Koltunski
|
|
72 |
|
|
if( mCuts==null )
|
73 |
|
|
{
|
74 |
a57e6870
|
Leszek Koltunski
|
mCuts = new float[4][numL-1];
|
75 |
|
|
float cut = (SQ6/6)*(2-numL);
|
76 |
29b82486
|
Leszek Koltunski
|
|
77 |
a57e6870
|
Leszek Koltunski
|
for(int i=0; i<numL-1; i++)
|
78 |
29b82486
|
Leszek Koltunski
|
{
|
79 |
|
|
mCuts[0][i] = cut;
|
80 |
|
|
mCuts[1][i] = cut;
|
81 |
|
|
mCuts[2][i] = cut;
|
82 |
|
|
mCuts[3][i] = cut;
|
83 |
|
|
cut += SQ6/3;
|
84 |
|
|
}
|
85 |
|
|
}
|
86 |
|
|
|
87 |
|
|
return mCuts;
|
88 |
|
|
}
|
89 |
|
|
|
90 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
91 |
|
|
|
92 |
59c20632
|
Leszek Koltunski
|
public boolean[][] getLayerRotatable(int[] numLayers)
|
93 |
29b82486
|
Leszek Koltunski
|
{
|
94 |
59c20632
|
Leszek Koltunski
|
int numAxis = ROT_AXIS.length;
|
95 |
|
|
boolean[][] layerRotatable = new boolean[numAxis][];
|
96 |
a57e6870
|
Leszek Koltunski
|
|
97 |
59c20632
|
Leszek Koltunski
|
for(int i=0; i<numAxis; i++)
|
98 |
|
|
{
|
99 |
|
|
layerRotatable[i] = new boolean[numLayers[i]];
|
100 |
|
|
for(int j=0; j<numLayers[i]; j++) layerRotatable[i][j] = true;
|
101 |
29b82486
|
Leszek Koltunski
|
}
|
102 |
59c20632
|
Leszek Koltunski
|
|
103 |
|
|
return layerRotatable;
|
104 |
|
|
}
|
105 |
|
|
|
106 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
107 |
|
|
|
108 |
11fa413d
|
Leszek Koltunski
|
public int getTouchControlType()
|
109 |
59c20632
|
Leszek Koltunski
|
{
|
110 |
c9c71c3f
|
Leszek Koltunski
|
return TC_OCTAHEDRON;
|
111 |
59c20632
|
Leszek Koltunski
|
}
|
112 |
|
|
|
113 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
114 |
|
|
|
115 |
11fa413d
|
Leszek Koltunski
|
public int getTouchControlSplit()
|
116 |
59c20632
|
Leszek Koltunski
|
{
|
117 |
|
|
return TYPE_NOT_SPLIT;
|
118 |
|
|
}
|
119 |
|
|
|
120 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
121 |
|
|
|
122 |
|
|
public int[][][] getEnabled()
|
123 |
|
|
{
|
124 |
|
|
return new int[][][]
|
125 |
|
|
{
|
126 |
|
|
{{1,2,3}},{{1,2,3}},{{0,2,3}},{{0,2,3}},{{0,1,3}},{{0,1,3}},{{0,1,2}},{{0,1,2}}
|
127 |
|
|
};
|
128 |
|
|
}
|
129 |
|
|
|
130 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
131 |
|
|
|
132 |
|
|
public float[] getDist3D(int[] numLayers)
|
133 |
|
|
{
|
134 |
4c9ca251
|
Leszek Koltunski
|
return TouchControlOctahedron.D3D;
|
135 |
|
|
}
|
136 |
|
|
|
137 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
138 |
|
|
|
139 |
|
|
public Static3D[] getFaceAxis()
|
140 |
|
|
{
|
141 |
|
|
return TouchControlOctahedron.FACE_AXIS;
|
142 |
29b82486
|
Leszek Koltunski
|
}
|
143 |
|
|
|
144 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
145 |
|
|
|
146 |
|
|
private int getNumOctahedrons(int layers)
|
147 |
|
|
{
|
148 |
|
|
return layers==1 ? 1 : 4*(layers-1)*(layers-1) + 2;
|
149 |
|
|
}
|
150 |
|
|
|
151 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
152 |
|
|
|
153 |
|
|
private int getNumTetrahedrons(int layers)
|
154 |
|
|
{
|
155 |
|
|
return 4*layers*(layers-1);
|
156 |
|
|
}
|
157 |
|
|
|
158 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
159 |
|
|
|
160 |
|
|
private int createOctaPositions(float[][] centers, int index, int layers, float height)
|
161 |
|
|
{
|
162 |
|
|
float x = (layers-1)*0.5f;
|
163 |
|
|
float z = (layers+1)*0.5f;
|
164 |
|
|
|
165 |
|
|
for(int i=0; i<layers; i++, index++)
|
166 |
|
|
{
|
167 |
|
|
z -= 1;
|
168 |
|
|
centers[index][0] = x;
|
169 |
|
|
centers[index][1] = height;
|
170 |
|
|
centers[index][2] = z;
|
171 |
|
|
}
|
172 |
|
|
|
173 |
|
|
for(int i=0; i<layers-1; i++, index++)
|
174 |
|
|
{
|
175 |
|
|
x -= 1;
|
176 |
|
|
centers[index][0] = x;
|
177 |
|
|
centers[index][1] = height;
|
178 |
|
|
centers[index][2] = z;
|
179 |
|
|
}
|
180 |
|
|
|
181 |
|
|
for(int i=0; i<layers-1; i++, index++)
|
182 |
|
|
{
|
183 |
|
|
z += 1;
|
184 |
|
|
centers[index][0] = x;
|
185 |
|
|
centers[index][1] = height;
|
186 |
|
|
centers[index][2] = z;
|
187 |
|
|
}
|
188 |
|
|
|
189 |
|
|
for(int i=0; i<layers-2; i++, index++)
|
190 |
|
|
{
|
191 |
|
|
x += 1;
|
192 |
|
|
centers[index][0] = x;
|
193 |
|
|
centers[index][1] = height;
|
194 |
|
|
centers[index][2] = z;
|
195 |
|
|
}
|
196 |
|
|
|
197 |
|
|
return index;
|
198 |
|
|
}
|
199 |
|
|
|
200 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
201 |
|
|
|
202 |
|
|
private int createTetraPositions(float[][] centers, int index, int layers, float height)
|
203 |
|
|
{
|
204 |
|
|
float x = (layers-1)*0.5f;
|
205 |
|
|
float z = layers*0.5f;
|
206 |
|
|
|
207 |
|
|
for(int i=0; i<layers-1; i++, index++)
|
208 |
|
|
{
|
209 |
|
|
z -= 1;
|
210 |
|
|
centers[index][0] = x;
|
211 |
|
|
centers[index][1] = height;
|
212 |
|
|
centers[index][2] = z;
|
213 |
|
|
}
|
214 |
|
|
|
215 |
|
|
x += 0.5f;
|
216 |
|
|
z -= 0.5f;
|
217 |
|
|
|
218 |
|
|
for(int i=0; i<layers-1; i++, index++)
|
219 |
|
|
{
|
220 |
|
|
x -= 1;
|
221 |
|
|
centers[index][0] = x;
|
222 |
|
|
centers[index][1] = height;
|
223 |
|
|
centers[index][2] = z;
|
224 |
|
|
}
|
225 |
|
|
|
226 |
|
|
x -= 0.5f;
|
227 |
|
|
z -= 0.5f;
|
228 |
|
|
|
229 |
|
|
for(int i=0; i<layers-1; i++, index++)
|
230 |
|
|
{
|
231 |
|
|
z += 1;
|
232 |
|
|
centers[index][0] = x;
|
233 |
|
|
centers[index][1] = height;
|
234 |
|
|
centers[index][2] = z;
|
235 |
|
|
}
|
236 |
|
|
|
237 |
|
|
x -= 0.5f;
|
238 |
|
|
z += 0.5f;
|
239 |
|
|
|
240 |
|
|
for(int i=0; i<layers-1; i++, index++)
|
241 |
|
|
{
|
242 |
|
|
x += 1;
|
243 |
|
|
centers[index][0] = x;
|
244 |
|
|
centers[index][1] = height;
|
245 |
|
|
centers[index][2] = z;
|
246 |
|
|
}
|
247 |
|
|
|
248 |
|
|
return index;
|
249 |
|
|
}
|
250 |
|
|
|
251 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
252 |
|
|
|
253 |
7b832206
|
Leszek Koltunski
|
public float[][] getCubitPositions(int[] numLayers)
|
254 |
29b82486
|
Leszek Koltunski
|
{
|
255 |
35ae98f0
|
Leszek Koltunski
|
if( mPosition==null )
|
256 |
|
|
{
|
257 |
|
|
int layers = numLayers[0];
|
258 |
|
|
int numO = getNumOctahedrons(layers);
|
259 |
|
|
int numT = getNumTetrahedrons(layers);
|
260 |
|
|
int index = 0;
|
261 |
|
|
float height = 0.0f;
|
262 |
29b82486
|
Leszek Koltunski
|
|
263 |
35ae98f0
|
Leszek Koltunski
|
mPosition = new float[numO+numT][3];
|
264 |
29b82486
|
Leszek Koltunski
|
|
265 |
35ae98f0
|
Leszek Koltunski
|
index = createOctaPositions(mPosition,index,layers,height);
|
266 |
29b82486
|
Leszek Koltunski
|
|
267 |
35ae98f0
|
Leszek Koltunski
|
for(int i=layers-1; i>0; i--)
|
268 |
|
|
{
|
269 |
|
|
height += SQ2/2;
|
270 |
|
|
index = createOctaPositions(mPosition,index,i,+height);
|
271 |
|
|
index = createOctaPositions(mPosition,index,i,-height);
|
272 |
|
|
}
|
273 |
29b82486
|
Leszek Koltunski
|
|
274 |
35ae98f0
|
Leszek Koltunski
|
height = SQ2/4;
|
275 |
29b82486
|
Leszek Koltunski
|
|
276 |
35ae98f0
|
Leszek Koltunski
|
for(int i=layers; i>1; i--)
|
277 |
|
|
{
|
278 |
|
|
index = createTetraPositions(mPosition,index,i,+height);
|
279 |
|
|
index = createTetraPositions(mPosition,index,i,-height);
|
280 |
|
|
height += SQ2/2;
|
281 |
|
|
}
|
282 |
29b82486
|
Leszek Koltunski
|
}
|
283 |
|
|
|
284 |
35ae98f0
|
Leszek Koltunski
|
return mPosition;
|
285 |
29b82486
|
Leszek Koltunski
|
}
|
286 |
|
|
|
287 |
d0e6cf7f
|
Leszek Koltunski
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
288 |
|
|
|
289 |
|
|
public Static4D getCubitQuats(int cubit, int[] numLayers)
|
290 |
|
|
{
|
291 |
|
|
int numL = numLayers[0];
|
292 |
|
|
int numO = getNumOctahedrons(numL);
|
293 |
|
|
|
294 |
802fe251
|
Leszek Koltunski
|
if( cubit<numO ) return mObjectQuats[0];
|
295 |
d0e6cf7f
|
Leszek Koltunski
|
|
296 |
|
|
switch( retFaceTetraBelongsTo(cubit-numO, numL) )
|
297 |
|
|
{
|
298 |
802fe251
|
Leszek Koltunski
|
case 0: return mObjectQuats[0]; // unit quat
|
299 |
d0e6cf7f
|
Leszek Koltunski
|
case 1: return new Static4D(0,-SQ2/2,0,SQ2/2); // 90 along Y
|
300 |
802fe251
|
Leszek Koltunski
|
case 2: return mObjectQuats[10]; // 180 along Y
|
301 |
84a17011
|
Leszek Koltunski
|
case 3: return new Static4D(0, SQ2/2,0,SQ2/2); // 90 along
|
302 |
d0e6cf7f
|
Leszek Koltunski
|
case 4: return new Static4D(0, 0,1, 0); // 180 along Z
|
303 |
35ae98f0
|
Leszek Koltunski
|
case 5: return mObjectQuats[4];
|
304 |
d0e6cf7f
|
Leszek Koltunski
|
case 6: return new Static4D( 1,0,0, 0); // 180 along X
|
305 |
35ae98f0
|
Leszek Koltunski
|
case 7: return mObjectQuats[3];
|
306 |
d0e6cf7f
|
Leszek Koltunski
|
}
|
307 |
|
|
|
308 |
|
|
return null;
|
309 |
|
|
}
|
310 |
|
|
|
311 |
29b82486
|
Leszek Koltunski
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
312 |
|
|
|
313 |
|
|
private int retFaceTetraBelongsTo(int tetra, int numLayers)
|
314 |
|
|
{
|
315 |
|
|
if( mTetraToFaceMap==null ) mTetraToFaceMap = new int[] {1,2,3,0,5,6,7,4};
|
316 |
|
|
|
317 |
|
|
for(int i=numLayers-1; i>0; i--)
|
318 |
|
|
{
|
319 |
|
|
if( tetra < 8*i ) return mTetraToFaceMap[tetra/i];
|
320 |
|
|
tetra -= 8*i;
|
321 |
|
|
}
|
322 |
|
|
|
323 |
|
|
return -1;
|
324 |
|
|
}
|
325 |
|
|
|
326 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
327 |
|
|
|
328 |
84a17011
|
Leszek Koltunski
|
private float[][] getVertices(int variant)
|
329 |
29b82486
|
Leszek Koltunski
|
{
|
330 |
|
|
if( variant==0 )
|
331 |
|
|
{
|
332 |
84a17011
|
Leszek Koltunski
|
return new float[][]
|
333 |
29b82486
|
Leszek Koltunski
|
{
|
334 |
57ef6378
|
Leszek Koltunski
|
{ 0.5f, 0.0f, 0.5f},
|
335 |
|
|
{ 0.5f, 0.0f,-0.5f},
|
336 |
|
|
{-0.5f, 0.0f,-0.5f},
|
337 |
|
|
{-0.5f, 0.0f, 0.5f},
|
338 |
|
|
{ 0.0f, SQ2/2, 0.0f},
|
339 |
|
|
{ 0.0f,-SQ2/2, 0.0f}
|
340 |
29b82486
|
Leszek Koltunski
|
};
|
341 |
84a17011
|
Leszek Koltunski
|
}
|
342 |
|
|
else
|
343 |
|
|
{
|
344 |
|
|
return new float[][]
|
345 |
|
|
{
|
346 |
|
|
{-0.5f, SQ2/4, 0.0f},
|
347 |
|
|
{ 0.5f, SQ2/4, 0.0f},
|
348 |
|
|
{ 0.0f,-SQ2/4, 0.5f},
|
349 |
|
|
{ 0.0f,-SQ2/4,-0.5f}
|
350 |
|
|
};
|
351 |
|
|
}
|
352 |
|
|
}
|
353 |
|
|
|
354 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
355 |
29b82486
|
Leszek Koltunski
|
|
356 |
84a17011
|
Leszek Koltunski
|
public ObjectShape getObjectShape(int variant)
|
357 |
|
|
{
|
358 |
|
|
if( variant==0 )
|
359 |
|
|
{
|
360 |
4e9f2df5
|
Leszek Koltunski
|
int[][] indices =
|
361 |
29b82486
|
Leszek Koltunski
|
{
|
362 |
|
|
{3,0,4},
|
363 |
|
|
{0,1,4},
|
364 |
|
|
{1,2,4},
|
365 |
|
|
{2,3,4},
|
366 |
|
|
{5,0,3},
|
367 |
|
|
{5,1,0},
|
368 |
|
|
{5,2,1},
|
369 |
|
|
{5,3,2}
|
370 |
|
|
};
|
371 |
|
|
|
372 |
84a17011
|
Leszek Koltunski
|
return new ObjectShape(getVertices(variant), indices);
|
373 |
3ee1d662
|
Leszek Koltunski
|
}
|
374 |
|
|
else
|
375 |
|
|
{
|
376 |
84a17011
|
Leszek Koltunski
|
int[][] indices = { {2,1,0}, {2,3,1}, {3,2,0}, {3,0,1} };
|
377 |
|
|
return new ObjectShape(getVertices(variant), indices);
|
378 |
3ee1d662
|
Leszek Koltunski
|
}
|
379 |
|
|
}
|
380 |
|
|
|
381 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
382 |
|
|
|
383 |
|
|
public ObjectFaceShape getObjectFaceShape(int variant)
|
384 |
|
|
{
|
385 |
|
|
int numL = getNumLayers()[0];
|
386 |
|
|
int N = numL>3 ? 5:6;
|
387 |
4e9f2df5
|
Leszek Koltunski
|
int E = numL>2 ? (numL>3 ? 0:1) : 2;
|
388 |
3bf19410
|
Leszek Koltunski
|
float height = isInIconMode() ? 0.001f : 0.05f;
|
389 |
3ee1d662
|
Leszek Koltunski
|
|
390 |
|
|
if( variant==0 )
|
391 |
|
|
{
|
392 |
84a17011
|
Leszek Koltunski
|
float[][] bands = { {height,20,0.5f,0.8f,N,E,E} };
|
393 |
|
|
int[] bandIndices= { 0,0,0,0,0,0,0,0 };
|
394 |
|
|
return new ObjectFaceShape(bands,bandIndices,null);
|
395 |
|
|
}
|
396 |
|
|
else
|
397 |
|
|
{
|
398 |
|
|
float[][] bands = { {height,35,0.5f,0.8f,N,E,E} };
|
399 |
|
|
int[] bandIndices= { 0,0,0,0 };
|
400 |
|
|
return new ObjectFaceShape(bands,bandIndices,null);
|
401 |
|
|
}
|
402 |
|
|
}
|
403 |
|
|
|
404 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
405 |
|
|
|
406 |
|
|
public ObjectVertexEffects getVertexEffects(int variant)
|
407 |
|
|
{
|
408 |
|
|
if( variant==0 )
|
409 |
|
|
{
|
410 |
|
|
float[][] corners= { {0.06f,0.15f} };
|
411 |
|
|
int[] indices = { 0,0,0,0,0,0 };
|
412 |
|
|
float[][] centers= { {0.0f, 0.0f, 0.0f} };
|
413 |
|
|
return FactoryCubit.generateVertexEffect(getVertices(variant),corners,indices,centers,indices);
|
414 |
29b82486
|
Leszek Koltunski
|
}
|
415 |
|
|
else
|
416 |
|
|
{
|
417 |
84a17011
|
Leszek Koltunski
|
float[][] corners= { {0.08f,0.15f} };
|
418 |
|
|
int[] indices = { 0,0,0,0 };
|
419 |
|
|
float[][] centers= { {0.0f, 0.0f, 0.0f} };
|
420 |
|
|
return FactoryCubit.generateVertexEffect(getVertices(variant),corners,indices,centers,indices);
|
421 |
29b82486
|
Leszek Koltunski
|
}
|
422 |
|
|
}
|
423 |
|
|
|
424 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
425 |
|
|
|
426 |
e30c522a
|
Leszek Koltunski
|
public int getNumCubitVariants(int[] numLayers)
|
427 |
29b82486
|
Leszek Koltunski
|
{
|
428 |
|
|
return 2;
|
429 |
|
|
}
|
430 |
|
|
|
431 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
432 |
|
|
|
433 |
e30c522a
|
Leszek Koltunski
|
public int getCubitVariant(int cubit, int[] numLayers)
|
434 |
29b82486
|
Leszek Koltunski
|
{
|
435 |
a57e6870
|
Leszek Koltunski
|
return cubit<getNumOctahedrons(numLayers[0]) ? 0 : 1;
|
436 |
29b82486
|
Leszek Koltunski
|
}
|
437 |
|
|
|
438 |
3d766df3
|
Leszek Koltunski
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
439 |
|
|
|
440 |
d53fb890
|
Leszek Koltunski
|
public float getStickerRadius()
|
441 |
3d766df3
|
Leszek Koltunski
|
{
|
442 |
00f4980d
|
Leszek Koltunski
|
return 0.08f;
|
443 |
3d766df3
|
Leszek Koltunski
|
}
|
444 |
|
|
|
445 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
446 |
|
|
|
447 |
d53fb890
|
Leszek Koltunski
|
public float getStickerStroke()
|
448 |
3d766df3
|
Leszek Koltunski
|
{
|
449 |
|
|
float stroke = 0.08f;
|
450 |
|
|
|
451 |
3bf19410
|
Leszek Koltunski
|
if( isInIconMode() )
|
452 |
3d766df3
|
Leszek Koltunski
|
{
|
453 |
|
|
int[] numLayers = getNumLayers();
|
454 |
|
|
|
455 |
|
|
switch(numLayers[0])
|
456 |
|
|
{
|
457 |
|
|
case 2: stroke*=1.4f; break;
|
458 |
|
|
case 3: stroke*=2.0f; break;
|
459 |
|
|
case 4: stroke*=2.1f; break;
|
460 |
|
|
default:stroke*=2.2f; break;
|
461 |
|
|
}
|
462 |
|
|
}
|
463 |
|
|
|
464 |
|
|
return stroke;
|
465 |
|
|
}
|
466 |
|
|
|
467 |
00f4980d
|
Leszek Koltunski
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
468 |
|
|
|
469 |
d53fb890
|
Leszek Koltunski
|
public float[][] getStickerAngles()
|
470 |
00f4980d
|
Leszek Koltunski
|
{
|
471 |
|
|
return null;
|
472 |
|
|
}
|
473 |
29b82486
|
Leszek Koltunski
|
|
474 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
475 |
|
|
// PUBLIC API
|
476 |
|
|
|
477 |
|
|
public Static3D[] getRotationAxis()
|
478 |
|
|
{
|
479 |
|
|
return ROT_AXIS;
|
480 |
|
|
}
|
481 |
|
|
|
482 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
483 |
|
|
|
484 |
beee90ab
|
Leszek Koltunski
|
public int[][] getBasicAngles()
|
485 |
29b82486
|
Leszek Koltunski
|
{
|
486 |
beee90ab
|
Leszek Koltunski
|
if( mBasicAngle ==null )
|
487 |
|
|
{
|
488 |
|
|
int num = getNumLayers()[0];
|
489 |
|
|
int[] tmp = new int[num];
|
490 |
|
|
for(int i=0; i<num; i++) tmp[i] = 3;
|
491 |
|
|
mBasicAngle = new int[][] { tmp,tmp,tmp,tmp };
|
492 |
|
|
}
|
493 |
29b82486
|
Leszek Koltunski
|
return mBasicAngle;
|
494 |
|
|
}
|
495 |
|
|
|
496 |
61aa85e4
|
Leszek Koltunski
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
497 |
|
|
|
498 |
5f54927b
|
Leszek Koltunski
|
public String getShortName()
|
499 |
61aa85e4
|
Leszek Koltunski
|
{
|
500 |
5f54927b
|
Leszek Koltunski
|
switch(getNumLayers()[0])
|
501 |
|
|
{
|
502 |
|
|
case 2: return ObjectType.DIAM_2.name();
|
503 |
|
|
case 3: return ObjectType.DIAM_3.name();
|
504 |
|
|
case 4: return ObjectType.DIAM_4.name();
|
505 |
|
|
}
|
506 |
|
|
|
507 |
|
|
return ObjectType.DIAM_2.name();
|
508 |
|
|
}
|
509 |
|
|
|
510 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
511 |
|
|
|
512 |
1d581993
|
Leszek Koltunski
|
public ObjectSignature getSignature()
|
513 |
5f54927b
|
Leszek Koltunski
|
{
|
514 |
|
|
switch(getNumLayers()[0])
|
515 |
61aa85e4
|
Leszek Koltunski
|
{
|
516 |
1d581993
|
Leszek Koltunski
|
case 2: return new ObjectSignature(ObjectType.DIAM_2);
|
517 |
|
|
case 3: return new ObjectSignature(ObjectType.DIAM_3);
|
518 |
|
|
case 4: return new ObjectSignature(ObjectType.DIAM_4);
|
519 |
61aa85e4
|
Leszek Koltunski
|
}
|
520 |
|
|
|
521 |
1d581993
|
Leszek Koltunski
|
return null;
|
522 |
61aa85e4
|
Leszek Koltunski
|
}
|
523 |
|
|
|
524 |
29b82486
|
Leszek Koltunski
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
525 |
|
|
|
526 |
e26eb4e7
|
Leszek Koltunski
|
public String getObjectName()
|
527 |
29b82486
|
Leszek Koltunski
|
{
|
528 |
e26eb4e7
|
Leszek Koltunski
|
switch(getNumLayers()[0])
|
529 |
29b82486
|
Leszek Koltunski
|
{
|
530 |
e26eb4e7
|
Leszek Koltunski
|
case 2: return "Skewb Diamond";
|
531 |
|
|
case 3: return "Face Turning Octahedron";
|
532 |
|
|
case 4: return "Master Face Turning Octahedron";
|
533 |
29b82486
|
Leszek Koltunski
|
}
|
534 |
|
|
|
535 |
e26eb4e7
|
Leszek Koltunski
|
return "Skewb Diamond";
|
536 |
29b82486
|
Leszek Koltunski
|
}
|
537 |
|
|
|
538 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
539 |
|
|
|
540 |
e26eb4e7
|
Leszek Koltunski
|
public String getInventor()
|
541 |
29b82486
|
Leszek Koltunski
|
{
|
542 |
e26eb4e7
|
Leszek Koltunski
|
switch(getNumLayers()[0])
|
543 |
29b82486
|
Leszek Koltunski
|
{
|
544 |
e26eb4e7
|
Leszek Koltunski
|
case 2: return "Uwe Meffert";
|
545 |
|
|
case 3: return "David Pitcher";
|
546 |
|
|
case 4: return "Timur Evbatyrov";
|
547 |
29b82486
|
Leszek Koltunski
|
}
|
548 |
|
|
|
549 |
e26eb4e7
|
Leszek Koltunski
|
return "Uwe Meffert";
|
550 |
29b82486
|
Leszek Koltunski
|
}
|
551 |
|
|
|
552 |
59c20632
|
Leszek Koltunski
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
553 |
|
|
|
554 |
e26eb4e7
|
Leszek Koltunski
|
public int getYearOfInvention()
|
555 |
59c20632
|
Leszek Koltunski
|
{
|
556 |
e26eb4e7
|
Leszek Koltunski
|
switch(getNumLayers()[0])
|
557 |
59c20632
|
Leszek Koltunski
|
{
|
558 |
|
|
case 2: return 1984;
|
559 |
|
|
case 3: return 2003;
|
560 |
|
|
case 4: return 2011;
|
561 |
|
|
}
|
562 |
|
|
return 1984;
|
563 |
|
|
}
|
564 |
|
|
|
565 |
29b82486
|
Leszek Koltunski
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
566 |
|
|
|
567 |
e26eb4e7
|
Leszek Koltunski
|
public int getComplexity()
|
568 |
29b82486
|
Leszek Koltunski
|
{
|
569 |
e26eb4e7
|
Leszek Koltunski
|
switch(getNumLayers()[0])
|
570 |
29b82486
|
Leszek Koltunski
|
{
|
571 |
b4223a92
|
Leszek Koltunski
|
case 2: return 1;
|
572 |
577fcf3d
|
Leszek Koltunski
|
case 3: return 3;
|
573 |
|
|
case 4: return 4;
|
574 |
29b82486
|
Leszek Koltunski
|
}
|
575 |
|
|
|
576 |
|
|
return 0;
|
577 |
|
|
}
|
578 |
052e0362
|
Leszek Koltunski
|
|
579 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
580 |
|
|
|
581 |
|
|
public String[][] getTutorials()
|
582 |
|
|
{
|
583 |
|
|
int[] numLayers = getNumLayers();
|
584 |
|
|
|
585 |
|
|
switch(numLayers[0])
|
586 |
|
|
{
|
587 |
|
|
case 2: return new String[][] {
|
588 |
|
|
{"gb","R2wrbJJ3izM","How to Solve a Skewb Diamond","Dr. Penguin^3"},
|
589 |
|
|
{"es","2RCusYQdYYE","Como resolver Skewb Diamond","Tutoriales Rubik"},
|
590 |
|
|
{"ru","k8B6RFcNoGw","Как собрать Skewb Diamond","Алексей Ярыгин"},
|
591 |
|
|
{"fr","tqbkgwNcZCE","Comment résoudre le Skewb Diamond","Valentino Cube"},
|
592 |
|
|
{"de","6ewzrCOnZfg","Octagon lösen","JamesKnopf"},
|
593 |
|
|
{"pl","61_Z4TpLMBc","Diamond Skewb TUTORIAL PL","MrUk"},
|
594 |
|
|
{"br","UapwpXMYtH4","Como resolver o Octaedro Diamond","Rafael Cinoto"},
|
595 |
|
|
{"kr","hVBSlfHVTME","공식 하나만 사용 - 다이아몬드 스큐브","Denzel Washington"},
|
596 |
|
|
};
|
597 |
|
|
case 3: return new String[][] {
|
598 |
|
|
{"gb","n_mBSUDLUZw","Face Turning Octahedron Tutorial","SuperAntoniovivaldi"},
|
599 |
|
|
{"es","ogf0t6fGxZI","FTO - Tutorial en español","Gadi Rubik"},
|
600 |
|
|
{"ru","VXCjk0bVRoA","Как собрать Face Turning Octahedron","Алексей Ярыгин"},
|
601 |
|
|
{"de","6bO0AcwY5K8","Face Turning Octahedron - Tutorial","GerCubing"},
|
602 |
|
|
{"pl","huWg-ZfP-KY","Octahedron cube TUTORIAL PL","MrUk"},
|
603 |
|
|
{"br","WN3BoP4EbvM","Como resolver o octaedro 3x3 1/3","Rafael Cinoto"},
|
604 |
|
|
{"br","4zFlfANOliE","Como resolver o octaedro 3x3 2/3","Rafael Cinoto"},
|
605 |
|
|
{"br","6OvNzoHk7RU","Como resolver o octaedro 3x3 3/3","Rafael Cinoto"},
|
606 |
a399e91b
|
Leszek Koltunski
|
{"vn","KzGQ-mVRsss","Tutorial N.43 - FTO","Duy Thích Rubik"},
|
607 |
052e0362
|
Leszek Koltunski
|
};
|
608 |
|
|
case 4: return new String[][] {
|
609 |
|
|
{"gb","3GJkySk5zeQ","Master Face Turning Octahedron","SuperAntoniovivaldi"},
|
610 |
|
|
{"gb","zW_1htxy52k","Master FTO Tutorial","Michele Regano"},
|
611 |
|
|
{"es","3K8XL9SBSvs","Tutorial Master FTO de Mf8","Robert Cubes"},
|
612 |
|
|
{"ru","0CRwhZ2JNJA","Как собрать Master FTO","Алексей Ярыгин"},
|
613 |
a399e91b
|
Leszek Koltunski
|
{"vn","4XdeuGYDCJo","Tutorial N.141 - Master FTO","Duy Thích Rubik"},
|
614 |
052e0362
|
Leszek Koltunski
|
};
|
615 |
|
|
}
|
616 |
|
|
return null;
|
617 |
|
|
}
|
618 |
29b82486
|
Leszek Koltunski
|
}
|