Project

General

Profile

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

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

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.MOVEMENT_HEXAHEDRON;
23
import static org.distorted.objectlib.main.Movement.TYPE_NOT_SPLIT;
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.ObjectControl;
35
import org.distorted.objectlib.main.ObjectType;
36
import org.distorted.objectlib.helpers.ObjectShape;
37
import org.distorted.objectlib.helpers.ObjectSticker;
38
import org.distorted.objectlib.helpers.ScrambleState;
39
import org.distorted.objectlib.main.Twisty6;
40

    
41
///////////////////////////////////////////////////////////////////////////////////////////////////
42

    
43
public class TwistyMirror extends Twisty6
44
{
45
  static final Static3D[] ROT_AXIS = new Static3D[]
46
         {
47
           new Static3D(1,0,0),
48
           new Static3D(0,1,0),
49
           new Static3D(0,0,1)
50
         };
51

    
52
  private static final int[] FACE_COLORS = new int[] { COLOR_WHITE };
53
  private static final float DX = 0.10f;
54
  private static final float DY = 0.25f;
55
  private static final float DZ = 0.40f;
56

    
57
  private static final float[][] SEQ2 = new float[][]
58
      {
59
          {1-DX,1-DY},{1+DX,1-DY},{1-DX,1+DY},{1+DX,1+DY},
60
          {1-DX,1-DZ},{1+DX,1-DZ},{1-DX,1+DZ},{1+DX,1+DZ},
61
          {1-DZ,1-DY},{1+DZ,1-DY},{1-DZ,1+DY},{1+DZ,1+DY},
62
      };
63

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

    
73
  private ScrambleState[] mStates;
74
  private Static4D[] mQuats;
75
  private float[][] mCuts;
76
  private int[] mBasicAngle;
77
  private ObjectSticker[] mStickers;
78
  private float[][] mPositions;
79

    
80
///////////////////////////////////////////////////////////////////////////////////////////////////
81

    
82
  public TwistyMirror(int[] numL, Static4D quat, Static3D move, DistortedTexture texture,
83
                      MeshSquare mesh, DistortedEffects effects, Resources res, int surfaceW, int surfaceH)
84
    {
85
    super(numL, numL[0], quat, move, texture, mesh, effects, res, surfaceW, surfaceH);
86
    }
87

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

    
90
  public ScrambleState[] getScrambleStates()
91
    {
92
    if( mStates==null )
93
      {
94
      int[] numLayers = getNumLayers();
95
      int[][] m = new int[16][];
96
      for(int i=1; i<16; i++) m[i] = createEdges(numLayers[0],i);
97

    
98
      mStates = new ScrambleState[]
99
        {
100
        new ScrambleState( new int[][] { m[ 1], m[ 2], m[ 3] } ),  // 0
101
        new ScrambleState( new int[][] {  null, m[ 4], m[ 5] } ),  // x
102
        new ScrambleState( new int[][] { m[ 6],  null, m[ 7] } ),  // y
103
        new ScrambleState( new int[][] { m[ 8], m[ 8],  null } ),  // z
104
        new ScrambleState( new int[][] { m[10],  null, m[ 7] } ),  // xy
105
        new ScrambleState( new int[][] { m[11], m[ 9],  null } ),  // xz
106
        new ScrambleState( new int[][] {  null, m[12], m[ 5] } ),  // yx
107
        new ScrambleState( new int[][] { m[ 8], m[13],  null } ),  // yz
108
        new ScrambleState( new int[][] {  null, m[ 4], m[14] } ),  // zx
109
        new ScrambleState( new int[][] { m[ 6],  null, m[15] } ),  // zy
110
        new ScrambleState( new int[][] {  null,  null, m[ 5] } ),  // xyx
111
        new ScrambleState( new int[][] {  null, m[ 4],  null } ),  // xzx
112
        new ScrambleState( new int[][] {  null,  null, m[ 7] } ),  // yxy
113
        new ScrambleState( new int[][] { m[ 6],  null,  null } ),  // yzy
114
        new ScrambleState( new int[][] {  null, m[ 9],  null } ),  // zxz
115
        new ScrambleState( new int[][] { m[ 8],  null,  null } ),  // zyz
116
        };
117
      }
118

    
119
    return mStates;
120
    }
121

    
122
///////////////////////////////////////////////////////////////////////////////////////////////////
123

    
124
  protected int getResource(int[] numLayers)
125
    {
126
    switch(numLayers[0])
127
      {
128
      case 2: return R.raw.mirr2;
129
      case 3: return R.raw.mirr3;
130
      }
131

    
132
    return 0;
133
    }
134

    
135
///////////////////////////////////////////////////////////////////////////////////////////////////
136

    
137
  private int[] createEdges(int size, int vertex)
138
    {
139
    int[] ret = new int[9*size];
140

    
141
    for(int l=0; l<size; l++)
142
      {
143
      ret[9*l  ] = l;
144
      ret[9*l+1] =-1;
145
      ret[9*l+2] = vertex;
146
      ret[9*l+3] = l;
147
      ret[9*l+4] = 1;
148
      ret[9*l+5] = vertex;
149
      ret[9*l+6] = l;
150
      ret[9*l+7] = 2;
151
      ret[9*l+8] = vertex;
152
      }
153

    
154
    return ret;
155
    }
156

    
157
///////////////////////////////////////////////////////////////////////////////////////////////////
158

    
159
  private void initializeQuats()
160
    {
161
    mQuats = new Static4D[]
162
         {
163
         new Static4D(  0.0f,   0.0f,   0.0f,   1.0f),
164
         new Static4D(  1.0f,   0.0f,   0.0f,   0.0f),
165
         new Static4D(  0.0f,   1.0f,   0.0f,   0.0f),
166
         new Static4D(  0.0f,   0.0f,   1.0f,   0.0f),
167

    
168
         new Static4D( SQ2/2,  SQ2/2,  0.0f ,   0.0f),
169
         new Static4D( SQ2/2, -SQ2/2,  0.0f ,   0.0f),
170
         new Static4D( SQ2/2,   0.0f,  SQ2/2,   0.0f),
171
         new Static4D(-SQ2/2,   0.0f,  SQ2/2,   0.0f),
172
         new Static4D( SQ2/2,   0.0f,   0.0f,  SQ2/2),
173
         new Static4D( SQ2/2,   0.0f,   0.0f, -SQ2/2),
174
         new Static4D(  0.0f,  SQ2/2,  SQ2/2,   0.0f),
175
         new Static4D(  0.0f,  SQ2/2, -SQ2/2,   0.0f),
176
         new Static4D(  0.0f,  SQ2/2,   0.0f,  SQ2/2),
177
         new Static4D(  0.0f,  SQ2/2,   0.0f, -SQ2/2),
178
         new Static4D(  0.0f,   0.0f,  SQ2/2,  SQ2/2),
179
         new Static4D(  0.0f,   0.0f,  SQ2/2, -SQ2/2),
180

    
181
         new Static4D(  0.5f,   0.5f,   0.5f,   0.5f),
182
         new Static4D(  0.5f,   0.5f,  -0.5f,   0.5f),
183
         new Static4D(  0.5f,   0.5f,  -0.5f,  -0.5f),
184
         new Static4D(  0.5f,  -0.5f,   0.5f,  -0.5f),
185
         new Static4D( -0.5f,  -0.5f,  -0.5f,   0.5f),
186
         new Static4D( -0.5f,   0.5f,  -0.5f,  -0.5f),
187
         new Static4D( -0.5f,   0.5f,   0.5f,  -0.5f),
188
         new Static4D( -0.5f,   0.5f,   0.5f,   0.5f)
189
         };
190
    }
191

    
192
///////////////////////////////////////////////////////////////////////////////////////////////////
193
// we cannot do this the standard, automatic way because there's only 1 color in the FACE_COLORS
194
// table and retCubitSolvedStatus() always returns -1,-1 or 0.
195

    
196
  public int[] getSolvedQuats(int cubit, int[] numLayers)
197
    {
198
    if( numLayers[0]==3 )
199
      {
200
      switch(cubit)
201
        {
202
        case  4:
203
        case 21: return new int[] {1,8,9};
204
        case 10:
205
        case 15: return new int[] {2,12,13};
206
        case 12:
207
        case 13: return new int[] {3,14,15};
208
        }
209
      }
210

    
211
    return null;
212
    }
213

    
214
///////////////////////////////////////////////////////////////////////////////////////////////////
215

    
216
  protected int getFaceColor(int cubit, int cubitface, int[] numLayers)
217
    {
218
    int numL = numLayers[0];
219

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

    
323
    return 0;
324
    }
325

    
326
///////////////////////////////////////////////////////////////////////////////////////////////////
327

    
328
  private float returnStroke(float x, float y)
329
    {
330
    return 0.08f/(Math.max(x,y));
331
    }
332

    
333
///////////////////////////////////////////////////////////////////////////////////////////////////
334

    
335
  private float[] generateStrokes(int numLayers)
336
    {
337
    if( numLayers==2 )
338
      {
339
      int LEN = SEQ2.length;
340
      float[] tmp = new float[LEN];
341
      for(int i=0; i<LEN; i++) tmp[i] = returnStroke(SEQ2[i][0],SEQ2[i][1]);
342
      return tmp;
343
      }
344
    else
345
      {
346
      int LEN = SEQ3.length;
347
      float[] tmp = new float[LEN];
348
      for(int i=0; i<LEN; i++) tmp[i] = returnStroke(SEQ3[i][0],SEQ3[i][1]);
349
      return tmp;
350
      }
351
    }
352

    
353
///////////////////////////////////////////////////////////////////////////////////////////////////
354

    
355
  private float[] returnSticker(float x, float y)
356
    {
357
      float H = 0.5f;
358

    
359
      if( x<y ) { float D=H*x/y; return new float[] {-D,-H,+D,-H,+D,+H,-D,+H}; }
360
      else      { float D=H*y/x; return new float[] {-H,-D,+H,-D,+H,+D,-H,+D}; }
361
    }
362

    
363
///////////////////////////////////////////////////////////////////////////////////////////////////
364

    
365
  private float[][] generateStickers(int numLayers)
366
    {
367
    if( numLayers==2 )
368
      {
369
      int LEN = SEQ2.length;
370
      float[][] tmp = new float[LEN][];
371
      for(int i=0; i<LEN; i++) tmp[i] = returnSticker(SEQ2[i][0],SEQ2[i][1]);
372
      return tmp;
373
      }
374
    else
375
      {
376
      int LEN = SEQ3.length;
377
      float[][] tmp = new float[LEN][];
378
      for(int i=0; i<LEN; i++) tmp[i] = returnSticker(SEQ3[i][0],SEQ3[i][1]);
379
      return tmp;
380
      }
381
    }
382

    
383
///////////////////////////////////////////////////////////////////////////////////////////////////
384

    
385
  public ObjectSticker retSticker(int sticker)
386
    {
387
    if( mStickers==null )
388
      {
389
      int[] numLayers = getNumLayers();
390
      int numL = numLayers[0];
391
      final float[][] STICKERS = generateStickers(numL);
392
      final int NUM_STICKERS = STICKERS.length;
393
      final float radius = 0.10f;
394
      final float[] radii = {radius,radius,radius,radius};
395
      float[] STROKES = generateStrokes(numL);
396

    
397
      if( ObjectControl.isInIconMode() )
398
        {
399
        int len = STROKES.length;
400
        float mult = numL==2 ? 1.8f: 2.0f;
401
        for(int i=0; i<len; i++) STROKES[i]*=mult;
402
        }
403

    
404
      mStickers = new ObjectSticker[NUM_STICKERS];
405

    
406
      for(int i=0; i<NUM_STICKERS; i++)
407
        {
408
        mStickers[i] = new ObjectSticker(STICKERS[i],null,radii,STROKES[i]);
409
        }
410
      }
411

    
412
    return mStickers[sticker];
413
    }
414

    
415
///////////////////////////////////////////////////////////////////////////////////////////////////
416

    
417
  protected int getStickerIndex(int face)
418
    {
419
    return face/NUM_FACE_COLORS;
420
    }
421

    
422
///////////////////////////////////////////////////////////////////////////////////////////////////
423

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

    
429
///////////////////////////////////////////////////////////////////////////////////////////////////
430

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

    
436
///////////////////////////////////////////////////////////////////////////////////////////////////
437

    
438
  public ObjectShape getObjectShape(int variant)
439
    {
440
    int extraI, extraV, num, numL = getNumLayers()[0];
441
    float height;
442

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

    
451
    int xrow = getRow(variant,numL,0);  // cubit == variant
452
    int yrow = getRow(variant,numL,1);
453
    int zrow = getRow(variant,numL,2);
454

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

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

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

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

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

    
494
///////////////////////////////////////////////////////////////////////////////////////////////////
495

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

    
502
///////////////////////////////////////////////////////////////////////////////////////////////////
503

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

    
510
///////////////////////////////////////////////////////////////////////////////////////////////////
511

    
512
  public int getCubitVariant(int cubit, int[] numLayers)
513
    {
514
    return cubit;
515
    }
516

    
517
///////////////////////////////////////////////////////////////////////////////////////////////////
518

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

    
524
///////////////////////////////////////////////////////////////////////////////////////////////////
525

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

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

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

    
546
    return mPositions;
547
    }
548

    
549
///////////////////////////////////////////////////////////////////////////////////////////////////
550

    
551
  public Static4D[] getQuats()
552
    {
553
    if( mQuats ==null ) initializeQuats();
554
    return mQuats;
555
    }
556

    
557
///////////////////////////////////////////////////////////////////////////////////////////////////
558

    
559
  protected int getNumFaceColors()
560
    {
561
    return 1;
562
    }
563

    
564
///////////////////////////////////////////////////////////////////////////////////////////////////
565

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

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

    
582
    return mCuts;
583
    }
584

    
585
///////////////////////////////////////////////////////////////////////////////////////////////////
586

    
587
  public boolean[][] getLayerRotatable(int[] numLayers)
588
    {
589
    int numAxis = ROT_AXIS.length;
590
    boolean[][] layerRotatable = new boolean[numAxis][];
591

    
592
    for(int i=0; i<numAxis; i++)
593
      {
594
      layerRotatable[i] = new boolean[numLayers[i]];
595
      for(int j=0; j<numLayers[i]; j++) layerRotatable[i][j] = true;
596
      }
597

    
598
    return layerRotatable;
599
    }
600

    
601
///////////////////////////////////////////////////////////////////////////////////////////////////
602

    
603
  public int getMovementType()
604
    {
605
    return MOVEMENT_HEXAHEDRON;
606
    }
607

    
608
///////////////////////////////////////////////////////////////////////////////////////////////////
609

    
610
  public int getMovementSplit()
611
    {
612
    return TYPE_NOT_SPLIT;
613
    }
614

    
615
///////////////////////////////////////////////////////////////////////////////////////////////////
616

    
617
  public int[][][] getEnabled()
618
    {
619
    return new int[][][]
620
      {
621
          {{1,2}},{{1,2}},{{0,2}},{{0,2}},{{0,1}},{{0,1}},
622
      };
623
    }
624

    
625
///////////////////////////////////////////////////////////////////////////////////////////////////
626

    
627
  public float[] getDist3D(int[] numLayers)
628
    {
629
    return null;
630
    }
631

    
632
///////////////////////////////////////////////////////////////////////////////////////////////////
633

    
634
  public int getSolvedFunctionIndex()
635
    {
636
    return 0;
637
    }
638

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

    
641
  protected int getNumCubitFaces()
642
    {
643
    return 6;
644
    }
645

    
646
///////////////////////////////////////////////////////////////////////////////////////////////////
647
// PUBLIC API
648

    
649
  public Static3D[] getRotationAxis()
650
    {
651
    return ROT_AXIS;
652
    }
653

    
654
///////////////////////////////////////////////////////////////////////////////////////////////////
655

    
656
  public int[] getBasicAngle()
657
    {
658
    if( mBasicAngle==null ) mBasicAngle = new int[] { 4,4,4 };
659
    return mBasicAngle;
660
    }
661

    
662
///////////////////////////////////////////////////////////////////////////////////////////////////
663

    
664
  public ObjectType intGetObjectType(int[] numLayers)
665
    {
666
    switch(numLayers[0])
667
      {
668
      case 2: return ObjectType.MIRR_2;
669
      case 3: return ObjectType.MIRR_3;
670
      }
671

    
672
    return ObjectType.MIRR_2;
673
    }
674

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

    
677
  public int getObjectName(int[] numLayers)
678
    {
679
    switch(numLayers[0])
680
      {
681
      case 2: return R.string.mirr2;
682
      case 3: return R.string.mirr3;
683
      }
684
    return R.string.mirr3;
685
    }
686

    
687
///////////////////////////////////////////////////////////////////////////////////////////////////
688

    
689
  public int getInventor(int[] numLayers)
690
    {
691
    switch(numLayers[0])
692
      {
693
      case 2: return R.string.mirr2_inventor;
694
      case 3: return R.string.mirr3_inventor;
695
      }
696
    return R.string.mirr3_inventor;
697
    }
698

    
699
///////////////////////////////////////////////////////////////////////////////////////////////////
700

    
701
  public int getYearOfInvention(int[] numLayers)
702
    {
703
    switch(numLayers[0])
704
      {
705
      case 2: return 2007;
706
      case 3: return 2006;
707
      }
708
    return 2006;
709
    }
710

    
711
///////////////////////////////////////////////////////////////////////////////////////////////////
712

    
713
  public int getComplexity(int[] numLayers)
714
    {
715
    switch(numLayers[0])
716
      {
717
      case 2: return 5;
718
      case 3: return 7;
719
      }
720
    return 7;
721
    }
722
}
(17-17/25)