Project

General

Profile

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

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

1 29b82486 Leszek Koltunski
///////////////////////////////////////////////////////////////////////////////////////////////////
2
// Copyright 2020 Leszek Koltunski                                                               //
3
//                                                                                               //
4
// This file is part of Magic Cube.                                                              //
5
//                                                                                               //
6
// Magic Cube is free software: you can redistribute it and/or modify                            //
7
// it under the terms of the GNU General Public License as published by                          //
8
// the Free Software Foundation, either version 2 of the License, or                             //
9
// (at your option) any later version.                                                           //
10
//                                                                                               //
11
// Magic Cube is distributed in the hope that it will be useful,                                 //
12
// but WITHOUT ANY WARRANTY; without even the implied warranty of                                //
13
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the                                 //
14
// GNU General Public License for more details.                                                  //
15
//                                                                                               //
16
// You should have received a copy of the GNU General Public License                             //
17
// along with Magic Cube.  If not, see <http://www.gnu.org/licenses/>.                           //
18
///////////////////////////////////////////////////////////////////////////////////////////////////
19
20
package org.distorted.objectlib.objects;
21
22
import static org.distorted.objectlib.main.Movement.TYPE_SPLIT_CORNER;
23
24
import android.content.res.Resources;
25
26
import org.distorted.library.main.DistortedEffects;
27
import org.distorted.library.main.DistortedTexture;
28
import org.distorted.library.mesh.MeshSquare;
29
import org.distorted.library.type.Static3D;
30
import org.distorted.library.type.Static4D;
31
32
import org.distorted.objectlib.R;
33
import org.distorted.objectlib.main.Movement;
34
import org.distorted.objectlib.main.Movement6;
35 8592461c Leszek Koltunski
import org.distorted.objectlib.main.ObjectControl;
36 8005e762 Leszek Koltunski
import org.distorted.objectlib.main.ObjectType;
37 198c5bf0 Leszek Koltunski
import org.distorted.objectlib.helpers.ObjectShape;
38
import org.distorted.objectlib.helpers.ObjectSticker;
39
import org.distorted.objectlib.helpers.ScrambleState;
40 29b82486 Leszek Koltunski
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 static final int[][][] ENABLED = new int[][][]
55
      {
56
          {{0,1},{3,1},{2,3},{0,2}},
57
          {{2,3},{3,1},{0,1},{0,2}},
58
          {{1,2},{0,1},{0,3},{2,3}},
59
          {{1,2},{2,3},{0,3},{0,1}},
60
          {{0,3},{0,2},{1,2},{1,3}},
61
          {{1,2},{0,2},{0,3},{1,3}},
62
      };
63
64
  private ScrambleState[] mStates;
65
  private int[] mBasicAngle;
66
  private Static4D[] mQuats;
67
  private float[][] mCuts;
68
  private boolean[][] mLayerRotatable;
69
  private int[][] mCornerMap,mEdgeMap,mCenterMap;
70
  private ObjectSticker[] mStickers;
71
  private Movement mMovement;
72
73
///////////////////////////////////////////////////////////////////////////////////////////////////
74
75 a57e6870 Leszek Koltunski
  public TwistySkewb(int[] numL, Static4D quat, Static3D move, DistortedTexture texture,
76 ecf3d6e3 Leszek Koltunski
                     MeshSquare mesh, DistortedEffects effects, Resources res, int scrWidth)
77 29b82486 Leszek Koltunski
    {
78 a57e6870 Leszek Koltunski
    super(numL, 2*numL[0]-2, quat, move, texture, mesh, effects, res, scrWidth);
79 29b82486 Leszek Koltunski
    }
80
81
///////////////////////////////////////////////////////////////////////////////////////////////////
82
83
  protected ScrambleState[] getScrambleStates()
84
    {
85
    if( mStates==null )
86
      {
87 a57e6870 Leszek Koltunski
      int[] numLayers = getNumLayers();
88
      int numL = numLayers[0];
89
90
      int[] tmp = {0,-1,0, 0,1,0, numL-1,-1,0, numL-1,1,0 };
91 29b82486 Leszek Koltunski
92
      mStates = new ScrambleState[]
93
        {
94
        new ScrambleState( new int[][] {tmp,tmp,tmp,tmp} )
95
        };
96
      }
97
98
    return mStates;
99
    }
100
101 4e1dc313 Leszek Koltunski
///////////////////////////////////////////////////////////////////////////////////////////////////
102
103 a57e6870 Leszek Koltunski
  protected int getResource(int[] numLayers)
104 4e1dc313 Leszek Koltunski
    {
105 a57e6870 Leszek Koltunski
    switch(numLayers[0])
106 4e1dc313 Leszek Koltunski
      {
107
      case 2: return R.raw.skew2;
108
      case 3: return R.raw.skew3;
109
      }
110
111
    return 0;
112
    }
113
114 29b82486 Leszek Koltunski
///////////////////////////////////////////////////////////////////////////////////////////////////
115
116
  private void initializeQuats()
117
    {
118
    mQuats = new Static4D[]
119
         {
120
         new Static4D(  0.0f,  0.0f,  0.0f,  1.0f ),
121
         new Static4D(  1.0f,  0.0f,  0.0f,  0.0f ),
122
         new Static4D(  0.0f,  1.0f,  0.0f,  0.0f ),
123
         new Static4D(  0.0f,  0.0f,  1.0f,  0.0f ),
124
125
         new Static4D(  0.5f,  0.5f,  0.5f,  0.5f ),
126
         new Static4D(  0.5f,  0.5f,  0.5f, -0.5f ),
127
         new Static4D(  0.5f,  0.5f, -0.5f,  0.5f ),
128
         new Static4D(  0.5f,  0.5f, -0.5f, -0.5f ),
129
         new Static4D(  0.5f, -0.5f,  0.5f,  0.5f ),
130
         new Static4D(  0.5f, -0.5f,  0.5f, -0.5f ),
131
         new Static4D(  0.5f, -0.5f, -0.5f,  0.5f ),
132
         new Static4D(  0.5f, -0.5f, -0.5f, -0.5f )
133
         };
134
    }
135
136
///////////////////////////////////////////////////////////////////////////////////////////////////
137
138 a57e6870 Leszek Koltunski
  protected int[] getSolvedQuats(int cubit, int[] numLayers)
139 29b82486 Leszek Koltunski
    {
140
    if( mQuats==null ) initializeQuats();
141
    int status = retCubitSolvedStatus(cubit,numLayers);
142
    return status<0 ? null : buildSolvedQuats(Movement6.FACE_AXIS[status],mQuats);
143
    }
144
145
///////////////////////////////////////////////////////////////////////////////////////////////////
146
147
  private int getNumCorners()
148
    {
149
    return 8;
150
    }
151
152
///////////////////////////////////////////////////////////////////////////////////////////////////
153
154 a57e6870 Leszek Koltunski
  private int getNumEdges(int numLayers)
155 29b82486 Leszek Koltunski
    {
156 a57e6870 Leszek Koltunski
    return (numLayers-2)*12;
157 29b82486 Leszek Koltunski
    }
158
159
///////////////////////////////////////////////////////////////////////////////////////////////////
160
161 a57e6870 Leszek Koltunski
  private int getNumCentersPerFace(int numLayers)
162 29b82486 Leszek Koltunski
    {
163 a57e6870 Leszek Koltunski
    return ((numLayers-2)*(numLayers-2) + (numLayers-1)*(numLayers-1));
164 29b82486 Leszek Koltunski
    }
165
166
///////////////////////////////////////////////////////////////////////////////////////////////////
167
168
  protected Static4D[] getQuats()
169
    {
170
    if( mQuats==null ) initializeQuats();
171
    return mQuats;
172
    }
173
174
///////////////////////////////////////////////////////////////////////////////////////////////////
175
176
  protected int getSolvedFunctionIndex()
177
    {
178
    return 0;
179
    }
180
181
///////////////////////////////////////////////////////////////////////////////////////////////////
182
183 a57e6870 Leszek Koltunski
  protected int getNumStickerTypes(int[] numLayers)
184 29b82486 Leszek Koltunski
    {
185
    return 3;
186
    }
187
188
///////////////////////////////////////////////////////////////////////////////////////////////////
189
190 a57e6870 Leszek Koltunski
  protected float[][] getCuts(int[] numLayers)
191 29b82486 Leszek Koltunski
    {
192
    if( mCuts==null )
193
      {
194 a57e6870 Leszek Koltunski
      float[] c = numLayers[0]==2 ? (new float[] {0.0f}) : (new float[] {-SQ3/6,+SQ3/6});
195 29b82486 Leszek Koltunski
      mCuts = new float[][] {c,c,c,c};
196
      }
197
198
    return mCuts;
199
    }
200
201
///////////////////////////////////////////////////////////////////////////////////////////////////
202
203 a57e6870 Leszek Koltunski
  private void getLayerRotatable(int[] numLayers)
204 29b82486 Leszek Koltunski
    {
205
    if( mLayerRotatable==null )
206
      {
207
      int numAxis = ROT_AXIS.length;
208 a57e6870 Leszek Koltunski
      boolean[] tmp = numLayers[0]==2 ? (new boolean[] {true,true}) : (new boolean[] {true,false,true});
209 29b82486 Leszek Koltunski
      mLayerRotatable = new boolean[numAxis][];
210
      for(int i=0; i<numAxis; i++) mLayerRotatable[i] = tmp;
211
      }
212
    }
213
214
///////////////////////////////////////////////////////////////////////////////////////////////////
215
216
  protected int getNumCubitFaces()
217
    {
218
    return 6;
219
    }
220
221
///////////////////////////////////////////////////////////////////////////////////////////////////
222
223 a57e6870 Leszek Koltunski
  protected float[][] getCubitPositions(int[] numLayers)
224 29b82486 Leszek Koltunski
    {
225 a57e6870 Leszek Koltunski
    int numL = numLayers[0];
226
    final float DIST_CORNER = numL-1;
227
    final float DIST_EDGE   = numL-1;
228
    final float DIST_CENTER = numL-1;
229 29b82486 Leszek Koltunski
230
    final int numCorners = getNumCorners();
231 a57e6870 Leszek Koltunski
    final int numEdges   = getNumEdges(numL);
232
    final int numCenters = 6*getNumCentersPerFace(numL);
233 29b82486 Leszek Koltunski
234
    final float[][] CENTERS = new float[numCorners+numEdges+numCenters][];
235
236
    /// CORNERS //////////////////////////////////////////////
237
238
    CENTERS[0] = new float[] { DIST_CORNER, DIST_CORNER, DIST_CORNER };
239
    CENTERS[1] = new float[] { DIST_CORNER, DIST_CORNER,-DIST_CORNER };
240
    CENTERS[2] = new float[] { DIST_CORNER,-DIST_CORNER, DIST_CORNER };
241
    CENTERS[3] = new float[] { DIST_CORNER,-DIST_CORNER,-DIST_CORNER };
242
    CENTERS[4] = new float[] {-DIST_CORNER, DIST_CORNER, DIST_CORNER };
243
    CENTERS[5] = new float[] {-DIST_CORNER, DIST_CORNER,-DIST_CORNER };
244
    CENTERS[6] = new float[] {-DIST_CORNER,-DIST_CORNER, DIST_CORNER };
245
    CENTERS[7] = new float[] {-DIST_CORNER,-DIST_CORNER,-DIST_CORNER };
246
247
    /// EDGES ///////////////////////////////////////////////
248
249
    final float[][]  edgeTable =
250
        {
251
            {0,+DIST_EDGE,+DIST_EDGE},
252
            {+DIST_EDGE,0,+DIST_EDGE},
253
            {0,-DIST_EDGE,+DIST_EDGE},
254
            {-DIST_EDGE,0,+DIST_EDGE},
255
            {+DIST_EDGE,+DIST_EDGE,0},
256
            {+DIST_EDGE,-DIST_EDGE,0},
257
            {-DIST_EDGE,-DIST_EDGE,0},
258
            {-DIST_EDGE,+DIST_EDGE,0},
259
            {0,+DIST_EDGE,-DIST_EDGE},
260
            {+DIST_EDGE,0,-DIST_EDGE},
261
            {0,-DIST_EDGE,-DIST_EDGE},
262
            {-DIST_EDGE,0,-DIST_EDGE}
263
        };
264
265
    int index=8;
266
267
    for (float[] edges : edgeTable)
268
      {
269 a57e6870 Leszek Koltunski
      float c = 3-numL;
270 29b82486 Leszek Koltunski
271 a57e6870 Leszek Koltunski
      for (int j=0; j<numL-2; j++, c+=2, index++)
272 29b82486 Leszek Koltunski
        {
273
        CENTERS[index] = new float[] { edges[0]==0 ? c : edges[0] ,
274
                                       edges[1]==0 ? c : edges[1] ,
275
                                       edges[2]==0 ? c : edges[2] };
276
        }
277
      }
278
279
    /// CENTERS //////////////////////////////////////////////
280
281
    final float X= -1000.0f;
282
    final float Y= -1001.0f;
283
284
    final float[][]  centerTable =
285
        {
286
            {+DIST_CENTER,X,Y},
287
            {-DIST_CENTER,X,Y},
288
            {X,+DIST_CENTER,Y},
289
            {X,-DIST_CENTER,Y},
290
            {X,Y,+DIST_CENTER},
291
            {X,Y,-DIST_CENTER}
292
        };
293
294
    float x,y, cen0, cen1, cen2;
295
296
    for( float[] centers : centerTable )
297
      {
298 a57e6870 Leszek Koltunski
      x = 2-numL;
299 29b82486 Leszek Koltunski
300 a57e6870 Leszek Koltunski
      for(int i=0; i<numL-1; i++, x+=2)
301 29b82486 Leszek Koltunski
        {
302 a57e6870 Leszek Koltunski
        y = 2-numL;
303 29b82486 Leszek Koltunski
304 a57e6870 Leszek Koltunski
        for(int j=0; j<numL-1; j++, y+=2, index++)
305 29b82486 Leszek Koltunski
          {
306
               if( centers[0]==Y ) cen0 = y;
307
          else if( centers[0]==X ) cen0 = x;
308
          else                     cen0 = centers[0];
309
310
               if( centers[1]==Y ) cen1 = y;
311
          else if( centers[1]==X ) cen1 = x;
312
          else                     cen1 = centers[1];
313
314
               if( centers[2]==Y ) cen2 = y;
315
          else if( centers[2]==X ) cen2 = x;
316
          else                     cen2 = centers[2];
317
318
          CENTERS[index] = new float[] {cen0,cen1,cen2};
319
          }
320
        }
321
322 a57e6870 Leszek Koltunski
      x = 3-numL;
323 29b82486 Leszek Koltunski
324 a57e6870 Leszek Koltunski
      for(int i=0; i<numL-2; i++, x+=2)
325 29b82486 Leszek Koltunski
        {
326 a57e6870 Leszek Koltunski
        y = 3-numL;
327 29b82486 Leszek Koltunski
328 a57e6870 Leszek Koltunski
        for(int j=0; j<numL-2; j++, y+=2, index++)
329 29b82486 Leszek Koltunski
          {
330
               if( centers[0]==Y ) cen0 = y;
331
          else if( centers[0]==X ) cen0 = x;
332
          else                     cen0 = centers[0];
333
334
               if( centers[1]==Y ) cen1 = y;
335
          else if( centers[1]==X ) cen1 = x;
336
          else                     cen1 = centers[1];
337
338
               if( centers[2]==Y ) cen2 = y;
339
          else if( centers[2]==X ) cen2 = x;
340
          else                     cen2 = centers[2];
341
342
          CENTERS[index] = new float[] {cen0,cen1,cen2};
343
          }
344
        }
345
      }
346
347
    return CENTERS;
348
    }
349
350
///////////////////////////////////////////////////////////////////////////////////////////////////
351
352 a57e6870 Leszek Koltunski
  protected Static4D getQuat(int cubit, int[] numLayers)
353 29b82486 Leszek Koltunski
    {
354
    if( mQuats==null ) initializeQuats();
355 a57e6870 Leszek Koltunski
356
    int numL = numLayers[0];
357 29b82486 Leszek Koltunski
    int numCorners = getNumCorners();
358 a57e6870 Leszek Koltunski
    int numEdges   = getNumEdges(numL);
359 29b82486 Leszek Koltunski
360
    if( cubit<numCorners )
361
      {
362
      switch(cubit)
363
        {
364
        case  0: return mQuats[0];                         //  unit quat
365
        case  1: return new Static4D( SQ2/2,0,0,SQ2/2);    //  90 along X
366
        case  2: return new Static4D(-SQ2/2,0,0,SQ2/2);    // -90 along X
367
        case  3: return mQuats[1];                         // 180 along X
368
        case  4: return new Static4D(0, SQ2/2,0,SQ2/2);    //  90 along Y
369
        case  5: return mQuats[2];                         // 180 along Y
370
        case  6: return mQuats[3];                         // 180 along Z
371
        case  7: return new Static4D(SQ2/2,0,-SQ2/2,0);    // 180 along (SQ2/2,0,-SQ2/2)
372
        }
373
      }
374
    else if( cubit<numCorners+numEdges )
375
      {
376 a57e6870 Leszek Koltunski
      int edge = (cubit-numCorners)/(numL-2);
377 29b82486 Leszek Koltunski
378
      switch(edge)
379
        {
380
        case  0: return mQuats[ 0];
381
        case  1: return mQuats[ 5];
382
        case  2: return mQuats[ 3];
383
        case  3: return mQuats[11];
384
        case  4: return mQuats[ 4];
385
        case  5: return mQuats[ 7];
386
        case  6: return mQuats[ 9];
387
        case  7: return mQuats[10];
388
        case  8: return mQuats[ 2];
389
        case  9: return mQuats[ 8];
390
        case 10: return mQuats[ 1];
391
        case 11: return mQuats[ 6];
392
        }
393
      }
394
    else
395
      {
396 a57e6870 Leszek Koltunski
      int center = (cubit-numCorners-numEdges)/getNumCentersPerFace(numL);
397 29b82486 Leszek Koltunski
398
      switch(center)
399
        {
400
        case 0: return new Static4D(0,-SQ2/2,0,SQ2/2);    // -90 along Y
401
        case 1: return new Static4D(0, SQ2/2,0,SQ2/2);    //  90 along Y
402
        case 2: return new Static4D( SQ2/2,0,0,SQ2/2);    //  90 along X
403
        case 3: return new Static4D(-SQ2/2,0,0,SQ2/2);    // -90 along X
404
        case 4: return mQuats[0];                         //  unit quaternion
405
        case 5: return mQuats[1];                         // 180 along X
406
        }
407
      }
408
409
    return null;
410
    }
411
412
///////////////////////////////////////////////////////////////////////////////////////////////////
413
414 a57e6870 Leszek Koltunski
  protected ObjectShape getObjectShape(int cubit, int[] numLayers)
415 29b82486 Leszek Koltunski
    {
416 a57e6870 Leszek Koltunski
    int numL = numLayers[0];
417 29b82486 Leszek Koltunski
    int variant = getCubitVariant(cubit,numLayers);
418
419
    if( variant==0 )
420
      {
421
      double[][] vertices = new double[][] { {-1,0,0},{0,-1,0},{0,0,-1},{-1,-1,-1},{0,0,0} };
422
      int[][] vert_indices = new int[][] { {0,1,4},{2,0,4},{1,2,4},{3,1,0},{3,2,1},{3,0,2} };
423 a57e6870 Leszek Koltunski
      int N = numL==2 ? 7:5;
424
      int E1= numL==2 ? 3:2;
425
      int E2= numL==2 ? 5:3;
426 29b82486 Leszek Koltunski
      float[][] bands     = new float[][] { {0.020f,35,0.16f,0.7f,N,E1,E1}, {0.000f, 0,1.00f,0.0f,3,1,E2} };
427
      int[] bandIndices   = new int[] { 0,0,0,1,1,1 };
428
      float[][] corners   = new float[][] { {0.05f,0.25f}, {0.05f,0.20f} };
429
      int[] cornerIndices = new int[] { 1,1,1,0,0 };
430
      float[][] centers   = new float[][] { {-0.5f, -0.5f, -0.5f} };
431
      int[] centerIndices = new int[] { 0,0,0,-1,0 };
432
      return new ObjectShape(vertices,vert_indices,bands,bandIndices,corners,cornerIndices,centers,centerIndices,getNumCubitFaces(), null);
433
      }
434
    else if( variant==1 )
435
      {
436
      double[][] vertices = new double[][] { {-1,0,0},{1,0,0},{0,-1,0},{0,0,-1} };
437
      int[][] vert_indices = new int[][] { {2,1,0},{3,0,1},{2,3,1},{3,2,0} };
438 a57e6870 Leszek Koltunski
      int N = numL==2 ? 7:5;
439
      int E = numL==2 ? 5:2;
440 29b82486 Leszek Koltunski
      float[][] bands     = new float[][] { {0.035f,30,0.16f,0.8f,N,2,E}, {0.020f,45,0.16f,0.2f,3,1,2} };
441
      int[] bandIndices   = new int[] { 0,0,1,1 };
442
      float[][] corners   = new float[][] { {0.07f,0.20f}, {0.02f,0.30f} };
443
      int[] cornerIndices = new int[] { 0,0,1,1 };
444
      float[][] centers   = new float[][] { {0.0f, -0.5f, -0.5f} };
445
      int[] centerIndices = new int[] { 0,0,0,0 };
446
      return new ObjectShape(vertices,vert_indices,bands,bandIndices,corners,cornerIndices,centers,centerIndices,getNumCubitFaces(), null);
447
      }
448
    else
449
      {
450
      double[][] vertices = new double[][] { {-1,0,0},{0,-1,0},{1,0,0},{0,1,0},{0,0,-1} };
451
      int[][] vert_indices = new int[][] { {0,1,2,3},{4,1,0},{4,2,1},{4,3,2},{4,0,3} };
452 a57e6870 Leszek Koltunski
      int N = numL==2 ? 7:6;
453
      int E = numL==2 ? 3:1;
454 29b82486 Leszek Koltunski
      float[][] bands     = new float[][] { {0.04f,35,SQ2/8,0.9f,N,E,E}, {0.000f,0,1,0.0f,3,0,0} };
455
      int[] bandIndices   = new int[] { 0,1,1,1,1 };
456
      float[][] corners   = new float[][] { {0.06f,0.15f} };
457
      int[] cornerIndices = new int[] { 0,0,0,0,0 };
458
      float[][] centers   = new float[][] { {0,0,-0.4f} };
459
      int[] centerIndices = new int[] { 0,0,0,0,-1 };
460
      return new ObjectShape(vertices,vert_indices,bands,bandIndices,corners,cornerIndices,centers,centerIndices,getNumCubitFaces(), null);
461
      }
462
    }
463
464
///////////////////////////////////////////////////////////////////////////////////////////////////
465
466 a57e6870 Leszek Koltunski
  protected int getNumCubitVariants(int[] numLayers)
467 29b82486 Leszek Koltunski
    {
468
    return 3;
469
    }
470
471
///////////////////////////////////////////////////////////////////////////////////////////////////
472
473 a57e6870 Leszek Koltunski
  protected int getCubitVariant(int cubit, int[] numLayers)
474 29b82486 Leszek Koltunski
    {
475
    int numCorners = getNumCorners();
476
    if( cubit<numCorners ) return 0;
477 a57e6870 Leszek Koltunski
    int numEdges = getNumEdges(numLayers[0]);
478 29b82486 Leszek Koltunski
    return cubit<numCorners+numEdges ? 1:2;
479
    }
480
481
///////////////////////////////////////////////////////////////////////////////////////////////////
482
483 a57e6870 Leszek Koltunski
  protected int getFaceColor(int cubit, int cubitface, int[] numLayers)
484 29b82486 Leszek Koltunski
    {
485
    if( mCornerMap==null || mEdgeMap==null || mCenterMap==null )
486
      {
487
      mCornerMap = new int[][]
488
         {
489
           {  4, 2, 0, 18,18,18 },
490
           {  2, 5, 0, 18,18,18 },
491
           {  3, 4, 0, 18,18,18 },
492
           {  5, 3, 0, 18,18,18 },
493
           {  1, 2, 4, 18,18,18 },
494
           {  5, 2, 1, 18,18,18 },
495
           {  4, 3, 1, 18,18,18 },
496
           {  1, 3, 5, 18,18,18 },
497
         };
498
499
      mEdgeMap = new int[][]
500
         {
501
           { 10, 8, 18,18,18,18 },
502
           {  6,10, 18,18,18,18 },
503
           { 10, 9, 18,18,18,18 },
504
           {  7,10, 18,18,18,18 },
505
           {  8, 6, 18,18,18,18 },
506
           {  9, 6, 18,18,18,18 },
507
           {  9, 7, 18,18,18,18 },
508
           {  8, 7, 18,18,18,18 },
509
           { 11, 8, 18,18,18,18 },
510
           {  6,11, 18,18,18,18 },
511
           { 11, 9, 18,18,18,18 },
512
           {  7,11, 18,18,18,18 }
513
         };
514
515
      mCenterMap = new int[][]
516
         {
517
           { 12, 18,18,18,18,18 },
518
           { 13, 18,18,18,18,18 },
519
           { 14, 18,18,18,18,18 },
520
           { 15, 18,18,18,18,18 },
521
           { 16, 18,18,18,18,18 },
522
           { 17, 18,18,18,18,18 },
523
         };
524
      }
525
526 a57e6870 Leszek Koltunski
    int numL = numLayers[0];
527 29b82486 Leszek Koltunski
    int numCorners = getNumCorners();
528 a57e6870 Leszek Koltunski
    int numEdges   = getNumEdges(numL);
529 29b82486 Leszek Koltunski
530
    if( cubit<numCorners )
531
      {
532
      return mCornerMap[cubit][cubitface];
533
      }
534
    else if( cubit<numCorners+numEdges )
535
      {
536 a57e6870 Leszek Koltunski
      int edge = (cubit-numCorners)/(numL-2);
537 29b82486 Leszek Koltunski
      return mEdgeMap[edge][cubitface];
538
      }
539
    else
540
      {
541 a57e6870 Leszek Koltunski
      int center = (cubit-numCorners-numEdges)/getNumCentersPerFace(numL);
542 29b82486 Leszek Koltunski
      return mCenterMap[center][cubitface];
543
      }
544
    }
545
546
///////////////////////////////////////////////////////////////////////////////////////////////////
547
548
  protected ObjectSticker retSticker(int face)
549
    {
550
    if( mStickers==null )
551
      {
552
      float[][] STICKERS = new float[][]
553
          {
554
             { -0.5f, 0.25f, 0.25f,  -0.5f, 0.25f, 0.25f  },
555
             { -0.5f, 0.00f, 0.00f,  -0.5f, 0.50f, 0.0f, 0.0f, 0.5f }
556
          };
557
558
      final float R1 = 0.025f;
559
      final float R2 = 0.025f;
560
      final float R3 = 0.055f;
561
      final float[][] radii  = { { R1,R1,R1 },{ R2,R2,R2 },{ R3,R3,R3,R3 } };
562 21aaab9a Leszek Koltunski
      final float[] strokes = { 0.05f, 0.04f, 0.04f };
563 29b82486 Leszek Koltunski
564 8592461c Leszek Koltunski
      if( ObjectControl.isInIconMode() )
565
        {
566 a57e6870 Leszek Koltunski
        int[] numLayers = getNumLayers();
567
        float mult = numLayers[0]==2 ? 2.0f : 2.7f;
568 8592461c Leszek Koltunski
        strokes[0]*=mult;
569
        strokes[1]*=mult;
570
        strokes[2]*=mult;
571
        }
572
573 29b82486 Leszek Koltunski
      mStickers = new ObjectSticker[STICKERS.length+1];
574
575
      for(int s=0; s<STICKERS.length+1; s++)
576
        {
577
        int index = s<2 ? 0:1;
578
        mStickers[s] = new ObjectSticker(STICKERS[index],null,radii[s],strokes[s]);
579
        }
580
      }
581
582
    return mStickers[face/NUM_FACE_COLORS];
583
    }
584
585
///////////////////////////////////////////////////////////////////////////////////////////////////
586
// PUBLIC API
587
588
  public Static3D[] getRotationAxis()
589
    {
590
    return ROT_AXIS;
591
    }
592
593
///////////////////////////////////////////////////////////////////////////////////////////////////
594
595
  public Movement getMovement()
596
    {
597
    if( mMovement==null )
598
      {
599 a57e6870 Leszek Koltunski
      int[] numLayers = getNumLayers();
600 29b82486 Leszek Koltunski
      if( mCuts==null ) getCuts(numLayers);
601
      getLayerRotatable(numLayers);
602 a57e6870 Leszek Koltunski
      mMovement = new Movement6(ROT_AXIS,mCuts,mLayerRotatable,2*numLayers[0]-2,TYPE_SPLIT_CORNER,ENABLED);
603 29b82486 Leszek Koltunski
      }
604
    return mMovement;
605
    }
606
607
///////////////////////////////////////////////////////////////////////////////////////////////////
608
609
  public int[] getBasicAngle()
610
    {
611
    if( mBasicAngle ==null ) mBasicAngle = new int[] { 3,3,3,3 };
612
    return mBasicAngle;
613
    }
614
615 61aa85e4 Leszek Koltunski
///////////////////////////////////////////////////////////////////////////////////////////////////
616
617 a57e6870 Leszek Koltunski
  public ObjectType intGetObjectType(int[] numLayers)
618 61aa85e4 Leszek Koltunski
    {
619 a57e6870 Leszek Koltunski
    switch(numLayers[0])
620 61aa85e4 Leszek Koltunski
      {
621 8005e762 Leszek Koltunski
      case 2: return ObjectType.SKEW_2;
622
      case 3: return ObjectType.SKEW_3;
623 61aa85e4 Leszek Koltunski
      }
624
625 8005e762 Leszek Koltunski
    return ObjectType.SKEW_2;
626 61aa85e4 Leszek Koltunski
    }
627
628 29b82486 Leszek Koltunski
///////////////////////////////////////////////////////////////////////////////////////////////////
629
630 a57e6870 Leszek Koltunski
  public int getObjectName(int[] numLayers)
631 29b82486 Leszek Koltunski
    {
632 a57e6870 Leszek Koltunski
    switch(numLayers[0])
633 29b82486 Leszek Koltunski
      {
634
      case 2: return R.string.skew2;
635
      case 3: return R.string.skew3;
636
      }
637
    return R.string.skew2;
638
    }
639
640
///////////////////////////////////////////////////////////////////////////////////////////////////
641
642 a57e6870 Leszek Koltunski
  public int getInventor(int[] numLayers)
643 29b82486 Leszek Koltunski
    {
644 a57e6870 Leszek Koltunski
    switch(numLayers[0])
645 29b82486 Leszek Koltunski
      {
646
      case 2: return R.string.skew2_inventor;
647
      case 3: return R.string.skew3_inventor;
648
      }
649
    return R.string.skew2_inventor;
650
    }
651
652
///////////////////////////////////////////////////////////////////////////////////////////////////
653
654 a57e6870 Leszek Koltunski
  public int getComplexity(int[] numLayers)
655 29b82486 Leszek Koltunski
    {
656 a57e6870 Leszek Koltunski
    switch(numLayers[0])
657 29b82486 Leszek Koltunski
      {
658
      case 2: return 4;
659
      case 3: return 8;
660
      }
661
    return 5;
662
    }
663
}