Project

General

Profile

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

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

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.type.Static3D;
28
import org.distorted.library.type.Static4D;
29

    
30
import org.distorted.objectlib.R;
31
import org.distorted.objectlib.main.Movement6;
32
import org.distorted.objectlib.main.ObjectControl;
33
import org.distorted.objectlib.main.ObjectType;
34
import org.distorted.objectlib.helpers.ObjectShape;
35
import org.distorted.objectlib.helpers.ObjectSticker;
36
import org.distorted.objectlib.helpers.ScrambleState;
37
import org.distorted.objectlib.main.Twisty6;
38

    
39
///////////////////////////////////////////////////////////////////////////////////////////////////
40

    
41
public class TwistySkewb extends Twisty6
42
{
43
  static final Static3D[] ROT_AXIS = new Static3D[]
44
         {
45
           new Static3D(+SQ3/3,+SQ3/3,+SQ3/3),
46
           new Static3D(+SQ3/3,+SQ3/3,-SQ3/3),
47
           new Static3D(+SQ3/3,-SQ3/3,+SQ3/3),
48
           new Static3D(+SQ3/3,-SQ3/3,-SQ3/3)
49
         };
50

    
51
  private ScrambleState[] mStates;
52
  private int[] mBasicAngle;
53
  private Static4D[] mQuats;
54
  private float[][] mCuts;
55
  private int[][] mCornerMap,mEdgeMap,mCenterMap;
56
  private ObjectSticker[] mStickers;
57

    
58
///////////////////////////////////////////////////////////////////////////////////////////////////
59

    
60
  public TwistySkewb(int[] numL, Static4D quat, Static3D move, Resources res)
61
    {
62
    super(numL, 2*numL[0]-2, quat, move, res);
63
    }
64

    
65
///////////////////////////////////////////////////////////////////////////////////////////////////
66

    
67
  public ScrambleState[] getScrambleStates()
68
    {
69
    if( mStates==null )
70
      {
71
      int[] numLayers = getNumLayers();
72
      int numL = numLayers[0];
73

    
74
      int[] tmp = {0,-1,0, 0,1,0, numL-1,-1,0, numL-1,1,0 };
75

    
76
      mStates = new ScrambleState[]
77
        {
78
        new ScrambleState( new int[][] {tmp,tmp,tmp,tmp} )
79
        };
80
      }
81

    
82
    return mStates;
83
    }
84

    
85
///////////////////////////////////////////////////////////////////////////////////////////////////
86

    
87
  protected int getResource(int[] numLayers)
88
    {
89
    switch(numLayers[0])
90
      {
91
      case 2: return R.raw.skew_2;
92
      case 3: return R.raw.skew_3;
93
      }
94

    
95
    return 0;
96
    }
97

    
98
///////////////////////////////////////////////////////////////////////////////////////////////////
99

    
100
  private void initializeQuats()
101
    {
102
    mQuats = new Static4D[]
103
         {
104
         new Static4D(  0.0f,  0.0f,  0.0f,  1.0f ),
105
         new Static4D(  1.0f,  0.0f,  0.0f,  0.0f ),
106
         new Static4D(  0.0f,  1.0f,  0.0f,  0.0f ),
107
         new Static4D(  0.0f,  0.0f,  1.0f,  0.0f ),
108

    
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
         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
         };
118
    }
119

    
120
///////////////////////////////////////////////////////////////////////////////////////////////////
121

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

    
129
///////////////////////////////////////////////////////////////////////////////////////////////////
130

    
131
  private int getNumCorners()
132
    {
133
    return 8;
134
    }
135

    
136
///////////////////////////////////////////////////////////////////////////////////////////////////
137

    
138
  private int getNumEdges(int numLayers)
139
    {
140
    return (numLayers-2)*12;
141
    }
142

    
143
///////////////////////////////////////////////////////////////////////////////////////////////////
144

    
145
  private int getNumCentersPerFace(int numLayers)
146
    {
147
    return ((numLayers-2)*(numLayers-2) + (numLayers-1)*(numLayers-1));
148
    }
149

    
150
///////////////////////////////////////////////////////////////////////////////////////////////////
151

    
152
  public Static4D[] getQuats()
153
    {
154
    if( mQuats==null ) initializeQuats();
155
    return mQuats;
156
    }
157

    
158
///////////////////////////////////////////////////////////////////////////////////////////////////
159

    
160
  public int getSolvedFunctionIndex()
161
    {
162
    return 0;
163
    }
164

    
165
///////////////////////////////////////////////////////////////////////////////////////////////////
166

    
167
  public int getNumStickerTypes(int[] numLayers)
168
    {
169
    return 3;
170
    }
171

    
172
///////////////////////////////////////////////////////////////////////////////////////////////////
173

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

    
182
    return mCuts;
183
    }
184

    
185
///////////////////////////////////////////////////////////////////////////////////////////////////
186

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

    
194
    return layerRotatable;
195
    }
196

    
197
///////////////////////////////////////////////////////////////////////////////////////////////////
198

    
199
  public int getMovementType()
200
    {
201
    return MOVEMENT_HEXAHEDRON;
202
    }
203

    
204
///////////////////////////////////////////////////////////////////////////////////////////////////
205

    
206
  public int getMovementSplit()
207
    {
208
    return TYPE_SPLIT_CORNER;
209
    }
210

    
211
///////////////////////////////////////////////////////////////////////////////////////////////////
212

    
213
  public int[][][] getEnabled()
214
    {
215
    return new int[][][]
216
      {
217
          {{0,1},{3,1},{2,3},{0,2}},
218
          {{2,3},{3,1},{0,1},{0,2}},
219
          {{1,2},{0,1},{0,3},{2,3}},
220
          {{1,2},{2,3},{0,3},{0,1}},
221
          {{0,3},{0,2},{1,2},{1,3}},
222
          {{1,2},{0,2},{0,3},{1,3}},
223
      };
224
    }
225

    
226
///////////////////////////////////////////////////////////////////////////////////////////////////
227

    
228
  public float[] getDist3D(int[] numLayers)
229
    {
230
    return null;
231
    }
232

    
233
///////////////////////////////////////////////////////////////////////////////////////////////////
234

    
235
  public int getNumCubitFaces()
236
    {
237
    return 6;
238
    }
239

    
240
///////////////////////////////////////////////////////////////////////////////////////////////////
241

    
242
  public float[][] getCubitPositions(int[] numLayers)
243
    {
244
    int numL = numLayers[0];
245
    final float DIST_CORNER = numL-1;
246
    final float DIST_EDGE   = numL-1;
247
    final float DIST_CENTER = numL-1;
248

    
249
    final int numCorners = getNumCorners();
250
    final int numEdges   = getNumEdges(numL);
251
    final int numCenters = 6*getNumCentersPerFace(numL);
252

    
253
    final float[][] CENTERS = new float[numCorners+numEdges+numCenters][];
254

    
255
    /// CORNERS //////////////////////////////////////////////
256

    
257
    CENTERS[0] = new float[] { DIST_CORNER, DIST_CORNER, DIST_CORNER };
258
    CENTERS[1] = new float[] { DIST_CORNER, DIST_CORNER,-DIST_CORNER };
259
    CENTERS[2] = new float[] { DIST_CORNER,-DIST_CORNER, DIST_CORNER };
260
    CENTERS[3] = new float[] { DIST_CORNER,-DIST_CORNER,-DIST_CORNER };
261
    CENTERS[4] = new float[] {-DIST_CORNER, DIST_CORNER, DIST_CORNER };
262
    CENTERS[5] = new float[] {-DIST_CORNER, DIST_CORNER,-DIST_CORNER };
263
    CENTERS[6] = new float[] {-DIST_CORNER,-DIST_CORNER, DIST_CORNER };
264
    CENTERS[7] = new float[] {-DIST_CORNER,-DIST_CORNER,-DIST_CORNER };
265

    
266
    /// EDGES ///////////////////////////////////////////////
267

    
268
    final float[][]  edgeTable =
269
        {
270
            {0,+DIST_EDGE,+DIST_EDGE},
271
            {+DIST_EDGE,0,+DIST_EDGE},
272
            {0,-DIST_EDGE,+DIST_EDGE},
273
            {-DIST_EDGE,0,+DIST_EDGE},
274
            {+DIST_EDGE,+DIST_EDGE,0},
275
            {+DIST_EDGE,-DIST_EDGE,0},
276
            {-DIST_EDGE,-DIST_EDGE,0},
277
            {-DIST_EDGE,+DIST_EDGE,0},
278
            {0,+DIST_EDGE,-DIST_EDGE},
279
            {+DIST_EDGE,0,-DIST_EDGE},
280
            {0,-DIST_EDGE,-DIST_EDGE},
281
            {-DIST_EDGE,0,-DIST_EDGE}
282
        };
283

    
284
    int index=8;
285

    
286
    for (float[] edges : edgeTable)
287
      {
288
      float c = 3-numL;
289

    
290
      for (int j=0; j<numL-2; j++, c+=2, index++)
291
        {
292
        CENTERS[index] = new float[] { edges[0]==0 ? c : edges[0] ,
293
                                       edges[1]==0 ? c : edges[1] ,
294
                                       edges[2]==0 ? c : edges[2] };
295
        }
296
      }
297

    
298
    /// CENTERS //////////////////////////////////////////////
299

    
300
    final float X= -1000.0f;
301
    final float Y= -1001.0f;
302

    
303
    final float[][]  centerTable =
304
        {
305
            {+DIST_CENTER,X,Y},
306
            {-DIST_CENTER,X,Y},
307
            {X,+DIST_CENTER,Y},
308
            {X,-DIST_CENTER,Y},
309
            {X,Y,+DIST_CENTER},
310
            {X,Y,-DIST_CENTER}
311
        };
312

    
313
    float x,y, cen0, cen1, cen2;
314

    
315
    for( float[] centers : centerTable )
316
      {
317
      x = 2-numL;
318

    
319
      for(int i=0; i<numL-1; i++, x+=2)
320
        {
321
        y = 2-numL;
322

    
323
        for(int j=0; j<numL-1; j++, y+=2, index++)
324
          {
325
               if( centers[0]==Y ) cen0 = y;
326
          else if( centers[0]==X ) cen0 = x;
327
          else                     cen0 = centers[0];
328

    
329
               if( centers[1]==Y ) cen1 = y;
330
          else if( centers[1]==X ) cen1 = x;
331
          else                     cen1 = centers[1];
332

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

    
337
          CENTERS[index] = new float[] {cen0,cen1,cen2};
338
          }
339
        }
340

    
341
      x = 3-numL;
342

    
343
      for(int i=0; i<numL-2; i++, x+=2)
344
        {
345
        y = 3-numL;
346

    
347
        for(int j=0; j<numL-2; j++, y+=2, index++)
348
          {
349
               if( centers[0]==Y ) cen0 = y;
350
          else if( centers[0]==X ) cen0 = x;
351
          else                     cen0 = centers[0];
352

    
353
               if( centers[1]==Y ) cen1 = y;
354
          else if( centers[1]==X ) cen1 = x;
355
          else                     cen1 = centers[1];
356

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

    
361
          CENTERS[index] = new float[] {cen0,cen1,cen2};
362
          }
363
        }
364
      }
365

    
366
    return CENTERS;
367
    }
368

    
369
///////////////////////////////////////////////////////////////////////////////////////////////////
370

    
371
  public Static4D getQuat(int cubit, int[] numLayers)
372
    {
373
    if( mQuats==null ) initializeQuats();
374

    
375
    int numL = numLayers[0];
376
    int numCorners = getNumCorners();
377
    int numEdges   = getNumEdges(numL);
378

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

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

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

    
428
    return null;
429
    }
430

    
431
///////////////////////////////////////////////////////////////////////////////////////////////////
432

    
433
  public ObjectShape getObjectShape(int variant)
434
    {
435
    int numL = getNumLayers()[0];
436

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

    
482
///////////////////////////////////////////////////////////////////////////////////////////////////
483

    
484
  public int getNumCubitVariants(int[] numLayers)
485
    {
486
    return 3;
487
    }
488

    
489
///////////////////////////////////////////////////////////////////////////////////////////////////
490

    
491
  public int getCubitVariant(int cubit, int[] numLayers)
492
    {
493
    int numCorners = getNumCorners();
494
    if( cubit<numCorners ) return 0;
495
    int numEdges = getNumEdges(numLayers[0]);
496
    return cubit<numCorners+numEdges ? 1:2;
497
    }
498

    
499
///////////////////////////////////////////////////////////////////////////////////////////////////
500

    
501
  public int getVariantFaceColor(int variant, int face, int[] numLayers)
502
    {
503
    return variant;
504
    }
505

    
506
///////////////////////////////////////////////////////////////////////////////////////////////////
507

    
508
  public int getCubitFaceColor(int cubit, int face, int[] numLayers)
509
    {
510
    if( mCornerMap==null || mEdgeMap==null || mCenterMap==null )
511
      {
512
      mCornerMap = new int[][]
513
         {
514
           { 4, 2, 0, -1,-1,-1 },
515
           { 2, 5, 0, -1,-1,-1 },
516
           { 3, 4, 0, -1,-1,-1 },
517
           { 5, 3, 0, -1,-1,-1 },
518
           { 1, 2, 4, -1,-1,-1 },
519
           { 5, 2, 1, -1,-1,-1 },
520
           { 4, 3, 1, -1,-1,-1 },
521
           { 1, 3, 5, -1,-1,-1 },
522
         };
523

    
524
      mEdgeMap = new int[][]
525
         {
526
           { 4, 2, -1,-1,-1,-1 },
527
           { 0, 4, -1,-1,-1,-1 },
528
           { 4, 3, -1,-1,-1,-1 },
529
           { 1, 4, -1,-1,-1,-1 },
530
           { 2, 0, -1,-1,-1,-1 },
531
           { 3, 0, -1,-1,-1,-1 },
532
           { 3, 1, -1,-1,-1,-1 },
533
           { 2, 1, -1,-1,-1,-1 },
534
           { 5, 2, -1,-1,-1,-1 },
535
           { 0, 5, -1,-1,-1,-1 },
536
           { 5, 3, -1,-1,-1,-1 },
537
           { 1, 5, -1,-1,-1,-1 }
538
         };
539

    
540
      mCenterMap = new int[][]
541
         {
542
           { 0, -1,-1,-1,-1,-1 },
543
           { 1, -1,-1,-1,-1,-1 },
544
           { 2, -1,-1,-1,-1,-1 },
545
           { 3, -1,-1,-1,-1,-1 },
546
           { 4, -1,-1,-1,-1,-1 },
547
           { 5, -1,-1,-1,-1,-1 },
548
         };
549
      }
550

    
551
    int numL = numLayers[0];
552
    int numCorners = getNumCorners();
553
    int numEdges   = getNumEdges(numL);
554

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

    
571
///////////////////////////////////////////////////////////////////////////////////////////////////
572

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

    
584
      final float R1 = 0.025f;
585
      final float R2 = 0.025f;
586
      final float R3 = 0.055f;
587
      final float[][] radii  = { { R1,R1,R1 },{ R2,R2,R2 },{ R3,R3,R3,R3 } };
588
      final float[] strokes = { 0.05f, 0.04f, 0.04f };
589

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

    
599
      mStickers = new ObjectSticker[STICKERS.length];
600

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

    
607
    return mStickers[sticker];
608
    }
609

    
610
///////////////////////////////////////////////////////////////////////////////////////////////////
611
// PUBLIC API
612

    
613
  public Static3D[] getRotationAxis()
614
    {
615
    return ROT_AXIS;
616
    }
617

    
618
///////////////////////////////////////////////////////////////////////////////////////////////////
619

    
620
  public int[] getBasicAngle()
621
    {
622
    if( mBasicAngle ==null ) mBasicAngle = new int[] { 3,3,3,3 };
623
    return mBasicAngle;
624
    }
625

    
626
///////////////////////////////////////////////////////////////////////////////////////////////////
627

    
628
  public ObjectType intGetObjectType(int[] numLayers)
629
    {
630
    switch(numLayers[0])
631
      {
632
      case 2: return ObjectType.SKEW_2;
633
      case 3: return ObjectType.SKEW_3;
634
      }
635

    
636
    return ObjectType.SKEW_2;
637
    }
638

    
639
///////////////////////////////////////////////////////////////////////////////////////////////////
640

    
641
  public String getObjectName()
642
    {
643
    switch(getNumLayers()[0])
644
      {
645
      case 2: return "Skewb";
646
      case 3: return "Master Skewb";
647
      }
648
    return "Skewb";
649
    }
650

    
651
///////////////////////////////////////////////////////////////////////////////////////////////////
652

    
653
  public String getInventor()
654
    {
655
    switch(getNumLayers()[0])
656
      {
657
      case 2: return "Tony Durham";
658
      case 3: return "Katsuhiko Okamoto";
659
      }
660
    return "Tony Durham";
661
    }
662

    
663
///////////////////////////////////////////////////////////////////////////////////////////////////
664

    
665
  public int getYearOfInvention()
666
    {
667
    switch(getNumLayers()[0])
668
      {
669
      case 2: return 1982;
670
      case 3: return 2003;
671
      }
672
    return 1982;
673
    }
674

    
675
///////////////////////////////////////////////////////////////////////////////////////////////////
676

    
677
  public int getComplexity()
678
    {
679
    switch(getNumLayers()[0])
680
      {
681
      case 2: return 4;
682
      case 3: return 8;
683
      }
684
    return 5;
685
    }
686
}
(21-21/25)