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.main.Movement.MOVEMENT_HEXAHEDRON;
|
23
|
import static org.distorted.objectlib.main.Movement.TYPE_SPLIT_CORNER;
|
24
|
|
25
|
import android.content.res.Resources;
|
26
|
|
27
|
import org.distorted.library.main.DistortedEffects;
|
28
|
import org.distorted.library.main.DistortedTexture;
|
29
|
import org.distorted.library.mesh.MeshSquare;
|
30
|
import org.distorted.library.type.Static3D;
|
31
|
import org.distorted.library.type.Static4D;
|
32
|
|
33
|
import org.distorted.objectlib.R;
|
34
|
import org.distorted.objectlib.main.Movement6;
|
35
|
import org.distorted.objectlib.main.ObjectControl;
|
36
|
import org.distorted.objectlib.main.ObjectType;
|
37
|
import org.distorted.objectlib.helpers.ObjectShape;
|
38
|
import org.distorted.objectlib.helpers.ObjectSticker;
|
39
|
import org.distorted.objectlib.helpers.ScrambleState;
|
40
|
import org.distorted.objectlib.main.Twisty6;
|
41
|
|
42
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
43
|
|
44
|
public class TwistyRex extends Twisty6
|
45
|
{
|
46
|
static final Static3D[] ROT_AXIS = new Static3D[]
|
47
|
{
|
48
|
new Static3D(+SQ3/3,+SQ3/3,+SQ3/3),
|
49
|
new Static3D(+SQ3/3,+SQ3/3,-SQ3/3),
|
50
|
new Static3D(+SQ3/3,-SQ3/3,+SQ3/3),
|
51
|
new Static3D(+SQ3/3,-SQ3/3,-SQ3/3)
|
52
|
};
|
53
|
|
54
|
public static final float REX_D = 0.2f;
|
55
|
|
56
|
private ScrambleState[] mStates;
|
57
|
private int[] mBasicAngle;
|
58
|
private Static4D[] mQuats;
|
59
|
private float[][] mCuts;
|
60
|
private int[][] mFaceMap;
|
61
|
private ObjectSticker[] mStickers;
|
62
|
|
63
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
64
|
|
65
|
public TwistyRex(int[] numL, Static4D quat, Static3D move, DistortedTexture texture,
|
66
|
MeshSquare mesh, DistortedEffects effects, Resources res, int surfaceW, int surfaceH)
|
67
|
{
|
68
|
super(numL, numL[0], quat, move, texture, mesh, effects, res, surfaceW, surfaceH);
|
69
|
}
|
70
|
|
71
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
72
|
|
73
|
protected ScrambleState[] getScrambleStates()
|
74
|
{
|
75
|
if( mStates==null )
|
76
|
{
|
77
|
int[] tmp = {0,-1,0, 0,1,0, 2,-1,0, 2,1,0 };
|
78
|
|
79
|
mStates = new ScrambleState[]
|
80
|
{
|
81
|
new ScrambleState( new int[][] {tmp,tmp,tmp,tmp} )
|
82
|
};
|
83
|
}
|
84
|
|
85
|
return mStates;
|
86
|
}
|
87
|
|
88
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
89
|
|
90
|
protected int getResource(int[] numLayers)
|
91
|
{
|
92
|
return R.raw.rex;
|
93
|
}
|
94
|
|
95
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
96
|
|
97
|
private void initializeQuats()
|
98
|
{
|
99
|
mQuats = new Static4D[]
|
100
|
{
|
101
|
new Static4D( 0.0f, 0.0f, 0.0f, 1.0f ),
|
102
|
new Static4D( 1.0f, 0.0f, 0.0f, 0.0f ),
|
103
|
new Static4D( 0.0f, 1.0f, 0.0f, 0.0f ),
|
104
|
new Static4D( 0.0f, 0.0f, 1.0f, 0.0f ),
|
105
|
|
106
|
new Static4D( 0.5f, 0.5f, 0.5f, 0.5f ),
|
107
|
new Static4D( 0.5f, 0.5f, 0.5f, -0.5f ),
|
108
|
new Static4D( 0.5f, 0.5f, -0.5f, 0.5f ),
|
109
|
new Static4D( 0.5f, 0.5f, -0.5f, -0.5f ),
|
110
|
new Static4D( 0.5f, -0.5f, 0.5f, 0.5f ),
|
111
|
new Static4D( 0.5f, -0.5f, 0.5f, -0.5f ),
|
112
|
new Static4D( 0.5f, -0.5f, -0.5f, 0.5f ),
|
113
|
new Static4D( 0.5f, -0.5f, -0.5f, -0.5f )
|
114
|
};
|
115
|
}
|
116
|
|
117
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
118
|
|
119
|
protected int[] getSolvedQuats(int cubit, int[] numLayers)
|
120
|
{
|
121
|
if( mQuats==null ) initializeQuats();
|
122
|
int status = retCubitSolvedStatus(cubit,numLayers);
|
123
|
return status<0 ? null : buildSolvedQuats(Movement6.FACE_AXIS[status],mQuats);
|
124
|
}
|
125
|
|
126
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
127
|
|
128
|
protected Static4D[] getQuats()
|
129
|
{
|
130
|
if( mQuats==null ) initializeQuats();
|
131
|
return mQuats;
|
132
|
}
|
133
|
|
134
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
135
|
|
136
|
public int getSolvedFunctionIndex()
|
137
|
{
|
138
|
return 0;
|
139
|
}
|
140
|
|
141
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
142
|
|
143
|
protected int getNumStickerTypes(int[] numLayers)
|
144
|
{
|
145
|
return 3;
|
146
|
}
|
147
|
|
148
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
149
|
|
150
|
protected float[][] getCuts(int[] numLayers)
|
151
|
{
|
152
|
if( mCuts==null )
|
153
|
{
|
154
|
float C = SQ3*0.45f; // bit less than 1/2 of the length of the main diagonal
|
155
|
float[] cut = new float[] {-C,+C};
|
156
|
mCuts = new float[][] { cut,cut,cut,cut };
|
157
|
}
|
158
|
|
159
|
return mCuts;
|
160
|
}
|
161
|
|
162
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
163
|
|
164
|
public boolean[][] getLayerRotatable(int[] numLayers)
|
165
|
{
|
166
|
int numAxis = ROT_AXIS.length;
|
167
|
boolean[] tmp = new boolean[] {true,false,true};
|
168
|
boolean[][] layerRotatable = new boolean[numAxis][];
|
169
|
for(int i=0; i<numAxis; i++) layerRotatable[i] = tmp;
|
170
|
|
171
|
return layerRotatable;
|
172
|
}
|
173
|
|
174
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
175
|
|
176
|
public int getMovementType()
|
177
|
{
|
178
|
return MOVEMENT_HEXAHEDRON;
|
179
|
}
|
180
|
|
181
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
182
|
|
183
|
public int getMovementSplit()
|
184
|
{
|
185
|
return TYPE_SPLIT_CORNER;
|
186
|
}
|
187
|
|
188
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
189
|
|
190
|
public int[][][] getEnabled()
|
191
|
{
|
192
|
return new int[][][]
|
193
|
{
|
194
|
{{0,1},{3,1},{2,3},{0,2}},
|
195
|
{{2,3},{3,1},{0,1},{0,2}},
|
196
|
{{1,2},{0,1},{0,3},{2,3}},
|
197
|
{{1,2},{2,3},{0,3},{0,1}},
|
198
|
{{0,3},{0,2},{1,2},{1,3}},
|
199
|
{{1,2},{0,2},{0,3},{1,3}},
|
200
|
};
|
201
|
}
|
202
|
|
203
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
204
|
|
205
|
public float[] getDist3D(int[] numLayers)
|
206
|
{
|
207
|
return null;
|
208
|
}
|
209
|
|
210
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
211
|
|
212
|
protected int getNumCubitFaces()
|
213
|
{
|
214
|
return 6;
|
215
|
}
|
216
|
|
217
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
218
|
|
219
|
protected float[][] getCubitPositions(int[] numLayers)
|
220
|
{
|
221
|
final float DIST1= 1.50f;
|
222
|
final float DIST2= (1+2*REX_D)/2;
|
223
|
final float DIST3= 1.53f;
|
224
|
|
225
|
final float[][] CENTERS = new float[24+6+12][];
|
226
|
|
227
|
CENTERS[ 0] = new float[] { +DIST3, +DIST2, +DIST2};
|
228
|
CENTERS[ 1] = new float[] { +DIST3, +DIST2, -DIST2};
|
229
|
CENTERS[ 2] = new float[] { +DIST3, -DIST2, -DIST2};
|
230
|
CENTERS[ 3] = new float[] { +DIST3, -DIST2, +DIST2};
|
231
|
CENTERS[ 4] = new float[] { -DIST3, +DIST2, +DIST2};
|
232
|
CENTERS[ 5] = new float[] { -DIST3, +DIST2, -DIST2};
|
233
|
CENTERS[ 6] = new float[] { -DIST3, -DIST2, -DIST2};
|
234
|
CENTERS[ 7] = new float[] { -DIST3, -DIST2, +DIST2};
|
235
|
CENTERS[ 8] = new float[] { +DIST2, +DIST3, +DIST2};
|
236
|
CENTERS[ 9] = new float[] { +DIST2, +DIST3, -DIST2};
|
237
|
CENTERS[10] = new float[] { -DIST2, +DIST3, -DIST2};
|
238
|
CENTERS[11] = new float[] { -DIST2, +DIST3, +DIST2};
|
239
|
CENTERS[12] = new float[] { +DIST2, -DIST3, +DIST2};
|
240
|
CENTERS[13] = new float[] { +DIST2, -DIST3, -DIST2};
|
241
|
CENTERS[14] = new float[] { -DIST2, -DIST3, -DIST2};
|
242
|
CENTERS[15] = new float[] { -DIST2, -DIST3, +DIST2};
|
243
|
CENTERS[16] = new float[] { +DIST2, +DIST2, +DIST3};
|
244
|
CENTERS[17] = new float[] { +DIST2, -DIST2, +DIST3};
|
245
|
CENTERS[18] = new float[] { -DIST2, -DIST2, +DIST3};
|
246
|
CENTERS[19] = new float[] { -DIST2, +DIST2, +DIST3};
|
247
|
CENTERS[20] = new float[] { +DIST2, +DIST2, -DIST3};
|
248
|
CENTERS[21] = new float[] { +DIST2, -DIST2, -DIST3};
|
249
|
CENTERS[22] = new float[] { -DIST2, -DIST2, -DIST3};
|
250
|
CENTERS[23] = new float[] { -DIST2, +DIST2, -DIST3};
|
251
|
|
252
|
CENTERS[24] = new float[] { +DIST3, +0.00f, +0.00f};
|
253
|
CENTERS[25] = new float[] { -DIST3, +0.00f, +0.00f};
|
254
|
CENTERS[26] = new float[] { +0.00f, +DIST3, +0.00f};
|
255
|
CENTERS[27] = new float[] { +0.00f, -DIST3, +0.00f};
|
256
|
CENTERS[28] = new float[] { +0.00f, +0.00f, +DIST3};
|
257
|
CENTERS[29] = new float[] { +0.00f, +0.00f, -DIST3};
|
258
|
|
259
|
CENTERS[30] = new float[] { +0.00f, +DIST1, +DIST1};
|
260
|
CENTERS[31] = new float[] { +DIST1, +0.00f, +DIST1};
|
261
|
CENTERS[32] = new float[] { +0.00f, -DIST1, +DIST1};
|
262
|
CENTERS[33] = new float[] { -DIST1, +0.00f, +DIST1};
|
263
|
CENTERS[34] = new float[] { +DIST1, +DIST1, +0.00f};
|
264
|
CENTERS[35] = new float[] { +DIST1, -DIST1, +0.00f};
|
265
|
CENTERS[36] = new float[] { -DIST1, -DIST1, +0.00f};
|
266
|
CENTERS[37] = new float[] { -DIST1, +DIST1, +0.00f};
|
267
|
CENTERS[38] = new float[] { +0.00f, +DIST1, -DIST1};
|
268
|
CENTERS[39] = new float[] { +DIST1, +0.00f, -DIST1};
|
269
|
CENTERS[40] = new float[] { +0.00f, -DIST1, -DIST1};
|
270
|
CENTERS[41] = new float[] { -DIST1, +0.00f, -DIST1};
|
271
|
|
272
|
return CENTERS;
|
273
|
}
|
274
|
|
275
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
276
|
|
277
|
protected ObjectShape getObjectShape(int cubit, int[] numLayers)
|
278
|
{
|
279
|
int variant = getCubitVariant(cubit,numLayers);
|
280
|
|
281
|
if( variant==0 )
|
282
|
{
|
283
|
float G = (1-REX_D)*SQ2/2;
|
284
|
double[][] vertices ={{-0.10f,0.70f,0},{-0.70f,0.10f,0},{+0.65f,-0.71f,0},{+0.71f,-0.65f,0}};
|
285
|
int[][] vertIndexes = { {0,1,2,3},{3,2,1,0} };
|
286
|
float[][] centers= new float[][] { {0.0f,0.0f,-G} };
|
287
|
float[][] corners= new float[][] { {0.03f,0.30f} };
|
288
|
int[] indices= {-1,-1,0,0};
|
289
|
int[] bandIndices= new int[] { 0,1 };
|
290
|
float[][] bands = { {+0.016f,10,G/3,0.5f,5,1,1},{+0.230f,45,G/3,0.0f,2,0,0} };
|
291
|
|
292
|
return new ObjectShape(vertices,vertIndexes,bands,bandIndices,corners,indices,centers,indices,getNumCubitFaces(), null);
|
293
|
}
|
294
|
else if( variant==1 )
|
295
|
{
|
296
|
float G = 3*REX_D;
|
297
|
double[][] vertices= { { -G, 0, 0 },{ 0, -G, 0 },{ +G, 0, 0 },{ 0,+G,0 } };
|
298
|
int[][] vertIndexes= { {0,1,2,3},{3,2,1,0} };
|
299
|
int[] indices= {-1,-1,-1,-1};
|
300
|
int[] bandIndices= new int[] { 0,1 };
|
301
|
float[][] bands = { {0.025f,10,G/2,0.5f,5,0,0},{0.000f,45,G/2,0.0f,2,0,0} };
|
302
|
|
303
|
return new ObjectShape(vertices,vertIndexes,bands,bandIndices,null,indices,null,indices,getNumCubitFaces(), null);
|
304
|
}
|
305
|
else
|
306
|
{
|
307
|
float E = 1.5f - 3*REX_D;
|
308
|
float F = 1.5f;
|
309
|
float G = (float)Math.sqrt(E*E+F*F);
|
310
|
double[][] vertices = { { -F, 0, 0 },{ 0,-E, 0 },{ +F, 0, 0 },{ 0, 0,-E } };
|
311
|
int[][] vertIndexes = { {0,1,2}, {0,2,3}, {0,3,1}, {1,3,2} };
|
312
|
float[][] centers= new float[][] { {0.0f,-1.5f,-1.5f} };
|
313
|
float[][] corners= new float[][] { {0.06f,0.20f} };
|
314
|
int[] indices= {0,-1,0,-1};
|
315
|
int[] bandIndices= new int[] { 0,0,1,1 };
|
316
|
float[][] bands = { {0.03f,27,F/3,0.8f,5,2,3},{0.01f,45,G/3,0.2f,3,1,2} };
|
317
|
|
318
|
return new ObjectShape(vertices,vertIndexes,bands,bandIndices,corners,indices,centers,indices,getNumCubitFaces(), null);
|
319
|
}
|
320
|
}
|
321
|
|
322
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
323
|
|
324
|
protected Static4D getQuat(int cubit, int[] numLayers)
|
325
|
{
|
326
|
if( mQuats==null ) initializeQuats();
|
327
|
|
328
|
switch(cubit)
|
329
|
{
|
330
|
case 0: return new Static4D(+SQ2/2, 0,+SQ2/2, 0);
|
331
|
case 1: return mQuats[5];
|
332
|
case 2: return new Static4D( 0,-SQ2/2, 0, SQ2/2);
|
333
|
case 3: return mQuats[8];
|
334
|
case 4: return mQuats[6];
|
335
|
case 5: return new Static4D(-SQ2/2, 0,+SQ2/2, 0);
|
336
|
case 6: return mQuats[11];
|
337
|
case 7: return new Static4D( 0,+SQ2/2, 0, SQ2/2);
|
338
|
case 8: return new Static4D(+SQ2/2, 0, 0, SQ2/2);
|
339
|
case 9: return mQuats[10];
|
340
|
case 10: return new Static4D( 0,+SQ2/2,+SQ2/2, 0);
|
341
|
case 11: return mQuats[4];
|
342
|
case 12: return mQuats[9];
|
343
|
case 13: return new Static4D(-SQ2/2, 0, 0, SQ2/2);
|
344
|
case 14: return mQuats[7];
|
345
|
case 15: return new Static4D( 0,-SQ2/2,+SQ2/2, 0);
|
346
|
case 16: return new Static4D( 0, 0,-SQ2/2, SQ2/2);
|
347
|
case 17: return mQuats[0];
|
348
|
case 18: return new Static4D( 0, 0,+SQ2/2, SQ2/2);
|
349
|
case 19: return mQuats[3];
|
350
|
case 20: return mQuats[1];
|
351
|
case 21: return new Static4D(+SQ2/2,-SQ2/2, 0, 0);
|
352
|
case 22: return mQuats[2];
|
353
|
case 23: return new Static4D(+SQ2/2,+SQ2/2, 0, 0);
|
354
|
|
355
|
case 24: return new Static4D( 0,-SQ2/2, 0, SQ2/2);
|
356
|
case 25: return new Static4D( 0,+SQ2/2, 0, SQ2/2);
|
357
|
case 26: return new Static4D(+SQ2/2, 0, 0, SQ2/2);
|
358
|
case 27: return new Static4D(-SQ2/2, 0, 0, SQ2/2);
|
359
|
case 28: return mQuats[0];
|
360
|
case 29: return mQuats[1];
|
361
|
|
362
|
case 30: return mQuats[0];
|
363
|
case 31: return new Static4D( 0, 0,+SQ2/2, SQ2/2);
|
364
|
case 32: return mQuats[3];
|
365
|
case 33: return new Static4D( 0, 0,-SQ2/2, SQ2/2);
|
366
|
case 34: return new Static4D( 0,-SQ2/2, 0, SQ2/2);
|
367
|
case 35: return mQuats[7];
|
368
|
case 36: return mQuats[9];
|
369
|
case 37: return new Static4D( 0,+SQ2/2, 0, SQ2/2);
|
370
|
case 38: return new Static4D(+SQ2/2, 0, 0, SQ2/2);
|
371
|
case 39: return mQuats[8];
|
372
|
case 40: return mQuats[1];
|
373
|
case 41: return mQuats[6];
|
374
|
}
|
375
|
|
376
|
return mQuats[0];
|
377
|
}
|
378
|
|
379
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
380
|
|
381
|
protected int getNumCubitVariants(int[] numLayers)
|
382
|
{
|
383
|
return 3;
|
384
|
}
|
385
|
|
386
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
387
|
|
388
|
protected int getCubitVariant(int cubit, int[] numLayers)
|
389
|
{
|
390
|
return cubit<24 ? 0 : (cubit<30?1:2);
|
391
|
}
|
392
|
|
393
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
394
|
|
395
|
protected int getFaceColor(int cubit, int cubitface, int[] numLayers)
|
396
|
{
|
397
|
if( mFaceMap==null )
|
398
|
{
|
399
|
mFaceMap = new int[][]
|
400
|
{
|
401
|
{ 0, 18,18,18,18,18 },
|
402
|
{ 0, 18,18,18,18,18 },
|
403
|
{ 0, 18,18,18,18,18 },
|
404
|
{ 0, 18,18,18,18,18 },
|
405
|
{ 1, 18,18,18,18,18 },
|
406
|
{ 1, 18,18,18,18,18 },
|
407
|
{ 1, 18,18,18,18,18 },
|
408
|
{ 1, 18,18,18,18,18 },
|
409
|
{ 2, 18,18,18,18,18 },
|
410
|
{ 2, 18,18,18,18,18 },
|
411
|
{ 2, 18,18,18,18,18 },
|
412
|
{ 2, 18,18,18,18,18 },
|
413
|
{ 3, 18,18,18,18,18 },
|
414
|
{ 3, 18,18,18,18,18 },
|
415
|
{ 3, 18,18,18,18,18 },
|
416
|
{ 3, 18,18,18,18,18 },
|
417
|
{ 4, 18,18,18,18,18 },
|
418
|
{ 4, 18,18,18,18,18 },
|
419
|
{ 4, 18,18,18,18,18 },
|
420
|
{ 4, 18,18,18,18,18 },
|
421
|
{ 5, 18,18,18,18,18 },
|
422
|
{ 5, 18,18,18,18,18 },
|
423
|
{ 5, 18,18,18,18,18 },
|
424
|
{ 5, 18,18,18,18,18 },
|
425
|
|
426
|
{ 6, 18,18,18,18,18 },
|
427
|
{ 7, 18,18,18,18,18 },
|
428
|
{ 8, 18,18,18,18,18 },
|
429
|
{ 9, 18,18,18,18,18 },
|
430
|
{ 10, 18,18,18,18,18 },
|
431
|
{ 11, 18,18,18,18,18 },
|
432
|
|
433
|
{ 16,14, 18,18,18,18 },
|
434
|
{ 16,12, 18,18,18,18 },
|
435
|
{ 16,15, 18,18,18,18 },
|
436
|
{ 16,13, 18,18,18,18 },
|
437
|
{ 12,14, 18,18,18,18 },
|
438
|
{ 15,12, 18,18,18,18 },
|
439
|
{ 15,13, 18,18,18,18 },
|
440
|
{ 13,14, 18,18,18,18 },
|
441
|
{ 14,17, 18,18,18,18 },
|
442
|
{ 12,17, 18,18,18,18 },
|
443
|
{ 17,15, 18,18,18,18 },
|
444
|
{ 13,17, 18,18,18,18 },
|
445
|
};
|
446
|
}
|
447
|
|
448
|
return mFaceMap[cubit][cubitface];
|
449
|
}
|
450
|
|
451
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
452
|
|
453
|
protected ObjectSticker retSticker(int face)
|
454
|
{
|
455
|
if( mStickers==null )
|
456
|
{
|
457
|
float[][] STICKERS = new float[][]
|
458
|
{
|
459
|
{ -0.5f, 0.1428f, -0.1428f, 0.5f, 0.35f, -0.35f },
|
460
|
{ -0.5f, 0.0f, 0.0f, -0.5f, 0.5f, 0.0f, 0.0f, 0.5f },
|
461
|
{ -0.525f, 0.105f, 0.525f, 0.105f, 0.000f, -0.210f }
|
462
|
};
|
463
|
|
464
|
final float F = (float)(Math.PI/20);
|
465
|
final float R1= 0.02f;
|
466
|
final float R2= 0.09f;
|
467
|
final float R3= 0.06f;
|
468
|
final float[][] angles = { { -F/2,F,F },null,{ F/10,-F,-F } };
|
469
|
final float[][] radii = { {R1,R1,R1},{R2,R2,R2,R2},{0,0,R3} };
|
470
|
final float[] strokes = { 0.06f, 0.07f, 0.05f };
|
471
|
|
472
|
if( ObjectControl.isInIconMode() )
|
473
|
{
|
474
|
float mult = 1.5f;
|
475
|
strokes[0]*=mult;
|
476
|
strokes[1]*=mult;
|
477
|
strokes[2]*=mult;
|
478
|
}
|
479
|
|
480
|
mStickers = new ObjectSticker[STICKERS.length];
|
481
|
|
482
|
for(int s=0; s<STICKERS.length; s++)
|
483
|
{
|
484
|
mStickers[s] = new ObjectSticker(STICKERS[s],angles[s],radii[s],strokes[s]);
|
485
|
}
|
486
|
}
|
487
|
|
488
|
return mStickers[face/NUM_FACE_COLORS];
|
489
|
}
|
490
|
|
491
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
492
|
// PUBLIC API
|
493
|
|
494
|
public Static3D[] getRotationAxis()
|
495
|
{
|
496
|
return ROT_AXIS;
|
497
|
}
|
498
|
|
499
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
500
|
|
501
|
public int[] getBasicAngle()
|
502
|
{
|
503
|
if( mBasicAngle ==null ) mBasicAngle = new int[] { 3,3,3,3 };
|
504
|
return mBasicAngle;
|
505
|
}
|
506
|
|
507
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
508
|
|
509
|
public ObjectType intGetObjectType(int[] numLayers)
|
510
|
{
|
511
|
return ObjectType.REX_3;
|
512
|
}
|
513
|
|
514
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
515
|
|
516
|
public int getObjectName(int[] numLayers)
|
517
|
{
|
518
|
return R.string.rex3;
|
519
|
}
|
520
|
|
521
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
522
|
|
523
|
public int getInventor(int[] numLayers)
|
524
|
{
|
525
|
return R.string.rex3_inventor;
|
526
|
}
|
527
|
|
528
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
529
|
|
530
|
public int getYearOfInvention(int[] numLayers)
|
531
|
{
|
532
|
return 2009;
|
533
|
}
|
534
|
|
535
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
536
|
|
537
|
public int getComplexity(int[] numLayers)
|
538
|
{
|
539
|
return 3;
|
540
|
}
|
541
|
}
|