Project

General

Profile

Download (22.5 KB) Statistics
| Branch: | Revision:

distorted-objectlib / src / main / java / org / distorted / objectlib / objects / TwistySkewb.java @ 7b832206

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 TwistySkewb 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
  private ScrambleState[] mStates;
55
  private int[] mBasicAngle;
56
  private Static4D[] mQuats;
57
  private float[][] mCuts;
58
  private int[][] mCornerMap,mEdgeMap,mCenterMap;
59
  private ObjectSticker[] mStickers;
60

    
61
///////////////////////////////////////////////////////////////////////////////////////////////////
62

    
63
  public TwistySkewb(int[] numL, Static4D quat, Static3D move, DistortedTexture texture,
64
                     MeshSquare mesh, DistortedEffects effects, Resources res, int surfaceW, int surfaceH)
65
    {
66
    super(numL, 2*numL[0]-2, quat, move, texture, mesh, effects, res, surfaceW, surfaceH);
67
    }
68

    
69
///////////////////////////////////////////////////////////////////////////////////////////////////
70

    
71
  public ScrambleState[] getScrambleStates()
72
    {
73
    if( mStates==null )
74
      {
75
      int[] numLayers = getNumLayers();
76
      int numL = numLayers[0];
77

    
78
      int[] tmp = {0,-1,0, 0,1,0, numL-1,-1,0, numL-1,1,0 };
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
  protected int getResource(int[] numLayers)
92
    {
93
    switch(numLayers[0])
94
      {
95
      case 2: return R.raw.skew2;
96
      case 3: return R.raw.skew3;
97
      }
98

    
99
    return 0;
100
    }
101

    
102
///////////////////////////////////////////////////////////////////////////////////////////////////
103

    
104
  private void initializeQuats()
105
    {
106
    mQuats = new Static4D[]
107
         {
108
         new Static4D(  0.0f,  0.0f,  0.0f,  1.0f ),
109
         new Static4D(  1.0f,  0.0f,  0.0f,  0.0f ),
110
         new Static4D(  0.0f,  1.0f,  0.0f,  0.0f ),
111
         new Static4D(  0.0f,  0.0f,  1.0f,  0.0f ),
112

    
113
         new Static4D(  0.5f,  0.5f,  0.5f,  0.5f ),
114
         new Static4D(  0.5f,  0.5f,  0.5f, -0.5f ),
115
         new Static4D(  0.5f,  0.5f, -0.5f,  0.5f ),
116
         new Static4D(  0.5f,  0.5f, -0.5f, -0.5f ),
117
         new Static4D(  0.5f, -0.5f,  0.5f,  0.5f ),
118
         new Static4D(  0.5f, -0.5f,  0.5f, -0.5f ),
119
         new Static4D(  0.5f, -0.5f, -0.5f,  0.5f ),
120
         new Static4D(  0.5f, -0.5f, -0.5f, -0.5f )
121
         };
122
    }
123

    
124
///////////////////////////////////////////////////////////////////////////////////////////////////
125

    
126
  public int[] getSolvedQuats(int cubit, int[] numLayers)
127
    {
128
    if( mQuats==null ) initializeQuats();
129
    int status = retCubitSolvedStatus(cubit,numLayers);
130
    return status<0 ? null : buildSolvedQuats(Movement6.FACE_AXIS[status],mQuats);
131
    }
132

    
133
///////////////////////////////////////////////////////////////////////////////////////////////////
134

    
135
  private int getNumCorners()
136
    {
137
    return 8;
138
    }
139

    
140
///////////////////////////////////////////////////////////////////////////////////////////////////
141

    
142
  private int getNumEdges(int numLayers)
143
    {
144
    return (numLayers-2)*12;
145
    }
146

    
147
///////////////////////////////////////////////////////////////////////////////////////////////////
148

    
149
  private int getNumCentersPerFace(int numLayers)
150
    {
151
    return ((numLayers-2)*(numLayers-2) + (numLayers-1)*(numLayers-1));
152
    }
153

    
154
///////////////////////////////////////////////////////////////////////////////////////////////////
155

    
156
  public Static4D[] getQuats()
157
    {
158
    if( mQuats==null ) initializeQuats();
159
    return mQuats;
160
    }
161

    
162
///////////////////////////////////////////////////////////////////////////////////////////////////
163

    
164
  public int getSolvedFunctionIndex()
165
    {
166
    return 0;
167
    }
168

    
169
///////////////////////////////////////////////////////////////////////////////////////////////////
170

    
171
  public int getNumStickerTypes(int[] numLayers)
172
    {
173
    return 3;
174
    }
175

    
176
///////////////////////////////////////////////////////////////////////////////////////////////////
177

    
178
  public float[][] getCuts(int[] numLayers)
179
    {
180
    if( mCuts==null )
181
      {
182
      float[] c = numLayers[0]==2 ? (new float[] {0.0f}) : (new float[] {-SQ3/6,+SQ3/6});
183
      mCuts = new float[][] {c,c,c,c};
184
      }
185

    
186
    return mCuts;
187
    }
188

    
189
///////////////////////////////////////////////////////////////////////////////////////////////////
190

    
191
  public boolean[][] getLayerRotatable(int[] numLayers)
192
    {
193
    int numAxis = ROT_AXIS.length;
194
    boolean[] tmp = numLayers[0]==2 ? (new boolean[] {true,true}) : (new boolean[] {true,false,true});
195
    boolean[][] layerRotatable = new boolean[numAxis][];
196
    for(int i=0; i<numAxis; i++) layerRotatable[i] = tmp;
197

    
198
    return layerRotatable;
199
    }
200

    
201
///////////////////////////////////////////////////////////////////////////////////////////////////
202

    
203
  public int getMovementType()
204
    {
205
    return MOVEMENT_HEXAHEDRON;
206
    }
207

    
208
///////////////////////////////////////////////////////////////////////////////////////////////////
209

    
210
  public int getMovementSplit()
211
    {
212
    return TYPE_SPLIT_CORNER;
213
    }
214

    
215
///////////////////////////////////////////////////////////////////////////////////////////////////
216

    
217
  public int[][][] getEnabled()
218
    {
219
    return new int[][][]
220
      {
221
          {{0,1},{3,1},{2,3},{0,2}},
222
          {{2,3},{3,1},{0,1},{0,2}},
223
          {{1,2},{0,1},{0,3},{2,3}},
224
          {{1,2},{2,3},{0,3},{0,1}},
225
          {{0,3},{0,2},{1,2},{1,3}},
226
          {{1,2},{0,2},{0,3},{1,3}},
227
      };
228
    }
229

    
230
///////////////////////////////////////////////////////////////////////////////////////////////////
231

    
232
  public float[] getDist3D(int[] numLayers)
233
    {
234
    return null;
235
    }
236

    
237
///////////////////////////////////////////////////////////////////////////////////////////////////
238

    
239
  protected int getNumCubitFaces()
240
    {
241
    return 6;
242
    }
243

    
244
///////////////////////////////////////////////////////////////////////////////////////////////////
245

    
246
  public float[][] getCubitPositions(int[] numLayers)
247
    {
248
    int numL = numLayers[0];
249
    final float DIST_CORNER = numL-1;
250
    final float DIST_EDGE   = numL-1;
251
    final float DIST_CENTER = numL-1;
252

    
253
    final int numCorners = getNumCorners();
254
    final int numEdges   = getNumEdges(numL);
255
    final int numCenters = 6*getNumCentersPerFace(numL);
256

    
257
    final float[][] CENTERS = new float[numCorners+numEdges+numCenters][];
258

    
259
    /// CORNERS //////////////////////////////////////////////
260

    
261
    CENTERS[0] = new float[] { DIST_CORNER, DIST_CORNER, DIST_CORNER };
262
    CENTERS[1] = new float[] { DIST_CORNER, DIST_CORNER,-DIST_CORNER };
263
    CENTERS[2] = new float[] { DIST_CORNER,-DIST_CORNER, DIST_CORNER };
264
    CENTERS[3] = new float[] { DIST_CORNER,-DIST_CORNER,-DIST_CORNER };
265
    CENTERS[4] = new float[] {-DIST_CORNER, DIST_CORNER, DIST_CORNER };
266
    CENTERS[5] = new float[] {-DIST_CORNER, DIST_CORNER,-DIST_CORNER };
267
    CENTERS[6] = new float[] {-DIST_CORNER,-DIST_CORNER, DIST_CORNER };
268
    CENTERS[7] = new float[] {-DIST_CORNER,-DIST_CORNER,-DIST_CORNER };
269

    
270
    /// EDGES ///////////////////////////////////////////////
271

    
272
    final float[][]  edgeTable =
273
        {
274
            {0,+DIST_EDGE,+DIST_EDGE},
275
            {+DIST_EDGE,0,+DIST_EDGE},
276
            {0,-DIST_EDGE,+DIST_EDGE},
277
            {-DIST_EDGE,0,+DIST_EDGE},
278
            {+DIST_EDGE,+DIST_EDGE,0},
279
            {+DIST_EDGE,-DIST_EDGE,0},
280
            {-DIST_EDGE,-DIST_EDGE,0},
281
            {-DIST_EDGE,+DIST_EDGE,0},
282
            {0,+DIST_EDGE,-DIST_EDGE},
283
            {+DIST_EDGE,0,-DIST_EDGE},
284
            {0,-DIST_EDGE,-DIST_EDGE},
285
            {-DIST_EDGE,0,-DIST_EDGE}
286
        };
287

    
288
    int index=8;
289

    
290
    for (float[] edges : edgeTable)
291
      {
292
      float c = 3-numL;
293

    
294
      for (int j=0; j<numL-2; j++, c+=2, index++)
295
        {
296
        CENTERS[index] = new float[] { edges[0]==0 ? c : edges[0] ,
297
                                       edges[1]==0 ? c : edges[1] ,
298
                                       edges[2]==0 ? c : edges[2] };
299
        }
300
      }
301

    
302
    /// CENTERS //////////////////////////////////////////////
303

    
304
    final float X= -1000.0f;
305
    final float Y= -1001.0f;
306

    
307
    final float[][]  centerTable =
308
        {
309
            {+DIST_CENTER,X,Y},
310
            {-DIST_CENTER,X,Y},
311
            {X,+DIST_CENTER,Y},
312
            {X,-DIST_CENTER,Y},
313
            {X,Y,+DIST_CENTER},
314
            {X,Y,-DIST_CENTER}
315
        };
316

    
317
    float x,y, cen0, cen1, cen2;
318

    
319
    for( float[] centers : centerTable )
320
      {
321
      x = 2-numL;
322

    
323
      for(int i=0; i<numL-1; i++, x+=2)
324
        {
325
        y = 2-numL;
326

    
327
        for(int j=0; j<numL-1; j++, y+=2, index++)
328
          {
329
               if( centers[0]==Y ) cen0 = y;
330
          else if( centers[0]==X ) cen0 = x;
331
          else                     cen0 = centers[0];
332

    
333
               if( centers[1]==Y ) cen1 = y;
334
          else if( centers[1]==X ) cen1 = x;
335
          else                     cen1 = centers[1];
336

    
337
               if( centers[2]==Y ) cen2 = y;
338
          else if( centers[2]==X ) cen2 = x;
339
          else                     cen2 = centers[2];
340

    
341
          CENTERS[index] = new float[] {cen0,cen1,cen2};
342
          }
343
        }
344

    
345
      x = 3-numL;
346

    
347
      for(int i=0; i<numL-2; i++, x+=2)
348
        {
349
        y = 3-numL;
350

    
351
        for(int j=0; j<numL-2; j++, y+=2, index++)
352
          {
353
               if( centers[0]==Y ) cen0 = y;
354
          else if( centers[0]==X ) cen0 = x;
355
          else                     cen0 = centers[0];
356

    
357
               if( centers[1]==Y ) cen1 = y;
358
          else if( centers[1]==X ) cen1 = x;
359
          else                     cen1 = centers[1];
360

    
361
               if( centers[2]==Y ) cen2 = y;
362
          else if( centers[2]==X ) cen2 = x;
363
          else                     cen2 = centers[2];
364

    
365
          CENTERS[index] = new float[] {cen0,cen1,cen2};
366
          }
367
        }
368
      }
369

    
370
    return CENTERS;
371
    }
372

    
373
///////////////////////////////////////////////////////////////////////////////////////////////////
374

    
375
  public Static4D getQuat(int cubit, int[] numLayers)
376
    {
377
    if( mQuats==null ) initializeQuats();
378

    
379
    int numL = numLayers[0];
380
    int numCorners = getNumCorners();
381
    int numEdges   = getNumEdges(numL);
382

    
383
    if( cubit<numCorners )
384
      {
385
      switch(cubit)
386
        {
387
        case  0: return mQuats[0];                         //  unit quat
388
        case  1: return new Static4D( SQ2/2,0,0,SQ2/2);    //  90 along X
389
        case  2: return new Static4D(-SQ2/2,0,0,SQ2/2);    // -90 along X
390
        case  3: return mQuats[1];                         // 180 along X
391
        case  4: return new Static4D(0, SQ2/2,0,SQ2/2);    //  90 along Y
392
        case  5: return mQuats[2];                         // 180 along Y
393
        case  6: return mQuats[3];                         // 180 along Z
394
        case  7: return new Static4D(SQ2/2,0,-SQ2/2,0);    // 180 along (SQ2/2,0,-SQ2/2)
395
        }
396
      }
397
    else if( cubit<numCorners+numEdges )
398
      {
399
      int edge = (cubit-numCorners)/(numL-2);
400

    
401
      switch(edge)
402
        {
403
        case  0: return mQuats[ 0];
404
        case  1: return mQuats[ 5];
405
        case  2: return mQuats[ 3];
406
        case  3: return mQuats[11];
407
        case  4: return mQuats[ 4];
408
        case  5: return mQuats[ 7];
409
        case  6: return mQuats[ 9];
410
        case  7: return mQuats[10];
411
        case  8: return mQuats[ 2];
412
        case  9: return mQuats[ 8];
413
        case 10: return mQuats[ 1];
414
        case 11: return mQuats[ 6];
415
        }
416
      }
417
    else
418
      {
419
      int center = (cubit-numCorners-numEdges)/getNumCentersPerFace(numL);
420

    
421
      switch(center)
422
        {
423
        case 0: return new Static4D(0,-SQ2/2,0,SQ2/2);    // -90 along Y
424
        case 1: return new Static4D(0, SQ2/2,0,SQ2/2);    //  90 along Y
425
        case 2: return new Static4D( SQ2/2,0,0,SQ2/2);    //  90 along X
426
        case 3: return new Static4D(-SQ2/2,0,0,SQ2/2);    // -90 along X
427
        case 4: return mQuats[0];                         //  unit quaternion
428
        case 5: return mQuats[1];                         // 180 along X
429
        }
430
      }
431

    
432
    return null;
433
    }
434

    
435
///////////////////////////////////////////////////////////////////////////////////////////////////
436

    
437
  public ObjectShape getObjectShape(int variant)
438
    {
439
    int numL = getNumLayers()[0];
440

    
441
    if( variant==0 )
442
      {
443
      double[][] vertices = new double[][] { {-1,0,0},{0,-1,0},{0,0,-1},{-1,-1,-1},{0,0,0} };
444
      int[][] vert_indices = new int[][] { {0,1,4},{2,0,4},{1,2,4},{3,1,0},{3,2,1},{3,0,2} };
445
      int N = numL==2 ? 7:5;
446
      int E1= numL==2 ? 3:2;
447
      int E2= numL==2 ? 5:3;
448
      float[][] bands     = new float[][] { {0.020f,35,0.16f,0.7f,N,E1,E1}, {0.000f, 0,1.00f,0.0f,3,1,E2} };
449
      int[] bandIndices   = new int[] { 0,0,0,1,1,1 };
450
      float[][] corners   = new float[][] { {0.05f,0.25f}, {0.05f,0.20f} };
451
      int[] cornerIndices = new int[] { 1,1,1,0,0 };
452
      float[][] centers   = new float[][] { {-0.5f, -0.5f, -0.5f} };
453
      int[] centerIndices = new int[] { 0,0,0,-1,0 };
454
      return new ObjectShape(vertices,vert_indices,bands,bandIndices,corners,cornerIndices,centers,centerIndices,getNumCubitFaces(), null);
455
      }
456
    else if( variant==1 )
457
      {
458
      double[][] vertices = new double[][] { {-1,0,0},{1,0,0},{0,-1,0},{0,0,-1} };
459
      int[][] vert_indices = new int[][] { {2,1,0},{3,0,1},{2,3,1},{3,2,0} };
460
      int N = numL==2 ? 7:5;
461
      int E = numL==2 ? 5:2;
462
      float[][] bands     = new float[][] { {0.035f,30,0.16f,0.8f,N,2,E}, {0.020f,45,0.16f,0.2f,3,1,2} };
463
      int[] bandIndices   = new int[] { 0,0,1,1 };
464
      float[][] corners   = new float[][] { {0.07f,0.20f}, {0.02f,0.30f} };
465
      int[] cornerIndices = new int[] { 0,0,1,1 };
466
      float[][] centers   = new float[][] { {0.0f, -0.5f, -0.5f} };
467
      int[] centerIndices = new int[] { 0,0,0,0 };
468
      return new ObjectShape(vertices,vert_indices,bands,bandIndices,corners,cornerIndices,centers,centerIndices,getNumCubitFaces(), null);
469
      }
470
    else
471
      {
472
      double[][] vertices = new double[][] { {-1,0,0},{0,-1,0},{1,0,0},{0,1,0},{0,0,-1} };
473
      int[][] vert_indices = new int[][] { {0,1,2,3},{4,1,0},{4,2,1},{4,3,2},{4,0,3} };
474
      int N = numL==2 ? 7:6;
475
      int E = numL==2 ? 3:1;
476
      float[][] bands     = new float[][] { {0.04f,35,SQ2/8,0.9f,N,E,E}, {0.000f,0,1,0.0f,3,0,0} };
477
      int[] bandIndices   = new int[] { 0,1,1,1,1 };
478
      float[][] corners   = new float[][] { {0.06f,0.15f} };
479
      int[] cornerIndices = new int[] { 0,0,0,0,0 };
480
      float[][] centers   = new float[][] { {0,0,-0.4f} };
481
      int[] centerIndices = new int[] { 0,0,0,0,-1 };
482
      return new ObjectShape(vertices,vert_indices,bands,bandIndices,corners,cornerIndices,centers,centerIndices,getNumCubitFaces(), null);
483
      }
484
    }
485

    
486
///////////////////////////////////////////////////////////////////////////////////////////////////
487

    
488
  public int getNumCubitVariants(int[] numLayers)
489
    {
490
    return 3;
491
    }
492

    
493
///////////////////////////////////////////////////////////////////////////////////////////////////
494

    
495
  public int getCubitVariant(int cubit, int[] numLayers)
496
    {
497
    int numCorners = getNumCorners();
498
    if( cubit<numCorners ) return 0;
499
    int numEdges = getNumEdges(numLayers[0]);
500
    return cubit<numCorners+numEdges ? 1:2;
501
    }
502

    
503
///////////////////////////////////////////////////////////////////////////////////////////////////
504

    
505
  protected int getFaceColor(int cubit, int cubitface, int[] numLayers)
506
    {
507
    if( mCornerMap==null || mEdgeMap==null || mCenterMap==null )
508
      {
509
      mCornerMap = new int[][]
510
         {
511
           {  4, 2, 0, 18,18,18 },
512
           {  2, 5, 0, 18,18,18 },
513
           {  3, 4, 0, 18,18,18 },
514
           {  5, 3, 0, 18,18,18 },
515
           {  1, 2, 4, 18,18,18 },
516
           {  5, 2, 1, 18,18,18 },
517
           {  4, 3, 1, 18,18,18 },
518
           {  1, 3, 5, 18,18,18 },
519
         };
520

    
521
      mEdgeMap = new int[][]
522
         {
523
           { 10, 8, 18,18,18,18 },
524
           {  6,10, 18,18,18,18 },
525
           { 10, 9, 18,18,18,18 },
526
           {  7,10, 18,18,18,18 },
527
           {  8, 6, 18,18,18,18 },
528
           {  9, 6, 18,18,18,18 },
529
           {  9, 7, 18,18,18,18 },
530
           {  8, 7, 18,18,18,18 },
531
           { 11, 8, 18,18,18,18 },
532
           {  6,11, 18,18,18,18 },
533
           { 11, 9, 18,18,18,18 },
534
           {  7,11, 18,18,18,18 }
535
         };
536

    
537
      mCenterMap = new int[][]
538
         {
539
           { 12, 18,18,18,18,18 },
540
           { 13, 18,18,18,18,18 },
541
           { 14, 18,18,18,18,18 },
542
           { 15, 18,18,18,18,18 },
543
           { 16, 18,18,18,18,18 },
544
           { 17, 18,18,18,18,18 },
545
         };
546
      }
547

    
548
    int numL = numLayers[0];
549
    int numCorners = getNumCorners();
550
    int numEdges   = getNumEdges(numL);
551

    
552
    if( cubit<numCorners )
553
      {
554
      return mCornerMap[cubit][cubitface];
555
      }
556
    else if( cubit<numCorners+numEdges )
557
      {
558
      int edge = (cubit-numCorners)/(numL-2);
559
      return mEdgeMap[edge][cubitface];
560
      }
561
    else
562
      {
563
      int center = (cubit-numCorners-numEdges)/getNumCentersPerFace(numL);
564
      return mCenterMap[center][cubitface];
565
      }
566
    }
567

    
568
///////////////////////////////////////////////////////////////////////////////////////////////////
569

    
570
  public ObjectSticker retSticker(int sticker)
571
    {
572
    if( mStickers==null )
573
      {
574
      float[][] STICKERS = new float[][]
575
          {
576
             { -0.5f, 0.25f, 0.25f,  -0.5f, 0.25f, 0.25f  },
577
             { -0.5f, 0.25f, 0.25f,  -0.5f, 0.25f, 0.25f  },
578
             { -0.5f, 0.00f, 0.00f,  -0.5f, 0.50f, 0.0f, 0.0f, 0.5f }
579
          };
580

    
581
      final float R1 = 0.025f;
582
      final float R2 = 0.025f;
583
      final float R3 = 0.055f;
584
      final float[][] radii  = { { R1,R1,R1 },{ R2,R2,R2 },{ R3,R3,R3,R3 } };
585
      final float[] strokes = { 0.05f, 0.04f, 0.04f };
586

    
587
      if( ObjectControl.isInIconMode() )
588
        {
589
        int[] numLayers = getNumLayers();
590
        float mult = numLayers[0]==2 ? 2.0f : 2.7f;
591
        strokes[0]*=mult;
592
        strokes[1]*=mult;
593
        strokes[2]*=mult;
594
        }
595

    
596
      mStickers = new ObjectSticker[STICKERS.length];
597

    
598
      for(int s=0; s<STICKERS.length; s++)
599
        {
600
        mStickers[s] = new ObjectSticker(STICKERS[s],null,radii[s],strokes[s]);
601
        }
602
      }
603

    
604
    return mStickers[sticker];
605
    }
606

    
607
///////////////////////////////////////////////////////////////////////////////////////////////////
608

    
609
  protected int getStickerIndex(int face)
610
    {
611
    return face/NUM_FACE_COLORS;
612
    }
613

    
614
///////////////////////////////////////////////////////////////////////////////////////////////////
615
// PUBLIC API
616

    
617
  public Static3D[] getRotationAxis()
618
    {
619
    return ROT_AXIS;
620
    }
621

    
622
///////////////////////////////////////////////////////////////////////////////////////////////////
623

    
624
  public int[] getBasicAngle()
625
    {
626
    if( mBasicAngle ==null ) mBasicAngle = new int[] { 3,3,3,3 };
627
    return mBasicAngle;
628
    }
629

    
630
///////////////////////////////////////////////////////////////////////////////////////////////////
631

    
632
  public ObjectType intGetObjectType(int[] numLayers)
633
    {
634
    switch(numLayers[0])
635
      {
636
      case 2: return ObjectType.SKEW_2;
637
      case 3: return ObjectType.SKEW_3;
638
      }
639

    
640
    return ObjectType.SKEW_2;
641
    }
642

    
643
///////////////////////////////////////////////////////////////////////////////////////////////////
644

    
645
  public int getObjectName(int[] numLayers)
646
    {
647
    switch(numLayers[0])
648
      {
649
      case 2: return R.string.skew2;
650
      case 3: return R.string.skew3;
651
      }
652
    return R.string.skew2;
653
    }
654

    
655
///////////////////////////////////////////////////////////////////////////////////////////////////
656

    
657
  public int getInventor(int[] numLayers)
658
    {
659
    switch(numLayers[0])
660
      {
661
      case 2: return R.string.skew2_inventor;
662
      case 3: return R.string.skew3_inventor;
663
      }
664
    return R.string.skew2_inventor;
665
    }
666

    
667
///////////////////////////////////////////////////////////////////////////////////////////////////
668

    
669
  public int getYearOfInvention(int[] numLayers)
670
    {
671
    switch(numLayers[0])
672
      {
673
      case 2: return 1982;
674
      case 3: return 2003;
675
      }
676
    return 1982;
677
    }
678

    
679
///////////////////////////////////////////////////////////////////////////////////////////////////
680

    
681
  public int getComplexity(int[] numLayers)
682
    {
683
    switch(numLayers[0])
684
      {
685
      case 2: return 4;
686
      case 3: return 8;
687
      }
688
    return 5;
689
    }
690
}
(21-21/25)