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