Project

General

Profile

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

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

1
///////////////////////////////////////////////////////////////////////////////////////////////////
2
// Copyright 2019 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_NOT_SPLIT;
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
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 TwistyMirror extends Twisty6
45
{
46
  static final Static3D[] ROT_AXIS = new Static3D[]
47
         {
48
           new Static3D(1,0,0),
49
           new Static3D(0,1,0),
50
           new Static3D(0,0,1)
51
         };
52

    
53
  private static final int[][][] ENABLED = new int[][][]
54
      {
55
          {{1,2}},{{1,2}},{{0,2}},{{0,2}},{{0,1}},{{0,1}},
56
      };
57

    
58
  private static final int[] FACE_COLORS = new int[] { COLOR_WHITE };
59
  private static final float DX = 0.10f;
60
  private static final float DY = 0.25f;
61
  private static final float DZ = 0.40f;
62

    
63
  private static final float[][] SEQ2 = new float[][]
64
      {
65
          {1-DX,1-DY},{1+DX,1-DY},{1-DX,1+DY},{1+DX,1+DY},
66
          {1-DX,1-DZ},{1+DX,1-DZ},{1-DX,1+DZ},{1+DX,1+DZ},
67
          {1-DZ,1-DY},{1+DZ,1-DY},{1-DZ,1+DY},{1+DZ,1+DY},
68
      };
69

    
70
  private static final float[][] SEQ3 = new float[][]
71
      {
72
          {1   ,1   },{1-DX,1-DY},{1   ,1-DY},{1+DX,1-DY},{1-DX,1   },
73
          {1+DX,1   },{1-DX,1+DY},{1   ,1+DY},{1+DX,1+DY},{1-DX,1-DZ},
74
          {1   ,1-DZ},{1+DX,1-DZ},{1-DX,1   },{1+DX,1   },{1-DX,1+DZ},
75
          {1   ,1+DZ},{1+DX,1+DZ},{1-DZ,1-DY},{1   ,1-DY},{1+DZ,1-DY},
76
          {1-DZ,1   },{1+DZ,1   },{1-DZ,1+DY},{1   ,1+DY},{1+DZ,1+DY},
77
      };
78

    
79
  private ScrambleState[] mStates;
80
  private Static4D[] mQuats;
81
  private float[][] mCuts;
82
  private boolean[][] mLayerRotatable;
83
  private int[] mBasicAngle;
84
  private ObjectSticker[] mStickers;
85
  private float[][] mPositions;
86
  private Movement mMovement;
87

    
88
///////////////////////////////////////////////////////////////////////////////////////////////////
89

    
90
  public TwistyMirror(int[] numL, Static4D quat, Static3D move, DistortedTexture texture,
91
                      MeshSquare mesh, DistortedEffects effects, Resources res, int scrWidth)
92
    {
93
    super(numL, numL[0], quat, move, texture, mesh, effects, res, scrWidth);
94
    }
95

    
96
///////////////////////////////////////////////////////////////////////////////////////////////////
97

    
98
  protected ScrambleState[] getScrambleStates()
99
    {
100
    if( mStates==null )
101
      {
102
      int[] numLayers = getNumLayers();
103
      int[][] m = new int[16][];
104
      for(int i=1; i<16; i++) m[i] = createEdges(numLayers[0],i);
105

    
106
      mStates = new ScrambleState[]
107
        {
108
        new ScrambleState( new int[][] { m[ 1], m[ 2], m[ 3] } ),  // 0
109
        new ScrambleState( new int[][] {  null, m[ 4], m[ 5] } ),  // x
110
        new ScrambleState( new int[][] { m[ 6],  null, m[ 7] } ),  // y
111
        new ScrambleState( new int[][] { m[ 8], m[ 8],  null } ),  // z
112
        new ScrambleState( new int[][] { m[10],  null, m[ 7] } ),  // xy
113
        new ScrambleState( new int[][] { m[11], m[ 9],  null } ),  // xz
114
        new ScrambleState( new int[][] {  null, m[12], m[ 5] } ),  // yx
115
        new ScrambleState( new int[][] { m[ 8], m[13],  null } ),  // yz
116
        new ScrambleState( new int[][] {  null, m[ 4], m[14] } ),  // zx
117
        new ScrambleState( new int[][] { m[ 6],  null, m[15] } ),  // zy
118
        new ScrambleState( new int[][] {  null,  null, m[ 5] } ),  // xyx
119
        new ScrambleState( new int[][] {  null, m[ 4],  null } ),  // xzx
120
        new ScrambleState( new int[][] {  null,  null, m[ 7] } ),  // yxy
121
        new ScrambleState( new int[][] { m[ 6],  null,  null } ),  // yzy
122
        new ScrambleState( new int[][] {  null, m[ 9],  null } ),  // zxz
123
        new ScrambleState( new int[][] { m[ 8],  null,  null } ),  // zyz
124
        };
125
      }
126

    
127
    return mStates;
128
    }
129

    
130
///////////////////////////////////////////////////////////////////////////////////////////////////
131

    
132
  protected int getResource(int[] numLayers)
133
    {
134
    switch(numLayers[0])
135
      {
136
      case 2: return R.raw.mirr2;
137
      case 3: return R.raw.mirr3;
138
      }
139

    
140
    return 0;
141
    }
142

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

    
145
  private int[] createEdges(int size, int vertex)
146
    {
147
    int[] ret = new int[9*size];
148

    
149
    for(int l=0; l<size; l++)
150
      {
151
      ret[9*l  ] = l;
152
      ret[9*l+1] =-1;
153
      ret[9*l+2] = vertex;
154
      ret[9*l+3] = l;
155
      ret[9*l+4] = 1;
156
      ret[9*l+5] = vertex;
157
      ret[9*l+6] = l;
158
      ret[9*l+7] = 2;
159
      ret[9*l+8] = vertex;
160
      }
161

    
162
    return ret;
163
    }
164

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

    
167
  private void initializeQuats()
168
    {
169
    mQuats = new Static4D[]
170
         {
171
         new Static4D(  0.0f,   0.0f,   0.0f,   1.0f),
172
         new Static4D(  1.0f,   0.0f,   0.0f,   0.0f),
173
         new Static4D(  0.0f,   1.0f,   0.0f,   0.0f),
174
         new Static4D(  0.0f,   0.0f,   1.0f,   0.0f),
175

    
176
         new Static4D( SQ2/2,  SQ2/2,  0.0f ,   0.0f),
177
         new Static4D( SQ2/2, -SQ2/2,  0.0f ,   0.0f),
178
         new Static4D( SQ2/2,   0.0f,  SQ2/2,   0.0f),
179
         new Static4D(-SQ2/2,   0.0f,  SQ2/2,   0.0f),
180
         new Static4D( SQ2/2,   0.0f,   0.0f,  SQ2/2),
181
         new Static4D( SQ2/2,   0.0f,   0.0f, -SQ2/2),
182
         new Static4D(  0.0f,  SQ2/2,  SQ2/2,   0.0f),
183
         new Static4D(  0.0f,  SQ2/2, -SQ2/2,   0.0f),
184
         new Static4D(  0.0f,  SQ2/2,   0.0f,  SQ2/2),
185
         new Static4D(  0.0f,  SQ2/2,   0.0f, -SQ2/2),
186
         new Static4D(  0.0f,   0.0f,  SQ2/2,  SQ2/2),
187
         new Static4D(  0.0f,   0.0f,  SQ2/2, -SQ2/2),
188

    
189
         new Static4D(  0.5f,   0.5f,   0.5f,   0.5f),
190
         new Static4D(  0.5f,   0.5f,  -0.5f,   0.5f),
191
         new Static4D(  0.5f,   0.5f,  -0.5f,  -0.5f),
192
         new Static4D(  0.5f,  -0.5f,   0.5f,  -0.5f),
193
         new Static4D( -0.5f,  -0.5f,  -0.5f,   0.5f),
194
         new Static4D( -0.5f,   0.5f,  -0.5f,  -0.5f),
195
         new Static4D( -0.5f,   0.5f,   0.5f,  -0.5f),
196
         new Static4D( -0.5f,   0.5f,   0.5f,   0.5f)
197
         };
198
    }
199

    
200
///////////////////////////////////////////////////////////////////////////////////////////////////
201
// we cannot do this the standard, automatic way because there's only 1 color in the FACE_COLORS
202
// table and retCubitSolvedStatus() always returns -1,-1 or 0.
203

    
204
  protected int[] getSolvedQuats(int cubit, int[] numLayers)
205
    {
206
    if( numLayers[0]==3 )
207
      {
208
      switch(cubit)
209
        {
210
        case  4:
211
        case 21: return new int[] {1,8,9};
212
        case 10:
213
        case 15: return new int[] {2,12,13};
214
        case 12:
215
        case 13: return new int[] {3,14,15};
216
        }
217
      }
218

    
219
    return null;
220
    }
221

    
222
///////////////////////////////////////////////////////////////////////////////////////////////////
223

    
224
  protected int getFaceColor(int cubit, int cubitface, int[] numLayers)
225
    {
226
    int numL = numLayers[0];
227

    
228
    if( numL==2 )
229
      {
230
      switch(cubitface)
231
        {
232
        case 0: if( cubit==4 ) return 11;
233
                if( cubit==5 ) return 10;
234
                if( cubit==6 ) return  9;
235
                if( cubit==7 ) return  8;
236
                return NUM_TEXTURES;
237
        case 1: if( cubit==0 ) return 11;
238
                if( cubit==1 ) return 10;
239
                if( cubit==2 ) return  9;
240
                if( cubit==3 ) return  8;
241
                return NUM_TEXTURES;
242
        case 2: if( cubit==3 ) return  4;
243
                if( cubit==7 ) return  5;
244
                if( cubit==2 ) return  6;
245
                if( cubit==6 ) return  7;
246
                return NUM_TEXTURES;
247
        case 3: if( cubit==1 ) return  4;
248
                if( cubit==5 ) return  5;
249
                if( cubit==0 ) return  6;
250
                if( cubit==4 ) return  7;
251
                return NUM_TEXTURES;
252
        case 4: if( cubit==3 ) return  0;
253
                if( cubit==7 ) return  1;
254
                if( cubit==1 ) return  2;
255
                if( cubit==5 ) return  3;
256
                return NUM_TEXTURES;
257
        case 5: if( cubit==2 ) return  0;
258
                if( cubit==6 ) return  1;
259
                if( cubit==0 ) return  2;
260
                if( cubit==4 ) return  3;
261
                return NUM_TEXTURES;
262
        }
263
      }
264
    if( numL==3 )
265
      {
266
      switch(cubitface)
267
        {
268
        case 0: if( cubit==17 ) return 24;
269
                if( cubit==18 ) return 23;
270
                if( cubit==19 ) return 22;
271
                if( cubit==20 ) return 21;
272
                if( cubit==21 ) return  0;
273
                if( cubit==22 ) return 20;
274
                if( cubit==23 ) return 19;
275
                if( cubit==24 ) return 18;
276
                if( cubit==25 ) return 17;
277
                return NUM_TEXTURES;
278
        case 1: if( cubit== 0 ) return 24;
279
                if( cubit== 1 ) return 23;
280
                if( cubit== 2 ) return 22;
281
                if( cubit== 3 ) return 21;
282
                if( cubit== 4 ) return  0;
283
                if( cubit== 5 ) return 20;
284
                if( cubit== 6 ) return 19;
285
                if( cubit== 7 ) return 18;
286
                if( cubit== 8 ) return 17;
287
                return NUM_TEXTURES;
288
        case 2: if( cubit== 6 ) return 14;
289
                if( cubit==14 ) return  2; // theoretically should have been 15, but this must have gotten collapsed in the Factory
290
                if( cubit==23 ) return 16;
291
                if( cubit== 7 ) return 12;
292
                if( cubit==15 ) return  0;
293
                if( cubit==24 ) return 13;
294
                if( cubit== 8 ) return  9;
295
                if( cubit==16 ) return 20; // ditto, theoretically 10
296
                if( cubit==25 ) return 11;
297
                return NUM_TEXTURES;
298
        case 3: if( cubit== 0 ) return 14;
299
                if( cubit== 9 ) return  2; // ditto, theoretically 15
300
                if( cubit==17 ) return 16;
301
                if( cubit== 1 ) return 12;
302
                if( cubit==10 ) return  0;
303
                if( cubit==18 ) return 13;
304
                if( cubit== 2 ) return  9;
305
                if( cubit==11 ) return 20; // ditto, theoretically 10
306
                if( cubit==19 ) return 11;
307
                return NUM_TEXTURES;
308
        case 4: if( cubit== 8 ) return  1;
309
                if( cubit==16 ) return  2;
310
                if( cubit==25 ) return  3;
311
                if( cubit== 5 ) return  4;
312
                if( cubit==13 ) return  0;
313
                if( cubit==22 ) return  5;
314
                if( cubit== 2 ) return  6;
315
                if( cubit==11 ) return  7;
316
                if( cubit==19 ) return  8;
317
                return NUM_TEXTURES;
318
        case 5: if( cubit== 6 ) return  1;
319
                if( cubit==14 ) return  2;
320
                if( cubit==23 ) return  3;
321
                if( cubit== 3 ) return  4;
322
                if( cubit==12 ) return  0;
323
                if( cubit==20 ) return  5;
324
                if( cubit== 0 ) return  6;
325
                if( cubit== 9 ) return  7;
326
                if( cubit==17 ) return  8;
327
                return NUM_TEXTURES;
328
        }
329
      }
330

    
331
    return 0;
332
    }
333

    
334
///////////////////////////////////////////////////////////////////////////////////////////////////
335

    
336
  private float returnStroke(float x, float y)
337
    {
338
    return 0.08f/(Math.max(x,y));
339
    }
340

    
341
///////////////////////////////////////////////////////////////////////////////////////////////////
342

    
343
  private float[] generateStrokes(int numLayers)
344
    {
345
    if( numLayers==2 )
346
      {
347
      int LEN = SEQ2.length;
348
      float[] tmp = new float[LEN];
349
      for(int i=0; i<LEN; i++) tmp[i] = returnStroke(SEQ2[i][0],SEQ2[i][1]);
350
      return tmp;
351
      }
352
    else
353
      {
354
      int LEN = SEQ3.length;
355
      float[] tmp = new float[LEN];
356
      for(int i=0; i<LEN; i++) tmp[i] = returnStroke(SEQ3[i][0],SEQ3[i][1]);
357
      return tmp;
358
      }
359
    }
360

    
361
///////////////////////////////////////////////////////////////////////////////////////////////////
362

    
363
  private float[] returnSticker(float x, float y)
364
    {
365
      float H = 0.5f;
366

    
367
      if( x<y ) { float D=H*x/y; return new float[] {-D,-H,+D,-H,+D,+H,-D,+H}; }
368
      else      { float D=H*y/x; return new float[] {-H,-D,+H,-D,+H,+D,-H,+D}; }
369
    }
370

    
371
///////////////////////////////////////////////////////////////////////////////////////////////////
372

    
373
  private float[][] generateStickers(int numLayers)
374
    {
375
    if( numLayers==2 )
376
      {
377
      int LEN = SEQ2.length;
378
      float[][] tmp = new float[LEN][];
379
      for(int i=0; i<LEN; i++) tmp[i] = returnSticker(SEQ2[i][0],SEQ2[i][1]);
380
      return tmp;
381
      }
382
    else
383
      {
384
      int LEN = SEQ3.length;
385
      float[][] tmp = new float[LEN][];
386
      for(int i=0; i<LEN; i++) tmp[i] = returnSticker(SEQ3[i][0],SEQ3[i][1]);
387
      return tmp;
388
      }
389
    }
390

    
391
///////////////////////////////////////////////////////////////////////////////////////////////////
392

    
393
  protected ObjectSticker retSticker(int face)
394
    {
395
    if( mStickers==null )
396
      {
397
      int[] numLayers = getNumLayers();
398
      int numL = numLayers[0];
399
      final float[][] STICKERS = generateStickers(numL);
400
      final int NUM_STICKERS = STICKERS.length;
401
      final float radius = 0.10f;
402
      final float[] radii = {radius,radius,radius,radius};
403
      float[] STROKES = generateStrokes(numL);
404

    
405
      if( ObjectControl.isInIconMode() )
406
        {
407
        int len = STROKES.length;
408
        float mult = numL==2 ? 1.8f: 2.0f;
409
        for(int i=0; i<len; i++) STROKES[i]*=mult;
410
        }
411

    
412
      mStickers = new ObjectSticker[NUM_STICKERS];
413

    
414
      for(int i=0; i<NUM_STICKERS; i++)
415
        {
416
        mStickers[i] = new ObjectSticker(STICKERS[i],null,radii,STROKES[i]);
417
        }
418
      }
419

    
420
    return mStickers[face/NUM_FACE_COLORS];
421
    }
422

    
423
///////////////////////////////////////////////////////////////////////////////////////////////////
424

    
425
  protected int getNumStickerTypes(int[] numLayers)
426
    {
427
    return numLayers[0]==2 ? SEQ2.length : SEQ3.length;
428
    }
429

    
430
///////////////////////////////////////////////////////////////////////////////////////////////////
431

    
432
  private int getRow(int cubit, int numLayers, int dim)
433
    {
434
    return (int)(mPositions[cubit][dim] + 0.5f*(numLayers-1));
435
    }
436

    
437
///////////////////////////////////////////////////////////////////////////////////////////////////
438

    
439
  protected ObjectShape getObjectShape(int cubit, int[] numLayers)
440
    {
441
    int extraI, extraV, num;
442
    float height;
443
    int numL = numLayers[0];
444

    
445
    switch(numL)
446
      {
447
      case 2 : num = 6; extraI = 2; extraV = 2; height = 0.045f; break;
448
      case 3 : num = 5; extraI = 2; extraV = 2; height = 0.045f; break;
449
      case 4 : num = 5; extraI = 1; extraV = 1; height = 0.045f; break;
450
      default: num = 5; extraI = 0; extraV = 0; height = 0.045f; break;
451
      }
452

    
453
    int xrow = getRow(cubit,numL,0);
454
    int yrow = getRow(cubit,numL,1);
455
    int zrow = getRow(cubit,numL,2);
456

    
457
    float XL = -0.5f + (xrow==     0 ? DX : 0);
458
    float XR = +0.5f + (xrow==numL-1 ? DX : 0);
459
    float YL = -0.5f - (yrow==     0 ? DY : 0);
460
    float YR = +0.5f - (yrow==numL-1 ? DY : 0);
461
    float ZL = -0.5f - (zrow==     0 ? DZ : 0);
462
    float ZR = +0.5f - (zrow==numL-1 ? DZ : 0);
463

    
464
    double[][] vertices = new double[][]
465
          {
466
              { XR, YR, ZR },
467
              { XR, YR, ZL },
468
              { XR, YL, ZR },
469
              { XR, YL, ZL },
470
              { XL, YR, ZR },
471
              { XL, YR, ZL },
472
              { XL, YL, ZR },
473
              { XL, YL, ZL },
474
          };
475

    
476
    int[][] vert_indices = new int[][]
477
          {
478
              {2,3,1,0},
479
              {7,6,4,5},
480
              {4,0,1,5},
481
              {7,3,2,6},
482
              {6,2,0,4},
483
              {3,7,5,1}
484
          };
485

    
486
    float[][] bands     = new float[][] { {height,35,0.5f,0.7f,num,extraI,extraV} };
487
    int[] bandIndices   = new int[] { 0,0,0,0,0,0};
488
    float[][] corners   = new float[][] { {0.036f,0.12f} };
489
    int[] cornerIndices = new int[] { 0,0,0,0,0,0,0,0 };
490
    float[][] centers   = new float[][] { {0.0f, 0.0f, 0.0f} };
491
    int[] centerIndices = new int[] { 0,0,0,0,0,0,0,0 };
492

    
493
    return new ObjectShape(vertices,vert_indices,bands,bandIndices,corners,cornerIndices,centers,centerIndices,getNumCubitFaces(), null);
494
    }
495

    
496
///////////////////////////////////////////////////////////////////////////////////////////////////
497

    
498
  protected Static4D getQuat(int cubit, int[] numLayers)
499
    {
500
    if( mQuats ==null ) initializeQuats();
501
    return mQuats[0];
502
    }
503

    
504
///////////////////////////////////////////////////////////////////////////////////////////////////
505

    
506
  protected int getNumCubitVariants(int[] numLayers)
507
    {
508
    int numL = numLayers[0];
509
    return 6*numL*numL - 12*numL + 8;
510
    }
511

    
512
///////////////////////////////////////////////////////////////////////////////////////////////////
513

    
514
  protected int getCubitVariant(int cubit, int[] numLayers)
515
    {
516
    return cubit;
517
    }
518

    
519
///////////////////////////////////////////////////////////////////////////////////////////////////
520

    
521
  protected int getColor(int face)
522
    {
523
    return FACE_COLORS[face];
524
    }
525

    
526
///////////////////////////////////////////////////////////////////////////////////////////////////
527

    
528
  protected float[][] getCubitPositions(int[] numLayers)
529
    {
530
    if( mPositions==null )
531
      {
532
      int numL = numLayers[0];
533
      int numCubits = numL>1 ? 6*numL*numL - 12*numL + 8 : 1;
534
      mPositions = new float[numCubits][];
535

    
536
      float diff = 0.5f*(numL-1);
537
      int currentPosition = 0;
538

    
539
      for(int x = 0; x<numL; x++)
540
        for(int y = 0; y<numL; y++)
541
          for(int z = 0; z<numL; z++)
542
            if( x==0 || x==numL-1 || y==0 || y==numL-1 || z==0 || z==numL-1 )
543
              {
544
              mPositions[currentPosition++] = new float[] {x-diff,y-diff,z-diff};
545
              }
546
      }
547

    
548
    return mPositions;
549
    }
550

    
551
///////////////////////////////////////////////////////////////////////////////////////////////////
552

    
553
  protected Static4D[] getQuats()
554
    {
555
    if( mQuats ==null ) initializeQuats();
556
    return mQuats;
557
    }
558

    
559
///////////////////////////////////////////////////////////////////////////////////////////////////
560

    
561
  protected int getNumFaceColors()
562
    {
563
    return 1;
564
    }
565

    
566
///////////////////////////////////////////////////////////////////////////////////////////////////
567

    
568
  protected float[][] getCuts(int[] numLayers)
569
    {
570
    if( mCuts==null )
571
      {
572
      int numL = numLayers[0];
573
      mCuts = new float[3][numL-1];
574

    
575
      for(int i=0; i<numL-1; i++)
576
        {
577
        float cut = (2-numL)*0.5f + i;
578
        mCuts[0][i] = cut;
579
        mCuts[1][i] = cut;
580
        mCuts[2][i] = cut;
581
        }
582
      }
583

    
584
    return mCuts;
585
    }
586

    
587
///////////////////////////////////////////////////////////////////////////////////////////////////
588

    
589
  private void getLayerRotatable(int[] numLayers)
590
    {
591
    if( mLayerRotatable==null )
592
      {
593
      int numAxis = ROT_AXIS.length;
594
      mLayerRotatable = new boolean[numAxis][];
595

    
596
      for(int i=0; i<numAxis; i++)
597
        {
598
        mLayerRotatable[i] = new boolean[numLayers[i]];
599
        for(int j=0; j<numLayers[i]; j++) mLayerRotatable[i][j] = true;
600
        }
601
      }
602
    }
603

    
604
///////////////////////////////////////////////////////////////////////////////////////////////////
605

    
606
  protected int getSolvedFunctionIndex()
607
    {
608
    return 0;
609
    }
610

    
611
///////////////////////////////////////////////////////////////////////////////////////////////////
612

    
613
  protected int getNumCubitFaces()
614
    {
615
    return 6;
616
    }
617

    
618
///////////////////////////////////////////////////////////////////////////////////////////////////
619
// PUBLIC API
620

    
621
  public Static3D[] getRotationAxis()
622
    {
623
    return ROT_AXIS;
624
    }
625

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

    
628
  public Movement getMovement()
629
    {
630
    if( mMovement==null )
631
      {
632
      int[] numLayers = getNumLayers();
633
      if( mCuts==null ) getCuts(numLayers);
634
      getLayerRotatable(numLayers);
635
      mMovement = new Movement6(ROT_AXIS,mCuts,mLayerRotatable,numLayers[0],TYPE_NOT_SPLIT,ENABLED);
636
      }
637
    return mMovement;
638
    }
639

    
640
///////////////////////////////////////////////////////////////////////////////////////////////////
641

    
642
  public int[] getBasicAngle()
643
    {
644
    if( mBasicAngle==null ) mBasicAngle = new int[] { 4,4,4 };
645
    return mBasicAngle;
646
    }
647

    
648
///////////////////////////////////////////////////////////////////////////////////////////////////
649

    
650
  public ObjectType intGetObjectType(int[] numLayers)
651
    {
652
    switch(numLayers[0])
653
      {
654
      case 2: return ObjectType.MIRR_2;
655
      case 3: return ObjectType.MIRR_3;
656
      }
657

    
658
    return ObjectType.MIRR_2;
659
    }
660

    
661
///////////////////////////////////////////////////////////////////////////////////////////////////
662

    
663
  public int getObjectName(int[] numLayers)
664
    {
665
    switch(numLayers[0])
666
      {
667
      case 2: return R.string.mirr2;
668
      case 3: return R.string.mirr3;
669
      }
670
    return R.string.mirr3;
671
    }
672

    
673
///////////////////////////////////////////////////////////////////////////////////////////////////
674

    
675
  public int getInventor(int[] numLayers)
676
    {
677
    switch(numLayers[0])
678
      {
679
      case 2: return R.string.mirr2_inventor;
680
      case 3: return R.string.mirr3_inventor;
681
      }
682
    return R.string.mirr3_inventor;
683
    }
684

    
685
///////////////////////////////////////////////////////////////////////////////////////////////////
686

    
687
  public int getComplexity(int[] numLayers)
688
    {
689
    switch(numLayers[0])
690
      {
691
      case 2: return 5;
692
      case 3: return 7;
693
      }
694
    return 7;
695
    }
696
}
(17-17/25)