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 org.distorted.library.type.Static3D;
|
23
|
import org.distorted.library.type.Static4D;
|
24
|
import org.distorted.objectlib.helpers.FactoryCubit;
|
25
|
import org.distorted.objectlib.helpers.ObjectShape;
|
26
|
import org.distorted.objectlib.helpers.ObjectSticker;
|
27
|
import org.distorted.objectlib.helpers.ScrambleState;
|
28
|
import org.distorted.objectlib.main.ObjectControl;
|
29
|
import org.distorted.objectlib.main.ObjectType;
|
30
|
import org.distorted.objectlib.main.ShapeOctahedron;
|
31
|
import org.distorted.objectlib.touchcontrol.TouchControlOctahedron;
|
32
|
|
33
|
import java.io.InputStream;
|
34
|
|
35
|
import static org.distorted.objectlib.touchcontrol.TouchControl.TC_OCTAHEDRON;
|
36
|
import static org.distorted.objectlib.touchcontrol.TouchControl.TYPE_NOT_SPLIT;
|
37
|
|
38
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
39
|
|
40
|
public class TwistyTrajber extends ShapeOctahedron
|
41
|
{
|
42
|
// each cut is at 1/6 of the length of the segment from the center to a vertex.
|
43
|
private static final float CUT = 1.0f/6;
|
44
|
private static final float LEN = 1.5f;
|
45
|
|
46
|
// the three rotation axis of a 3x3x3 cube. Must be normalized.
|
47
|
static final Static3D[] ROT_AXIS = new Static3D[]
|
48
|
{
|
49
|
new Static3D(SQ2/2, 0, SQ2/2),
|
50
|
new Static3D( 0, 1, 0),
|
51
|
new Static3D(SQ2/2, 0,-SQ2/2)
|
52
|
};
|
53
|
|
54
|
private static final int[] mQuatIndices = new int[] {13,12,8,9,0,1, 15,10,14,11, 0,1,3,2, 8,9,5,4, 0,8,9,1,15,2,3,6};
|
55
|
|
56
|
private int[][] mFaceColorMap, mEdgeColorMap, mCornerColorMap;
|
57
|
private ScrambleState[] mStates;
|
58
|
private int[] mBasicAngle;
|
59
|
private int[] mFaceMap;
|
60
|
private float[][] mCuts;
|
61
|
private Static4D[] mQuats;
|
62
|
private ObjectSticker[] mStickers;
|
63
|
private float[][] mCenters;
|
64
|
|
65
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
66
|
|
67
|
public TwistyTrajber(int[] numL, int meshState, Static4D quat, Static3D move, float scale, InputStream stream)
|
68
|
{
|
69
|
super(numL, meshState, numL[0], quat, move, scale, stream);
|
70
|
|
71
|
FactoryCubit factory = FactoryCubit.getInstance();
|
72
|
factory.printStickerCoords();
|
73
|
}
|
74
|
|
75
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
76
|
|
77
|
public ScrambleState[] getScrambleStates()
|
78
|
{
|
79
|
if( mStates==null )
|
80
|
{
|
81
|
int[][] m = new int[16][];
|
82
|
|
83
|
for(int i=0; i<16; i++) m[i] = new int[] { 0,-1,i,0,1,i,0,2,i, 1,-1,i,1,1,i,1,2,i, 2,-1,i,2,1,i,2,2,i};
|
84
|
|
85
|
mStates = new ScrambleState[]
|
86
|
{
|
87
|
new ScrambleState( new int[][] { m[ 1], m[ 2], m[ 3] } ), // 0 0
|
88
|
new ScrambleState( new int[][] { null, m[ 4], m[ 5] } ), // 1 x
|
89
|
new ScrambleState( new int[][] { m[ 6], null, m[ 7] } ), // 2 y
|
90
|
new ScrambleState( new int[][] { m[ 8], m[ 9], null } ), // 3 z
|
91
|
new ScrambleState( new int[][] { m[10], null, m[ 7] } ), // 4 xy
|
92
|
new ScrambleState( new int[][] { m[11], m[ 9], null } ), // 5 xz
|
93
|
new ScrambleState( new int[][] { null, m[12], m[ 5] } ), // 6 yx
|
94
|
new ScrambleState( new int[][] { m[ 8], m[13], null } ), // 7 yz
|
95
|
new ScrambleState( new int[][] { null, m[ 4], m[14] } ), // 8 zx
|
96
|
new ScrambleState( new int[][] { m[ 6], null, m[15] } ), // 9 zy
|
97
|
new ScrambleState( new int[][] { null, null, m[ 5] } ), // 10 xyx
|
98
|
new ScrambleState( new int[][] { null, m[ 4], null } ), // 11 xzx
|
99
|
new ScrambleState( new int[][] { null, null, m[ 7] } ), // 12 yxy
|
100
|
new ScrambleState( new int[][] { m[ 6], null, null } ), // 13 yzy
|
101
|
new ScrambleState( new int[][] { null, m[ 9], null } ), // 14 zxz
|
102
|
new ScrambleState( new int[][] { m[ 8], null, null } ), // 15 zyz
|
103
|
};
|
104
|
}
|
105
|
|
106
|
return mStates;
|
107
|
}
|
108
|
|
109
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
110
|
// quaternions are in the same order as in cuboids
|
111
|
|
112
|
// {13,12,8,9,0,1, 15,10,14,11,0,1,3,2,8,9,5,4, 0,8,9,1,15,2,3,6};
|
113
|
|
114
|
private void initializeQuats()
|
115
|
{
|
116
|
mQuats = new Static4D[]
|
117
|
{
|
118
|
new Static4D( 0.0f, 0.0f, 0.0f, 1.0f), // 0 nothing // OK
|
119
|
new Static4D( SQ2/2, 0.0f, SQ2/2, 0.0f), // 1 ( 1, 0,-1) 180 // OK
|
120
|
new Static4D( 0.0f, 1.0f, 0.0f, 0.0f), // 2 ( 0, 1, 0) 180 // OK
|
121
|
new Static4D( SQ2/2, 0.0f, -SQ2/2, 0.0f), // 3 ( 1, 0, 1) 180 // OK
|
122
|
|
123
|
new Static4D( 0.5f, SQ2/2, -0.5f, 0.0f), // 4 (0.5,SQ2/2,0.5) 180
|
124
|
new Static4D( 0.5f, -SQ2/2, -0.5f, 0.0f), // 5 (0.5,-SQ2/2,-0.5) 180
|
125
|
new Static4D( 1.0f, 0.0f, 0.0f, 0.0f), // 6 (1,0,0) 180
|
126
|
new Static4D( 0.0f, 0.0f, 1.0f, 0.0f), // 7 (0,0,1) 180
|
127
|
new Static4D( 0.5f, 0.0f, 0.5f, SQ2/2), // 8 ( 1, 0, 1) +-90 // OK
|
128
|
new Static4D( 0.5f, 0.0f, 0.5f, -SQ2/2), // 9 ( 1, 0, 1) -+90 // OK
|
129
|
new Static4D( 0.5f, SQ2/2, 0.5f, 0.0f), // 10 (-0.5,-SQ2/2,-0.5) 180
|
130
|
new Static4D( 0.5f, -SQ2/2, 0.5f, 0.0f), // 11 (0.5,-SQ2/2,0.5) 180
|
131
|
new Static4D( 0.0f, SQ2/2, 0.0f, SQ2/2), // 12 ( 0, 1, 0) +-90 // OK
|
132
|
new Static4D( 0.0f, SQ2/2, 0.0f, -SQ2/2), // 13 ( 0, 1, 0) -+90 // OK
|
133
|
new Static4D( 0.5f, 0.0f, -0.5f, -SQ2/2), // 15 ( 1, 0,-1) -+90 // OK
|
134
|
new Static4D( 0.5f, 0.0f, -0.5f, SQ2/2), // 14 ( 1, 0,-1) +-90 // OK
|
135
|
|
136
|
new Static4D( SQ2/2, 0.5f, 0.0f, 0.5f), // 16 (+,+,0) +
|
137
|
new Static4D( 0.0f, -0.5f, SQ2/2, -0.5f), // 17 (0,-,+) -
|
138
|
new Static4D( 0.0f, 0.5f, -SQ2/2, -0.5f), // 18 (0,+,-) -
|
139
|
new Static4D( SQ2/2, -0.5f, 0.0f, -0.5f), // 19 (+,-,0) -
|
140
|
new Static4D(-SQ2/2, -0.5f, 0.0f, 0.5f), // 20 (-,-,0) +
|
141
|
new Static4D( SQ2/2, -0.5f, 0.0f, 0.5f), // 21 (+,-,0) +
|
142
|
new Static4D( 0.0f, -0.5f, -SQ2/2, 0.5f), // 22 (0,-,-) +
|
143
|
new Static4D( 0.0f, -0.5f, -SQ2/2, -0.5f), // 23 (0,-,-) -
|
144
|
};
|
145
|
}
|
146
|
|
147
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
148
|
|
149
|
public int[] getSolvedQuats(int cubit, int[] numLayers)
|
150
|
{
|
151
|
if( mQuats==null ) initializeQuats();
|
152
|
if( mFaceMap==null ) mFaceMap = new int[] {4,0,6,2,7,3,5,1};
|
153
|
int status = retCubitSolvedStatus(cubit,numLayers);
|
154
|
return status<0 ? null : buildSolvedQuats(TouchControlOctahedron.FACE_AXIS[mFaceMap[status]],mQuats);
|
155
|
}
|
156
|
|
157
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
158
|
|
159
|
public Static4D[] getQuats()
|
160
|
{
|
161
|
if( mQuats==null ) initializeQuats();
|
162
|
return mQuats;
|
163
|
}
|
164
|
|
165
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
166
|
|
167
|
public int getSolvedFunctionIndex()
|
168
|
{
|
169
|
return 0;
|
170
|
}
|
171
|
|
172
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
173
|
|
174
|
public int getNumStickerTypes(int[] numLayers)
|
175
|
{
|
176
|
return 3;
|
177
|
}
|
178
|
|
179
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
180
|
|
181
|
public float[][] getCuts(int[] numLayers)
|
182
|
{
|
183
|
if( mCuts==null )
|
184
|
{
|
185
|
final float cut= CUT*LEN*SQ2;
|
186
|
mCuts = new float[][] { {-cut,+cut},{-cut,+cut},{-cut,+cut} };
|
187
|
}
|
188
|
|
189
|
return mCuts;
|
190
|
}
|
191
|
|
192
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
193
|
|
194
|
public boolean[][] getLayerRotatable(int[] numLayers)
|
195
|
{
|
196
|
int numAxis = ROT_AXIS.length;
|
197
|
boolean[][] layerRotatable = new boolean[numAxis][];
|
198
|
|
199
|
for(int i=0; i<numAxis; i++)
|
200
|
{
|
201
|
layerRotatable[i] = new boolean[numLayers[i]];
|
202
|
for(int j=0; j<numLayers[i]; j++) layerRotatable[i][j] = true;
|
203
|
}
|
204
|
|
205
|
return layerRotatable;
|
206
|
}
|
207
|
|
208
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
209
|
|
210
|
public int getTouchControlType()
|
211
|
{
|
212
|
return TC_OCTAHEDRON;
|
213
|
}
|
214
|
|
215
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
216
|
|
217
|
public int getTouchControlSplit()
|
218
|
{
|
219
|
return TYPE_NOT_SPLIT;
|
220
|
}
|
221
|
|
222
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
223
|
|
224
|
public int[][][] getEnabled()
|
225
|
{
|
226
|
return new int[][][]
|
227
|
{
|
228
|
{{0,1,2}},{{0,1,2}},{{0,1,2}},{{0,1,2}},{{0,1,2}},{{0,1,2}},{{0,1,2}},{{0,1,2}}
|
229
|
};
|
230
|
}
|
231
|
|
232
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
233
|
|
234
|
public float[] getDist3D(int[] numLayers)
|
235
|
{
|
236
|
return null;
|
237
|
}
|
238
|
|
239
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
240
|
|
241
|
public int getNumCubitFaces()
|
242
|
{
|
243
|
return 9;
|
244
|
}
|
245
|
|
246
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
247
|
|
248
|
public float[][] getCubitPositions(int[] numLayers)
|
249
|
{
|
250
|
if( mCenters==null )
|
251
|
{
|
252
|
mCenters = new float[][]
|
253
|
{
|
254
|
{ LEN, 0, LEN},
|
255
|
{ -LEN, 0, -LEN},
|
256
|
{ 0, SQ2*LEN, 0},
|
257
|
{ 0,-SQ2*LEN, 0},
|
258
|
{ -LEN, 0, LEN},
|
259
|
{ LEN, 0, -LEN},
|
260
|
|
261
|
{-LEN/2, (SQ2/2)*LEN, LEN/2},
|
262
|
{ LEN/2, (SQ2/2)*LEN,-LEN/2},
|
263
|
{-LEN/2,-(SQ2/2)*LEN, LEN/2},
|
264
|
{ LEN/2,-(SQ2/2)*LEN,-LEN/2},
|
265
|
{ 0, 0, LEN},
|
266
|
{ LEN, 0, 0},
|
267
|
{ -LEN, 0, 0},
|
268
|
{ 0, 0, -LEN},
|
269
|
{ LEN/2, (SQ2/2)*LEN, LEN/2},
|
270
|
{ LEN/2,-(SQ2/2)*LEN, LEN/2},
|
271
|
{-LEN/2, (SQ2/2)*LEN,-LEN/2},
|
272
|
{-LEN/2,-(SQ2/2)*LEN,-LEN/2},
|
273
|
|
274
|
{ 0, SQ2*LEN/3, 2*LEN/3},
|
275
|
{ 2*LEN/3, SQ2*LEN/3, 0},
|
276
|
{ 0,-SQ2*LEN/3, 2*LEN/3},
|
277
|
{ 2*LEN/3,-SQ2*LEN/3, 0},
|
278
|
{-2*LEN/3, SQ2*LEN/3, 0},
|
279
|
{ 0, SQ2*LEN/3,-2*LEN/3},
|
280
|
{-2*LEN/3,-SQ2*LEN/3, 0},
|
281
|
{ 0,-SQ2*LEN/3,-2*LEN/3},
|
282
|
};
|
283
|
}
|
284
|
|
285
|
return mCenters;
|
286
|
}
|
287
|
|
288
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
289
|
|
290
|
public ObjectShape getObjectShape(int variant)
|
291
|
{
|
292
|
if( variant==0 )
|
293
|
{
|
294
|
final float A = SQ2*CUT*LEN;
|
295
|
final float B = CUT*LEN;
|
296
|
|
297
|
float[][] vertices = new float[][]
|
298
|
{
|
299
|
{ 0, 0, 0},
|
300
|
{ B, A, -B},
|
301
|
{ B, -A, -B},
|
302
|
{ 2*B, 0, 0},
|
303
|
{ 0, 0, -2*B},
|
304
|
{ 3*B, A, -B},
|
305
|
{ 3*B, -A, -B},
|
306
|
{ B, A, -3*B},
|
307
|
{ B, -A, -3*B},
|
308
|
|
309
|
{ LEN , A, SQ2*A-LEN},
|
310
|
{ LEN , -A, SQ2*A-LEN},
|
311
|
{ LEN-SQ2*A, A, -LEN},
|
312
|
{ LEN-SQ2*A, -A, -LEN}
|
313
|
};
|
314
|
|
315
|
int[][] vert_indices = new int[][]
|
316
|
{
|
317
|
{0,3,5,1},
|
318
|
{0,2,6,3},
|
319
|
{0,4,8,2},
|
320
|
{0,1,7,4},
|
321
|
{3,6,10,9,5},
|
322
|
{2,8,12,10,6},
|
323
|
{4,7,11,12,8},
|
324
|
{1,5,9,11,7},
|
325
|
{9,10,12,11}
|
326
|
};
|
327
|
|
328
|
float[][] bands = new float[][] { {0.00f,35,0.15f,0.3f,4,1,1},{0.00f,35,0.15f,0.3f,4,0,0} };
|
329
|
int[] bandIndices = new int[] { 0,0,0,0,1,1,1,1,1 };
|
330
|
float[][] corners = new float[][] { {0.03f,0.10f} };
|
331
|
int[] cornerIndices = new int[] { 0,-1,-1,-1,-1,0,0,0,0,-1,-1,-1,-1 };
|
332
|
float[][] centers = new float[][] { { LEN/2, 0.0f, -LEN/2} };
|
333
|
int[] centerIndices = new int[] { 0,-1,-1,-1,-1,0,0,0,0,-1,-1,-1,-1 };
|
334
|
return new ObjectShape(vertices,vert_indices,bands,bandIndices,corners,cornerIndices,centers,centerIndices,getNumCubitFaces(), null);
|
335
|
}
|
336
|
if( variant==1 )
|
337
|
{
|
338
|
final float A = SQ2*CUT*LEN;
|
339
|
final float B = CUT*LEN;
|
340
|
final float C = LEN-2*LEN*CUT;
|
341
|
|
342
|
float[][] vertices = new float[][]
|
343
|
{
|
344
|
{ -C, 0, 0},
|
345
|
{ -C+A, A, -B},
|
346
|
{ -C+A, -A, -B},
|
347
|
{ C, 0, 0},
|
348
|
{ C-A, A, -B},
|
349
|
{ C-A, -A, -B},
|
350
|
{ 0, A, -C},
|
351
|
{ 0, -A, -C},
|
352
|
};
|
353
|
|
354
|
int[][] vert_indices = new int[][]
|
355
|
{
|
356
|
{0,3,4,1},
|
357
|
{0,2,5,3},
|
358
|
{1,4,6},
|
359
|
{2,7,5},
|
360
|
{0,1,6,7,2},
|
361
|
{3,5,7,6,4}
|
362
|
};
|
363
|
|
364
|
float[][] bands = new float[][] { {0.00f,35,0.15f,0.3f,3,1,1},{0.00f,35,0.15f,0.3f,3,0,0} };
|
365
|
int[] bandIndices = new int[] { 0,0,1,1,1,1 };
|
366
|
float[][] corners = new float[][] { {0.02f,0.10f} };
|
367
|
int[] cornerIndices = new int[] { 0,0,0,0,0,0,-1,-1 };
|
368
|
float[][] centers = new float[][] { { 0, 0, -LEN/2} };
|
369
|
int[] centerIndices = new int[] { 0,0,0,0,0,0,-1,-1 };
|
370
|
return new ObjectShape(vertices,vert_indices,bands,bandIndices,corners,cornerIndices,centers,centerIndices,getNumCubitFaces(), null);
|
371
|
}
|
372
|
else
|
373
|
{
|
374
|
final float A = SQ2*CUT*LEN;
|
375
|
final float C = LEN-2*LEN*CUT;
|
376
|
final float L = C-A;
|
377
|
|
378
|
float[][] vertices = new float[][]
|
379
|
{
|
380
|
{ -L, -(SQ2/3)*L, L/3 },
|
381
|
{ L, -(SQ2/3)*L, L/3 },
|
382
|
{ 0,(2*SQ2/3)*L,-2*L/3 },
|
383
|
{ 0, -(SQ2/3)*L,-2*L/3 },
|
384
|
};
|
385
|
|
386
|
int[][] vert_indices = new int[][]
|
387
|
{
|
388
|
{0,1,2},
|
389
|
{0,1,3},
|
390
|
{0,2,3},
|
391
|
{1,3,2},
|
392
|
};
|
393
|
|
394
|
float[][] bands = new float[][] { {0.00f,35,0.15f,0.3f,4,1,1},{0.00f,35,0.15f,0.3f,4,0,0} };
|
395
|
int[] bandIndices = new int[] { 0,1,1,1 };
|
396
|
float[][] corners = new float[][] { {0.02f,0.10f} };
|
397
|
int[] cornerIndices = new int[] { 0,0,0,-1 };
|
398
|
float[][] centers = new float[][] { {0, -(SQ2/3)*L,-2*L/3} };
|
399
|
int[] centerIndices = new int[] { 0,0,0,-1 };
|
400
|
return new ObjectShape(vertices,vert_indices,bands,bandIndices,corners,cornerIndices,centers,centerIndices,getNumCubitFaces(), null);
|
401
|
}
|
402
|
}
|
403
|
|
404
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
405
|
|
406
|
public Static4D getQuat(int cubit, int[] numLayers)
|
407
|
{
|
408
|
if( mQuats==null ) initializeQuats();
|
409
|
return mQuats[mQuatIndices[cubit]];
|
410
|
}
|
411
|
|
412
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
413
|
|
414
|
public int getNumCubitVariants(int[] numLayers)
|
415
|
{
|
416
|
return 3;
|
417
|
}
|
418
|
|
419
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
420
|
|
421
|
public int getCubitVariant(int cubit, int[] numLayers)
|
422
|
{
|
423
|
return cubit<6 ? 0 : cubit<18 ? 1 : 2;
|
424
|
}
|
425
|
|
426
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
427
|
|
428
|
public int getVariantFaceColor(int variant, int face, int[] numLayers)
|
429
|
{
|
430
|
return variant;
|
431
|
}
|
432
|
|
433
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
434
|
|
435
|
public int getCubitFaceColor(int cubit, int face, int[] numLayers)
|
436
|
{
|
437
|
int variant = getCubitVariant(cubit,numLayers);
|
438
|
|
439
|
if( mFaceColorMap==null)
|
440
|
{
|
441
|
mFaceColorMap = new int[][] { {1,5,4,0},{3,7,6,2},{1,0,3,2},{4,5,6,7},{0,4,7,3},{5,1,2,6} };
|
442
|
}
|
443
|
|
444
|
if( mEdgeColorMap==null)
|
445
|
{
|
446
|
mEdgeColorMap = new int[][] { {3,0},{1,2},{4,7},{6,5}, {0,4},{5,1},{7,3},{2,6}, {1,0},{4,5},{3,2},{6,7} };
|
447
|
}
|
448
|
|
449
|
if( mCornerColorMap==null)
|
450
|
{
|
451
|
mCornerColorMap = new int[][] { {0},{1},{4},{5},{3},{2},{7},{6} };
|
452
|
}
|
453
|
|
454
|
switch(variant)
|
455
|
{
|
456
|
case 0: return face<4 ? mFaceColorMap[cubit][face] :-1;
|
457
|
case 1: return face<2 ? mEdgeColorMap[cubit-6][face] :-1;
|
458
|
case 2: return face<1 ? mCornerColorMap[cubit-18][face]:-1;
|
459
|
}
|
460
|
|
461
|
return 0;
|
462
|
}
|
463
|
|
464
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
465
|
|
466
|
public ObjectSticker retSticker(int sticker)
|
467
|
{
|
468
|
if( mStickers==null )
|
469
|
{
|
470
|
float[][] STICKERS = new float[][]
|
471
|
{
|
472
|
{ -0.5f, -0.2886751f, 0.16666666f, -0.2886751f, 0.5f, 0.2886751f, -0.16666666f, 0.2886751f },
|
473
|
{ -0.5f, -0.10825317f, 0.5f, -0.10825317f, 0.3232233f, 0.10825317f, -0.32322332f, 0.10825317f },
|
474
|
{ -0.43301275f, -0.25f, 0.4330127f, -0.25f, 0.0f, 0.5f }
|
475
|
};
|
476
|
|
477
|
float R1 = 0.09f;
|
478
|
float R2 = 0.03f;
|
479
|
float R3 = 0.04f;
|
480
|
float[] strokes = new float[] { 0.10f,0.03f,0.04f };
|
481
|
float[][] radii = new float[][] { {R1,R1,R1,R1},{R2,R2,R2,R2},{R3,R3,R3} };
|
482
|
|
483
|
if( ObjectControl.isInIconMode() )
|
484
|
{
|
485
|
strokes[0]*=2.0f;
|
486
|
strokes[1]*=2.0f;
|
487
|
strokes[2]*=2.0f;
|
488
|
}
|
489
|
|
490
|
mStickers = new ObjectSticker[STICKERS.length];
|
491
|
mStickers[0] = new ObjectSticker(STICKERS[0],null,radii[0],strokes[0]);
|
492
|
mStickers[1] = new ObjectSticker(STICKERS[1],null,radii[1],strokes[1]);
|
493
|
mStickers[2] = new ObjectSticker(STICKERS[2],null,radii[2],strokes[2]);
|
494
|
}
|
495
|
|
496
|
return mStickers[sticker];
|
497
|
}
|
498
|
|
499
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
500
|
// PUBLIC API
|
501
|
|
502
|
public Static3D[] getRotationAxis()
|
503
|
{
|
504
|
return ROT_AXIS;
|
505
|
}
|
506
|
|
507
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
508
|
|
509
|
public int[] getBasicAngle()
|
510
|
{
|
511
|
if( mBasicAngle ==null ) mBasicAngle = new int[] { 4,4,4 };
|
512
|
return mBasicAngle;
|
513
|
}
|
514
|
|
515
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
516
|
|
517
|
public ObjectType intGetObjectType(int[] numLayers)
|
518
|
{
|
519
|
return ObjectType.TRAJ_3;
|
520
|
}
|
521
|
|
522
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
523
|
|
524
|
public String getObjectName()
|
525
|
{
|
526
|
return "Trajber's Octahedron";
|
527
|
}
|
528
|
|
529
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
530
|
|
531
|
public String getInventor()
|
532
|
{
|
533
|
return "Josef Trajber";
|
534
|
}
|
535
|
|
536
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
537
|
|
538
|
public int getYearOfInvention()
|
539
|
{
|
540
|
return 1982;
|
541
|
}
|
542
|
|
543
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
544
|
|
545
|
public int getComplexity()
|
546
|
{
|
547
|
return 2;
|
548
|
}
|
549
|
}
|