Project

General

Profile

Download (23.8 KB) Statistics
| Branch: | Tag: | Revision:

magiccube / src / main / java / org / distorted / objects / TwistyMirror.java @ e9a87113

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.objects;
21

    
22
import android.content.res.Resources;
23

    
24
import org.distorted.helpers.ObjectShape;
25
import org.distorted.helpers.ObjectSticker;
26
import org.distorted.helpers.ScrambleState;
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
import org.distorted.main.R;
33

    
34
///////////////////////////////////////////////////////////////////////////////////////////////////
35

    
36
class TwistyMirror extends TwistyObject
37
{
38
  static final Static3D[] ROT_AXIS = new Static3D[]
39
         {
40
           new Static3D(1,0,0),
41
           new Static3D(0,1,0),
42
           new Static3D(0,0,1)
43
         };
44

    
45
  private static final int[] FACE_COLORS = new int[] { COLOR_WHITE };
46
  private static final float DX = 0.10f;
47
  private static final float DY = 0.25f;
48
  private static final float DZ = 0.40f;
49

    
50
  private ScrambleState[] mStates;
51
  private Static4D[] mQuats;
52
  private int[] mBasicAngle;
53
  private ObjectSticker[] mStickers;
54
  private float[][] mPositions;
55
  private Movement mMovement;
56

    
57
///////////////////////////////////////////////////////////////////////////////////////////////////
58

    
59
  TwistyMirror(int size, Static4D quat, DistortedTexture texture, MeshSquare mesh,
60
               DistortedEffects effects, int[][] moves, Resources res, int scrWidth)
61
    {
62
    super(size, size, quat, texture, mesh, effects, moves, ObjectList.MIRR, res, scrWidth);
63
    }
64

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

    
67
  ScrambleState[] getScrambleStates()
68
    {
69
    if( mStates==null )
70
      {
71
      int size = getNumLayers();
72
      int[][] m = new int[16][];
73
      for(int i=1; i<16; i++) m[i] = createEdges(size,i);
74

    
75
      mStates = new ScrambleState[]
76
        {
77
        new ScrambleState( new int[][] { m[ 1], m[ 2], m[ 3] } ),  // 0
78
        new ScrambleState( new int[][] {  null, m[ 4], m[ 5] } ),  // x
79
        new ScrambleState( new int[][] { m[ 6],  null, m[ 7] } ),  // y
80
        new ScrambleState( new int[][] { m[ 8], m[ 8],  null } ),  // z
81
        new ScrambleState( new int[][] { m[10],  null, m[ 7] } ),  // xy
82
        new ScrambleState( new int[][] { m[11], m[ 9],  null } ),  // xz
83
        new ScrambleState( new int[][] {  null, m[12], m[ 5] } ),  // yx
84
        new ScrambleState( new int[][] { m[ 8], m[13],  null } ),  // yz
85
        new ScrambleState( new int[][] {  null, m[ 4], m[14] } ),  // zx
86
        new ScrambleState( new int[][] { m[ 6],  null, m[15] } ),  // zy
87
        new ScrambleState( new int[][] {  null,  null, m[ 5] } ),  // xyx
88
        new ScrambleState( new int[][] {  null, m[ 4],  null } ),  // xzx
89
        new ScrambleState( new int[][] {  null,  null, m[ 7] } ),  // yxy
90
        new ScrambleState( new int[][] { m[ 6],  null,  null } ),  // yzy
91
        new ScrambleState( new int[][] {  null, m[ 9],  null } ),  // zxz
92
        new ScrambleState( new int[][] { m[ 8],  null,  null } ),  // zyz
93
        };
94
      }
95

    
96
    return mStates;
97
    }
98

    
99
///////////////////////////////////////////////////////////////////////////////////////////////////
100

    
101
  private int[] createEdges(int size, int vertex)
102
    {
103
    int[] ret = new int[9*size];
104

    
105
    for(int l=0; l<size; l++)
106
      {
107
      ret[9*l  ] = l;
108
      ret[9*l+1] =-1;
109
      ret[9*l+2] = vertex;
110
      ret[9*l+3] = l;
111
      ret[9*l+4] = 1;
112
      ret[9*l+5] = vertex;
113
      ret[9*l+6] = l;
114
      ret[9*l+7] = 2;
115
      ret[9*l+8] = vertex;
116
      }
117

    
118
    return ret;
119
    }
120

    
121
///////////////////////////////////////////////////////////////////////////////////////////////////
122

    
123
  private void initializeQuats()
124
    {
125
    mQuats = new Static4D[]
126
         {
127
         new Static4D(  0.0f,   0.0f,   0.0f,   1.0f),
128
         new Static4D(  1.0f,   0.0f,   0.0f,   0.0f),
129
         new Static4D(  0.0f,   1.0f,   0.0f,   0.0f),
130
         new Static4D(  0.0f,   0.0f,   1.0f,   0.0f),
131

    
132
         new Static4D( SQ2/2,  SQ2/2,  0.0f ,   0.0f),
133
         new Static4D( SQ2/2, -SQ2/2,  0.0f ,   0.0f),
134
         new Static4D( SQ2/2,   0.0f,  SQ2/2,   0.0f),
135
         new Static4D(-SQ2/2,   0.0f,  SQ2/2,   0.0f),
136
         new Static4D( SQ2/2,   0.0f,   0.0f,  SQ2/2),
137
         new Static4D( SQ2/2,   0.0f,   0.0f, -SQ2/2),
138
         new Static4D(  0.0f,  SQ2/2,  SQ2/2,   0.0f),
139
         new Static4D(  0.0f,  SQ2/2, -SQ2/2,   0.0f),
140
         new Static4D(  0.0f,  SQ2/2,   0.0f,  SQ2/2),
141
         new Static4D(  0.0f,  SQ2/2,   0.0f, -SQ2/2),
142
         new Static4D(  0.0f,   0.0f,  SQ2/2,  SQ2/2),
143
         new Static4D(  0.0f,   0.0f,  SQ2/2, -SQ2/2),
144

    
145
         new Static4D(  0.5f,   0.5f,   0.5f,   0.5f),
146
         new Static4D(  0.5f,   0.5f,  -0.5f,   0.5f),
147
         new Static4D(  0.5f,   0.5f,  -0.5f,  -0.5f),
148
         new Static4D(  0.5f,  -0.5f,   0.5f,  -0.5f),
149
         new Static4D( -0.5f,  -0.5f,  -0.5f,   0.5f),
150
         new Static4D( -0.5f,   0.5f,  -0.5f,  -0.5f),
151
         new Static4D( -0.5f,   0.5f,   0.5f,  -0.5f),
152
         new Static4D( -0.5f,   0.5f,   0.5f,   0.5f)
153
         };
154
    }
155

    
156
///////////////////////////////////////////////////////////////////////////////////////////////////
157
// we cannot do this the standard, automatic way because there's only 1 color in the FACE_COLORS
158
// table and retCubitSolvedStatus() always returns -1,-1 or 0.
159

    
160
  int[] getSolvedQuats(int cubit, int numLayers)
161
    {
162
    if( numLayers==3 )
163
      {
164
      switch(cubit)
165
        {
166
        case  4:
167
        case 21: return new int[] {1,8,9};
168
        case 10:
169
        case 15: return new int[] {2,12,13};
170
        case 12:
171
        case 13: return new int[] {3,14,15};
172
        }
173
      }
174

    
175
    return null;
176
    }
177

    
178
///////////////////////////////////////////////////////////////////////////////////////////////////
179

    
180
  int getFaceColor(int cubit, int cubitface, int numLayers)
181
    {
182
    if( numLayers==2 )
183
      {
184
      switch(cubitface)
185
        {
186
        case 0: if( cubit==4 ) return 11;
187
                if( cubit==5 ) return 10;
188
                if( cubit==6 ) return  9;
189
                if( cubit==7 ) return  8;
190
                return NUM_TEXTURES;
191
        case 1: if( cubit==0 ) return 11;
192
                if( cubit==1 ) return 10;
193
                if( cubit==2 ) return  9;
194
                if( cubit==3 ) return  8;
195
                return NUM_TEXTURES;
196
        case 2: if( cubit==3 ) return  4;
197
                if( cubit==7 ) return  5;
198
                if( cubit==2 ) return  6;
199
                if( cubit==6 ) return  7;
200
                return NUM_TEXTURES;
201
        case 3: if( cubit==1 ) return  4;
202
                if( cubit==5 ) return  5;
203
                if( cubit==0 ) return  6;
204
                if( cubit==4 ) return  7;
205
                return NUM_TEXTURES;
206
        case 4: if( cubit==3 ) return  0;
207
                if( cubit==7 ) return  1;
208
                if( cubit==1 ) return  2;
209
                if( cubit==5 ) return  3;
210
                return NUM_TEXTURES;
211
        case 5: if( cubit==2 ) return  0;
212
                if( cubit==6 ) return  1;
213
                if( cubit==0 ) return  2;
214
                if( cubit==4 ) return  3;
215
                return NUM_TEXTURES;
216
        }
217
      }
218
    if( numLayers==3 )
219
      {
220
      switch(cubitface)
221
        {
222
        case 0: if( cubit==17 ) return 24;
223
                if( cubit==18 ) return 23;
224
                if( cubit==19 ) return 22;
225
                if( cubit==20 ) return 21;
226
                if( cubit==21 ) return  0;
227
                if( cubit==22 ) return 20;
228
                if( cubit==23 ) return 19;
229
                if( cubit==24 ) return 18;
230
                if( cubit==25 ) return 17;
231
                return NUM_TEXTURES;
232
        case 1: if( cubit== 0 ) return 24;
233
                if( cubit== 1 ) return 23;
234
                if( cubit== 2 ) return 22;
235
                if( cubit== 3 ) return 21;
236
                if( cubit== 4 ) return  0;
237
                if( cubit== 5 ) return 20;
238
                if( cubit== 6 ) return 19;
239
                if( cubit== 7 ) return 18;
240
                if( cubit== 8 ) return 17;
241
                return NUM_TEXTURES;
242
        case 2: if( cubit== 6 ) return 14;
243
                if( cubit==14 ) return  2; // theoretically should have been 15, but this must have gotten collapsed in the Factory
244
                if( cubit==23 ) return 16;
245
                if( cubit== 7 ) return 12;
246
                if( cubit==15 ) return  0;
247
                if( cubit==24 ) return 13;
248
                if( cubit== 8 ) return  9;
249
                if( cubit==16 ) return 20; // ditto, theoretically 10
250
                if( cubit==25 ) return 11;
251
                return NUM_TEXTURES;
252
        case 3: if( cubit== 0 ) return 14;
253
                if( cubit== 9 ) return  2; // ditto, theoretically 15
254
                if( cubit==17 ) return 16;
255
                if( cubit== 1 ) return 12;
256
                if( cubit==10 ) return  0;
257
                if( cubit==18 ) return 13;
258
                if( cubit== 2 ) return  9;
259
                if( cubit==11 ) return 20; // ditto, theoretically 10
260
                if( cubit==19 ) return 11;
261
                return NUM_TEXTURES;
262
        case 4: if( cubit== 8 ) return  1;
263
                if( cubit==16 ) return  2;
264
                if( cubit==25 ) return  3;
265
                if( cubit== 5 ) return  4;
266
                if( cubit==13 ) return  0;
267
                if( cubit==22 ) return  5;
268
                if( cubit== 2 ) return  6;
269
                if( cubit==11 ) return  7;
270
                if( cubit==19 ) return  8;
271
                return NUM_TEXTURES;
272
        case 5: if( cubit== 6 ) return  1;
273
                if( cubit==14 ) return  2;
274
                if( cubit==23 ) return  3;
275
                if( cubit== 3 ) return  4;
276
                if( cubit==12 ) return  0;
277
                if( cubit==20 ) return  5;
278
                if( cubit== 0 ) return  6;
279
                if( cubit== 9 ) return  7;
280
                if( cubit==17 ) return  8;
281
                return NUM_TEXTURES;
282
        }
283
      }
284

    
285
    return 0;
286
    }
287

    
288
///////////////////////////////////////////////////////////////////////////////////////////////////
289

    
290
  private float returnStroke(float x, float y)
291
    {
292
    return 0.08f/(Math.max(x,y));
293
    }
294

    
295
///////////////////////////////////////////////////////////////////////////////////////////////////
296

    
297
  private float[] generateStrokes()
298
    {
299
    int num = getNumLayers();
300
    final float A = 0.08f;
301

    
302
    if( num==2 )
303
      {
304
      return new float[] {
305
                           returnStroke(1-DX,1-DY),
306
                           returnStroke(1+DX,1-DY),
307
                           returnStroke(1-DX,1+DY),
308
                           returnStroke(1+DX,1+DY),
309
                           returnStroke(1-DX,1-DZ),
310
                           returnStroke(1+DX,1-DZ),
311
                           returnStroke(1-DX,1+DZ),
312
                           returnStroke(1+DX,1+DZ),
313
                           returnStroke(1-DZ,1-DY),
314
                           returnStroke(1+DZ,1-DY),
315
                           returnStroke(1-DZ,1+DY),
316
                           returnStroke(1+DZ,1+DY),
317

    
318
                           A/(1-DX), A/(1+DX), A/(1+DY), A/(1+DY),
319
                           A/(1-DX), A/(1+DX), A/(1+DZ), A/(1+DZ),
320
                           A/(1-DY), A/(1+DY), A/(1+DZ), A/(1+DZ),
321
                         };
322
      }
323
    else
324
      {
325
      return new float[] {
326
                           returnStroke(1   ,1   ),
327

    
328
                           returnStroke(1-DX,1-DY),
329
                           returnStroke(1   ,1-DY),
330
                           returnStroke(1+DX,1-DY),
331
                           returnStroke(1-DX,1   ),
332
                           returnStroke(1+DX,1   ),
333
                           returnStroke(1-DX,1+DY),
334
                           returnStroke(1   ,1+DY),
335
                           returnStroke(1+DX,1+DY),
336

    
337
                           returnStroke(1-DX,1-DZ),
338
                           returnStroke(1   ,1-DZ),
339
                           returnStroke(1+DX,1-DZ),
340
                           returnStroke(1-DX,1   ),
341
                           returnStroke(1+DX,1   ),
342
                           returnStroke(1-DX,1+DZ),
343
                           returnStroke(1   ,1+DZ),
344
                           returnStroke(1+DX,1+DZ),
345

    
346
                           returnStroke(1-DZ,1-DY),
347
                           returnStroke(1   ,1-DY),
348
                           returnStroke(1+DZ,1-DY),
349
                           returnStroke(1-DZ,1   ),
350
                           returnStroke(1+DZ,1   ),
351
                           returnStroke(1-DZ,1+DY),
352
                           returnStroke(1   ,1+DY),
353
                           returnStroke(1+DZ,1+DY),
354
                         };
355
      }
356
    }
357

    
358
///////////////////////////////////////////////////////////////////////////////////////////////////
359

    
360
  private float[] returnSticker(float x, float y)
361
    {
362
      float H = 0.5f;
363

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

    
368
///////////////////////////////////////////////////////////////////////////////////////////////////
369

    
370
  private float[][] generateStickers()
371
    {
372
    int num = getNumLayers();
373

    
374
    if( num==2 )
375
      {
376
      return new float[][]
377
          {
378
              returnSticker(1-DX,1-DY),
379
              returnSticker(1+DX,1-DY),
380
              returnSticker(1-DX,1+DY),
381
              returnSticker(1+DX,1+DY),
382
              returnSticker(1-DX,1-DZ),
383
              returnSticker(1+DX,1-DZ),
384
              returnSticker(1-DX,1+DZ),
385
              returnSticker(1+DX,1+DZ),
386
              returnSticker(1-DZ,1-DY),
387
              returnSticker(1+DZ,1-DY),
388
              returnSticker(1-DZ,1+DY),
389
              returnSticker(1+DZ,1+DY),
390
          };
391
      }
392
    else
393
      {
394
      return new float[][]
395
          {
396
              returnSticker(1   ,1   ),
397

    
398
              returnSticker(1-DX,1-DY),
399
              returnSticker(1   ,1-DY),
400
              returnSticker(1+DX,1-DY),
401
              returnSticker(1-DX,1   ),
402
              returnSticker(1+DX,1   ),
403
              returnSticker(1-DX,1+DY),
404
              returnSticker(1   ,1+DY),
405
              returnSticker(1+DX,1+DY),
406

    
407
              returnSticker(1-DX,1-DZ),
408
              returnSticker(1   ,1-DZ),
409
              returnSticker(1+DX,1-DZ),
410
              returnSticker(1-DX,1   ),
411
              returnSticker(1+DX,1   ),
412
              returnSticker(1-DX,1+DZ),
413
              returnSticker(1   ,1+DZ),
414
              returnSticker(1+DX,1+DZ),
415

    
416
              returnSticker(1-DZ,1-DY),
417
              returnSticker(1   ,1-DY),
418
              returnSticker(1+DZ,1-DY),
419
              returnSticker(1-DZ,1   ),
420
              returnSticker(1+DZ,1   ),
421
              returnSticker(1-DZ,1+DY),
422
              returnSticker(1   ,1+DY),
423
              returnSticker(1+DZ,1+DY),
424
          };
425
      }
426
    }
427

    
428
///////////////////////////////////////////////////////////////////////////////////////////////////
429

    
430
  ObjectSticker retSticker(int face)
431
    {
432
    if( mStickers==null )
433
      {
434
      final float[][] STICKERS = generateStickers();
435
      final float[] STROKES = generateStrokes();
436
      final int NUM_STICKERS = STICKERS.length;
437
      final float radius = 0.10f;
438
      final float[] radii = {radius,radius,radius,radius};
439
      mStickers = new ObjectSticker[NUM_STICKERS];
440

    
441
      for(int i=0; i<NUM_STICKERS; i++)
442
        {
443
        mStickers[i] = new ObjectSticker(STICKERS[i],null,radii,STROKES[i]);
444
        }
445
      }
446

    
447
    return mStickers[face/NUM_FACE_COLORS];
448
    }
449

    
450
///////////////////////////////////////////////////////////////////////////////////////////////////
451

    
452
  int getNumStickerTypes(int numLayers)
453
    {
454
    return numLayers==2 ? 12 : 25;
455
    }
456

    
457
///////////////////////////////////////////////////////////////////////////////////////////////////
458

    
459
  private int getRow(int cubit, int numLayers, int dim)
460
    {
461
    return (int)(mPositions[cubit][dim] + 0.5f*(numLayers-1));
462
    }
463

    
464
///////////////////////////////////////////////////////////////////////////////////////////////////
465

    
466
  ObjectShape getObjectShape(int cubit, int numLayers)
467
    {
468
    int extraI, extraV, num;
469
    float height;
470

    
471
    switch(numLayers)
472
      {
473
      case 2 : num = 6; extraI = 2; extraV = 2; height = 0.045f; break;
474
      case 3 : num = 5; extraI = 2; extraV = 2; height = 0.045f; break;
475
      case 4 : num = 5; extraI = 1; extraV = 1; height = 0.045f; break;
476
      default: num = 5; extraI = 0; extraV = 0; height = 0.045f; break;
477
      }
478

    
479
    int xrow = getRow(cubit,numLayers,0);
480
    int yrow = getRow(cubit,numLayers,1);
481
    int zrow = getRow(cubit,numLayers,2);
482

    
483
    float XL = -0.5f + (xrow==          0 ? DX : 0);
484
    float XR = +0.5f + (xrow==numLayers-1 ? DX : 0);
485
    float YL = -0.5f - (yrow==          0 ? DY : 0);
486
    float YR = +0.5f - (yrow==numLayers-1 ? DY : 0);
487
    float ZL = -0.5f - (zrow==          0 ? DZ : 0);
488
    float ZR = +0.5f - (zrow==numLayers-1 ? DZ : 0);
489

    
490
    double[][] vertices = new double[][]
491
          {
492
              { XR, YR, ZR },
493
              { XR, YR, ZL },
494
              { XR, YL, ZR },
495
              { XR, YL, ZL },
496
              { XL, YR, ZR },
497
              { XL, YR, ZL },
498
              { XL, YL, ZR },
499
              { XL, YL, ZL },
500
          };
501

    
502
    int[][] vert_indices = new int[][]
503
          {
504
              {2,3,1,0},
505
              {7,6,4,5},
506
              {4,0,1,5},
507
              {7,3,2,6},
508
              {6,2,0,4},
509
              {3,7,5,1}
510
          };
511

    
512
    float[][] bands     = new float[][] { {height,35,0.5f,0.7f,num,extraI,extraV} };
513
    int[] bandIndices   = new int[] { 0,0,0,0,0,0};
514
    float[][] corners   = new float[][] { {0.036f,0.12f} };
515
    int[] cornerIndices = new int[] { 0,0,0,0,0,0,0,0 };
516
    float[][] centers   = new float[][] { {0.0f, 0.0f, 0.0f} };
517
    int[] centerIndices = new int[] { 0,0,0,0,0,0,0,0 };
518

    
519
    return new ObjectShape(vertices,vert_indices,bands,bandIndices,corners,cornerIndices,centers,centerIndices,getNumCubitFaces(), null);
520
    }
521

    
522
///////////////////////////////////////////////////////////////////////////////////////////////////
523

    
524
  Static4D getQuat(int cubit, int numLayers)
525
    {
526
    if( mQuats ==null ) initializeQuats();
527
    return mQuats[0];
528
    }
529

    
530
///////////////////////////////////////////////////////////////////////////////////////////////////
531

    
532
  int getNumCubitVariants(int numLayers)
533
    {
534
    return 6*numLayers*numLayers - 12*numLayers + 8;
535
    }
536

    
537
///////////////////////////////////////////////////////////////////////////////////////////////////
538

    
539
  int getCubitVariant(int cubit, int numLayers)
540
    {
541
    return cubit;
542
    }
543

    
544
///////////////////////////////////////////////////////////////////////////////////////////////////
545

    
546
  int getColor(int face)
547
    {
548
    return FACE_COLORS[face];
549
    }
550

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

    
553
  float[][] getCubitPositions(int numLayers)
554
    {
555
    if( mPositions==null )
556
      {
557
      int numCubits = numLayers>1 ? 6*numLayers*numLayers - 12*numLayers + 8 : 1;
558
      mPositions = new float[numCubits][];
559

    
560
      float diff = 0.5f*(numLayers-1);
561
      int currentPosition = 0;
562

    
563
      for(int x = 0; x<numLayers; x++)
564
        for(int y = 0; y<numLayers; y++)
565
          for(int z = 0; z<numLayers; z++)
566
            if( x==0 || x==numLayers-1 || y==0 || y==numLayers-1 || z==0 || z==numLayers-1 )
567
              {
568
              mPositions[currentPosition++] = new float[] {x-diff,y-diff,z-diff};
569
              }
570
      }
571

    
572
    return mPositions;
573
    }
574

    
575
///////////////////////////////////////////////////////////////////////////////////////////////////
576

    
577
  Static4D[] getQuats()
578
    {
579
    if( mQuats ==null ) initializeQuats();
580
    return mQuats;
581
    }
582

    
583
///////////////////////////////////////////////////////////////////////////////////////////////////
584

    
585
  boolean shouldResetTextureMaps()
586
    {
587
    return false;
588
    }
589

    
590
///////////////////////////////////////////////////////////////////////////////////////////////////
591

    
592
  int getNumFaceColors()
593
    {
594
    return FACE_COLORS.length;
595
    }
596

    
597
///////////////////////////////////////////////////////////////////////////////////////////////////
598

    
599
  float[][] getCuts(int numLayers)
600
    {
601
    float[][] cuts = new float[3][numLayers-1];
602

    
603
    for(int i=0; i<numLayers-1; i++)
604
      {
605
      float cut = (2-numLayers)*0.5f + i;
606
      cuts[0][i] = cut;
607
      cuts[1][i] = cut;
608
      cuts[2][i] = cut;
609
      }
610

    
611
    return cuts;
612
    }
613

    
614
///////////////////////////////////////////////////////////////////////////////////////////////////
615

    
616
  int getSolvedFunctionIndex()
617
    {
618
    return 0;
619
    }
620

    
621
///////////////////////////////////////////////////////////////////////////////////////////////////
622

    
623
  int getNumCubitFaces()
624
    {
625
    return 6;
626
    }
627

    
628
///////////////////////////////////////////////////////////////////////////////////////////////////
629

    
630
  float getScreenRatio()
631
    {
632
    return 0.5f;
633
    }
634

    
635
///////////////////////////////////////////////////////////////////////////////////////////////////
636

    
637
  float returnMultiplier()
638
    {
639
    return getNumLayers();
640
    }
641

    
642
///////////////////////////////////////////////////////////////////////////////////////////////////
643
// PUBLIC API
644

    
645
  public Static3D[] getRotationAxis()
646
    {
647
    return ROT_AXIS;
648
    }
649

    
650
///////////////////////////////////////////////////////////////////////////////////////////////////
651

    
652
  public Movement getMovement()
653
    {
654
    if( mMovement==null ) mMovement = new MovementCube();
655
    return mMovement;
656
    }
657

    
658
///////////////////////////////////////////////////////////////////////////////////////////////////
659

    
660
  public int[] getBasicAngle()
661
    {
662
    if( mBasicAngle==null ) mBasicAngle = new int[] { 4,4,4 };
663
    return mBasicAngle;
664
    }
665

    
666
///////////////////////////////////////////////////////////////////////////////////////////////////
667

    
668
  public int getObjectName(int numLayers)
669
    {
670
    switch(numLayers)
671
      {
672
      case 2: return R.string.mirr2;
673
      case 3: return R.string.mirr3;
674
      }
675
    return R.string.mirr3;
676
    }
677

    
678
///////////////////////////////////////////////////////////////////////////////////////////////////
679

    
680
  public int getInventor(int numLayers)
681
    {
682
    switch(numLayers)
683
      {
684
      case 2: return R.string.mirr2_inventor;
685
      case 3: return R.string.mirr3_inventor;
686
      }
687
    return R.string.mirr3_inventor;
688
    }
689

    
690
///////////////////////////////////////////////////////////////////////////////////////////////////
691

    
692
  public int getComplexity(int numLayers)
693
    {
694
    switch(numLayers)
695
      {
696
      case 2: return 5;
697
      case 3: return 7;
698
      }
699
    return 7;
700
    }
701
}
(34-34/44)