Project

General

Profile

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

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

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.ObjectList;
36
import org.distorted.objectlib.main.ObjectShape;
37
import org.distorted.objectlib.main.ObjectSticker;
38
import org.distorted.objectlib.main.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[][][] ENABLED = new int[][][]
53
      {
54
          {{1,2}},{{1,2}},{{0,2}},{{0,2}},{{0,1}},{{0,1}},
55
      };
56

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

    
62
  private ScrambleState[] mStates;
63
  private Static4D[] mQuats;
64
  private float[][] mCuts;
65
  private boolean[][] mLayerRotatable;
66
  private int[] mBasicAngle;
67
  private ObjectSticker[] mStickers;
68
  private float[][] mPositions;
69
  private Movement mMovement;
70

    
71
///////////////////////////////////////////////////////////////////////////////////////////////////
72

    
73
  public TwistyMirror(int size, Static4D quat, DistortedTexture texture, MeshSquare mesh,
74
                      DistortedEffects effects, int[][] moves, Resources res, int scrWidth)
75
    {
76
    super(size, size, quat, texture, mesh, effects, moves, ObjectList.MIRR, res, scrWidth);
77
    }
78

    
79
///////////////////////////////////////////////////////////////////////////////////////////////////
80

    
81
  protected ScrambleState[] getScrambleStates()
82
    {
83
    if( mStates==null )
84
      {
85
      int size = getNumLayers();
86
      int[][] m = new int[16][];
87
      for(int i=1; i<16; i++) m[i] = createEdges(size,i);
88

    
89
      mStates = new ScrambleState[]
90
        {
91
        new ScrambleState( new int[][] { m[ 1], m[ 2], m[ 3] } ),  // 0
92
        new ScrambleState( new int[][] {  null, m[ 4], m[ 5] } ),  // x
93
        new ScrambleState( new int[][] { m[ 6],  null, m[ 7] } ),  // y
94
        new ScrambleState( new int[][] { m[ 8], m[ 8],  null } ),  // z
95
        new ScrambleState( new int[][] { m[10],  null, m[ 7] } ),  // xy
96
        new ScrambleState( new int[][] { m[11], m[ 9],  null } ),  // xz
97
        new ScrambleState( new int[][] {  null, m[12], m[ 5] } ),  // yx
98
        new ScrambleState( new int[][] { m[ 8], m[13],  null } ),  // yz
99
        new ScrambleState( new int[][] {  null, m[ 4], m[14] } ),  // zx
100
        new ScrambleState( new int[][] { m[ 6],  null, m[15] } ),  // zy
101
        new ScrambleState( new int[][] {  null,  null, m[ 5] } ),  // xyx
102
        new ScrambleState( new int[][] {  null, m[ 4],  null } ),  // xzx
103
        new ScrambleState( new int[][] {  null,  null, m[ 7] } ),  // yxy
104
        new ScrambleState( new int[][] { m[ 6],  null,  null } ),  // yzy
105
        new ScrambleState( new int[][] {  null, m[ 9],  null } ),  // zxz
106
        new ScrambleState( new int[][] { m[ 8],  null,  null } ),  // zyz
107
        };
108
      }
109

    
110
    return mStates;
111
    }
112

    
113
///////////////////////////////////////////////////////////////////////////////////////////////////
114

    
115
  private int[] createEdges(int size, int vertex)
116
    {
117
    int[] ret = new int[9*size];
118

    
119
    for(int l=0; l<size; l++)
120
      {
121
      ret[9*l  ] = l;
122
      ret[9*l+1] =-1;
123
      ret[9*l+2] = vertex;
124
      ret[9*l+3] = l;
125
      ret[9*l+4] = 1;
126
      ret[9*l+5] = vertex;
127
      ret[9*l+6] = l;
128
      ret[9*l+7] = 2;
129
      ret[9*l+8] = vertex;
130
      }
131

    
132
    return ret;
133
    }
134

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

    
137
  private void initializeQuats()
138
    {
139
    mQuats = new Static4D[]
140
         {
141
         new Static4D(  0.0f,   0.0f,   0.0f,   1.0f),
142
         new Static4D(  1.0f,   0.0f,   0.0f,   0.0f),
143
         new Static4D(  0.0f,   1.0f,   0.0f,   0.0f),
144
         new Static4D(  0.0f,   0.0f,   1.0f,   0.0f),
145

    
146
         new Static4D( SQ2/2,  SQ2/2,  0.0f ,   0.0f),
147
         new Static4D( SQ2/2, -SQ2/2,  0.0f ,   0.0f),
148
         new Static4D( SQ2/2,   0.0f,  SQ2/2,   0.0f),
149
         new Static4D(-SQ2/2,   0.0f,  SQ2/2,   0.0f),
150
         new Static4D( SQ2/2,   0.0f,   0.0f,  SQ2/2),
151
         new Static4D( SQ2/2,   0.0f,   0.0f, -SQ2/2),
152
         new Static4D(  0.0f,  SQ2/2,  SQ2/2,   0.0f),
153
         new Static4D(  0.0f,  SQ2/2, -SQ2/2,   0.0f),
154
         new Static4D(  0.0f,  SQ2/2,   0.0f,  SQ2/2),
155
         new Static4D(  0.0f,  SQ2/2,   0.0f, -SQ2/2),
156
         new Static4D(  0.0f,   0.0f,  SQ2/2,  SQ2/2),
157
         new Static4D(  0.0f,   0.0f,  SQ2/2, -SQ2/2),
158

    
159
         new Static4D(  0.5f,   0.5f,   0.5f,   0.5f),
160
         new Static4D(  0.5f,   0.5f,  -0.5f,   0.5f),
161
         new Static4D(  0.5f,   0.5f,  -0.5f,  -0.5f),
162
         new Static4D(  0.5f,  -0.5f,   0.5f,  -0.5f),
163
         new Static4D( -0.5f,  -0.5f,  -0.5f,   0.5f),
164
         new Static4D( -0.5f,   0.5f,  -0.5f,  -0.5f),
165
         new Static4D( -0.5f,   0.5f,   0.5f,  -0.5f),
166
         new Static4D( -0.5f,   0.5f,   0.5f,   0.5f)
167
         };
168
    }
169

    
170
///////////////////////////////////////////////////////////////////////////////////////////////////
171
// we cannot do this the standard, automatic way because there's only 1 color in the FACE_COLORS
172
// table and retCubitSolvedStatus() always returns -1,-1 or 0.
173

    
174
  protected int[] getSolvedQuats(int cubit, int numLayers)
175
    {
176
    if( numLayers==3 )
177
      {
178
      switch(cubit)
179
        {
180
        case  4:
181
        case 21: return new int[] {1,8,9};
182
        case 10:
183
        case 15: return new int[] {2,12,13};
184
        case 12:
185
        case 13: return new int[] {3,14,15};
186
        }
187
      }
188

    
189
    return null;
190
    }
191

    
192
///////////////////////////////////////////////////////////////////////////////////////////////////
193

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

    
299
    return 0;
300
    }
301

    
302
///////////////////////////////////////////////////////////////////////////////////////////////////
303

    
304
  private float returnStroke(float x, float y)
305
    {
306
    return 0.08f/(Math.max(x,y));
307
    }
308

    
309
///////////////////////////////////////////////////////////////////////////////////////////////////
310

    
311
  private float[] generateStrokes()
312
    {
313
    int num = getNumLayers();
314
    final float A = 0.08f;
315

    
316
    if( num==2 )
317
      {
318
      return new float[] {
319
                           returnStroke(1-DX,1-DY),
320
                           returnStroke(1+DX,1-DY),
321
                           returnStroke(1-DX,1+DY),
322
                           returnStroke(1+DX,1+DY),
323
                           returnStroke(1-DX,1-DZ),
324
                           returnStroke(1+DX,1-DZ),
325
                           returnStroke(1-DX,1+DZ),
326
                           returnStroke(1+DX,1+DZ),
327
                           returnStroke(1-DZ,1-DY),
328
                           returnStroke(1+DZ,1-DY),
329
                           returnStroke(1-DZ,1+DY),
330
                           returnStroke(1+DZ,1+DY),
331

    
332
                           A/(1-DX), A/(1+DX), A/(1+DY), A/(1+DY),
333
                           A/(1-DX), A/(1+DX), A/(1+DZ), A/(1+DZ),
334
                           A/(1-DY), A/(1+DY), A/(1+DZ), A/(1+DZ),
335
                         };
336
      }
337
    else
338
      {
339
      return new float[] {
340
                           returnStroke(1   ,1   ),
341

    
342
                           returnStroke(1-DX,1-DY),
343
                           returnStroke(1   ,1-DY),
344
                           returnStroke(1+DX,1-DY),
345
                           returnStroke(1-DX,1   ),
346
                           returnStroke(1+DX,1   ),
347
                           returnStroke(1-DX,1+DY),
348
                           returnStroke(1   ,1+DY),
349
                           returnStroke(1+DX,1+DY),
350

    
351
                           returnStroke(1-DX,1-DZ),
352
                           returnStroke(1   ,1-DZ),
353
                           returnStroke(1+DX,1-DZ),
354
                           returnStroke(1-DX,1   ),
355
                           returnStroke(1+DX,1   ),
356
                           returnStroke(1-DX,1+DZ),
357
                           returnStroke(1   ,1+DZ),
358
                           returnStroke(1+DX,1+DZ),
359

    
360
                           returnStroke(1-DZ,1-DY),
361
                           returnStroke(1   ,1-DY),
362
                           returnStroke(1+DZ,1-DY),
363
                           returnStroke(1-DZ,1   ),
364
                           returnStroke(1+DZ,1   ),
365
                           returnStroke(1-DZ,1+DY),
366
                           returnStroke(1   ,1+DY),
367
                           returnStroke(1+DZ,1+DY),
368
                         };
369
      }
370
    }
371

    
372
///////////////////////////////////////////////////////////////////////////////////////////////////
373

    
374
  private float[] returnSticker(float x, float y)
375
    {
376
      float H = 0.5f;
377

    
378
      if( x<y ) { float D=H*x/y; return new float[] {-D,-H,+D,-H,+D,+H,-D,+H}; }
379
      else      { float D=H*y/x; return new float[] {-H,-D,+H,-D,+H,+D,-H,+D}; }
380
    }
381

    
382
///////////////////////////////////////////////////////////////////////////////////////////////////
383

    
384
  private float[][] generateStickers()
385
    {
386
    int num = getNumLayers();
387

    
388
    if( num==2 )
389
      {
390
      return new float[][]
391
          {
392
              returnSticker(1-DX,1-DY),
393
              returnSticker(1+DX,1-DY),
394
              returnSticker(1-DX,1+DY),
395
              returnSticker(1+DX,1+DY),
396
              returnSticker(1-DX,1-DZ),
397
              returnSticker(1+DX,1-DZ),
398
              returnSticker(1-DX,1+DZ),
399
              returnSticker(1+DX,1+DZ),
400
              returnSticker(1-DZ,1-DY),
401
              returnSticker(1+DZ,1-DY),
402
              returnSticker(1-DZ,1+DY),
403
              returnSticker(1+DZ,1+DY),
404
          };
405
      }
406
    else
407
      {
408
      return new float[][]
409
          {
410
              returnSticker(1   ,1   ),
411

    
412
              returnSticker(1-DX,1-DY),
413
              returnSticker(1   ,1-DY),
414
              returnSticker(1+DX,1-DY),
415
              returnSticker(1-DX,1   ),
416
              returnSticker(1+DX,1   ),
417
              returnSticker(1-DX,1+DY),
418
              returnSticker(1   ,1+DY),
419
              returnSticker(1+DX,1+DY),
420

    
421
              returnSticker(1-DX,1-DZ),
422
              returnSticker(1   ,1-DZ),
423
              returnSticker(1+DX,1-DZ),
424
              returnSticker(1-DX,1   ),
425
              returnSticker(1+DX,1   ),
426
              returnSticker(1-DX,1+DZ),
427
              returnSticker(1   ,1+DZ),
428
              returnSticker(1+DX,1+DZ),
429

    
430
              returnSticker(1-DZ,1-DY),
431
              returnSticker(1   ,1-DY),
432
              returnSticker(1+DZ,1-DY),
433
              returnSticker(1-DZ,1   ),
434
              returnSticker(1+DZ,1   ),
435
              returnSticker(1-DZ,1+DY),
436
              returnSticker(1   ,1+DY),
437
              returnSticker(1+DZ,1+DY),
438
          };
439
      }
440
    }
441

    
442
///////////////////////////////////////////////////////////////////////////////////////////////////
443

    
444
  protected ObjectSticker retSticker(int face)
445
    {
446
    if( mStickers==null )
447
      {
448
      final float[][] STICKERS = generateStickers();
449
      final float[] STROKES = generateStrokes();
450
      final int NUM_STICKERS = STICKERS.length;
451
      final float radius = 0.10f;
452
      final float[] radii = {radius,radius,radius,radius};
453
      mStickers = new ObjectSticker[NUM_STICKERS];
454

    
455
      for(int i=0; i<NUM_STICKERS; i++)
456
        {
457
        mStickers[i] = new ObjectSticker(STICKERS[i],null,radii,STROKES[i]);
458
        }
459
      }
460

    
461
    return mStickers[face/NUM_FACE_COLORS];
462
    }
463

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

    
466
  protected int getNumStickerTypes(int numLayers)
467
    {
468
    return numLayers==2 ? 12 : 25;
469
    }
470

    
471
///////////////////////////////////////////////////////////////////////////////////////////////////
472

    
473
  private int getRow(int cubit, int numLayers, int dim)
474
    {
475
    return (int)(mPositions[cubit][dim] + 0.5f*(numLayers-1));
476
    }
477

    
478
///////////////////////////////////////////////////////////////////////////////////////////////////
479

    
480
  protected ObjectShape getObjectShape(int cubit, int numLayers)
481
    {
482
    int extraI, extraV, num;
483
    float height;
484

    
485
    switch(numLayers)
486
      {
487
      case 2 : num = 6; extraI = 2; extraV = 2; height = 0.045f; break;
488
      case 3 : num = 5; extraI = 2; extraV = 2; height = 0.045f; break;
489
      case 4 : num = 5; extraI = 1; extraV = 1; height = 0.045f; break;
490
      default: num = 5; extraI = 0; extraV = 0; height = 0.045f; break;
491
      }
492

    
493
    int xrow = getRow(cubit,numLayers,0);
494
    int yrow = getRow(cubit,numLayers,1);
495
    int zrow = getRow(cubit,numLayers,2);
496

    
497
    float XL = -0.5f + (xrow==          0 ? DX : 0);
498
    float XR = +0.5f + (xrow==numLayers-1 ? DX : 0);
499
    float YL = -0.5f - (yrow==          0 ? DY : 0);
500
    float YR = +0.5f - (yrow==numLayers-1 ? DY : 0);
501
    float ZL = -0.5f - (zrow==          0 ? DZ : 0);
502
    float ZR = +0.5f - (zrow==numLayers-1 ? DZ : 0);
503

    
504
    double[][] vertices = new double[][]
505
          {
506
              { XR, YR, ZR },
507
              { XR, YR, ZL },
508
              { XR, YL, ZR },
509
              { XR, YL, ZL },
510
              { XL, YR, ZR },
511
              { XL, YR, ZL },
512
              { XL, YL, ZR },
513
              { XL, YL, ZL },
514
          };
515

    
516
    int[][] vert_indices = new int[][]
517
          {
518
              {2,3,1,0},
519
              {7,6,4,5},
520
              {4,0,1,5},
521
              {7,3,2,6},
522
              {6,2,0,4},
523
              {3,7,5,1}
524
          };
525

    
526
    float[][] bands     = new float[][] { {height,35,0.5f,0.7f,num,extraI,extraV} };
527
    int[] bandIndices   = new int[] { 0,0,0,0,0,0};
528
    float[][] corners   = new float[][] { {0.036f,0.12f} };
529
    int[] cornerIndices = new int[] { 0,0,0,0,0,0,0,0 };
530
    float[][] centers   = new float[][] { {0.0f, 0.0f, 0.0f} };
531
    int[] centerIndices = new int[] { 0,0,0,0,0,0,0,0 };
532

    
533
    return new ObjectShape(vertices,vert_indices,bands,bandIndices,corners,cornerIndices,centers,centerIndices,getNumCubitFaces(), null);
534
    }
535

    
536
///////////////////////////////////////////////////////////////////////////////////////////////////
537

    
538
  protected Static4D getQuat(int cubit, int numLayers)
539
    {
540
    if( mQuats ==null ) initializeQuats();
541
    return mQuats[0];
542
    }
543

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

    
546
  protected int getNumCubitVariants(int numLayers)
547
    {
548
    return 6*numLayers*numLayers - 12*numLayers + 8;
549
    }
550

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

    
553
  protected int getCubitVariant(int cubit, int numLayers)
554
    {
555
    return cubit;
556
    }
557

    
558
///////////////////////////////////////////////////////////////////////////////////////////////////
559

    
560
  protected int getColor(int face)
561
    {
562
    return FACE_COLORS[face];
563
    }
564

    
565
///////////////////////////////////////////////////////////////////////////////////////////////////
566

    
567
  protected float[][] getCubitPositions(int numLayers)
568
    {
569
    if( mPositions==null )
570
      {
571
      int numCubits = numLayers>1 ? 6*numLayers*numLayers - 12*numLayers + 8 : 1;
572
      mPositions = new float[numCubits][];
573

    
574
      float diff = 0.5f*(numLayers-1);
575
      int currentPosition = 0;
576

    
577
      for(int x = 0; x<numLayers; x++)
578
        for(int y = 0; y<numLayers; y++)
579
          for(int z = 0; z<numLayers; z++)
580
            if( x==0 || x==numLayers-1 || y==0 || y==numLayers-1 || z==0 || z==numLayers-1 )
581
              {
582
              mPositions[currentPosition++] = new float[] {x-diff,y-diff,z-diff};
583
              }
584
      }
585

    
586
    return mPositions;
587
    }
588

    
589
///////////////////////////////////////////////////////////////////////////////////////////////////
590

    
591
  protected Static4D[] getQuats()
592
    {
593
    if( mQuats ==null ) initializeQuats();
594
    return mQuats;
595
    }
596

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

    
599
  protected int getNumFaceColors()
600
    {
601
    return 1;
602
    }
603

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

    
606
  protected float[][] getCuts(int numLayers)
607
    {
608
    if( mCuts==null )
609
      {
610
      mCuts = new float[3][numLayers-1];
611

    
612
      for(int i=0; i<numLayers-1; i++)
613
        {
614
        float cut = (2-numLayers)*0.5f + i;
615
        mCuts[0][i] = cut;
616
        mCuts[1][i] = cut;
617
        mCuts[2][i] = cut;
618
        }
619
      }
620

    
621
    return mCuts;
622
    }
623

    
624
///////////////////////////////////////////////////////////////////////////////////////////////////
625

    
626
  private void getLayerRotatable(int numLayers)
627
    {
628
    if( mLayerRotatable==null )
629
      {
630
      int numAxis = ROT_AXIS.length;
631
      boolean[] tmp = new boolean[numLayers];
632
      for(int i=0; i<numLayers; i++) tmp[i] = true;
633
      mLayerRotatable = new boolean[numAxis][];
634
      for(int i=0; i<numAxis; i++) mLayerRotatable[i] = tmp;
635
      }
636
    }
637

    
638
///////////////////////////////////////////////////////////////////////////////////////////////////
639

    
640
  protected int getSolvedFunctionIndex()
641
    {
642
    return 0;
643
    }
644

    
645
///////////////////////////////////////////////////////////////////////////////////////////////////
646

    
647
  protected int getNumCubitFaces()
648
    {
649
    return 6;
650
    }
651

    
652
///////////////////////////////////////////////////////////////////////////////////////////////////
653
// PUBLIC API
654

    
655
  public Static3D[] getRotationAxis()
656
    {
657
    return ROT_AXIS;
658
    }
659

    
660
///////////////////////////////////////////////////////////////////////////////////////////////////
661

    
662
  public Movement getMovement()
663
    {
664
    if( mMovement==null )
665
      {
666
      int numLayers = getNumLayers();
667
      if( mCuts==null ) getCuts(numLayers);
668
      getLayerRotatable(numLayers);
669
      mMovement = new Movement6(ROT_AXIS,mCuts,mLayerRotatable,numLayers,TYPE_NOT_SPLIT,ENABLED);
670
      }
671
    return mMovement;
672
    }
673

    
674
///////////////////////////////////////////////////////////////////////////////////////////////////
675

    
676
  public int[] getBasicAngle()
677
    {
678
    if( mBasicAngle==null ) mBasicAngle = new int[] { 4,4,4 };
679
    return mBasicAngle;
680
    }
681

    
682
///////////////////////////////////////////////////////////////////////////////////////////////////
683

    
684
  public int getObjectName(int numLayers)
685
    {
686
    switch(numLayers)
687
      {
688
      case 2: return R.string.mirr2;
689
      case 3: return R.string.mirr3;
690
      }
691
    return R.string.mirr3;
692
    }
693

    
694
///////////////////////////////////////////////////////////////////////////////////////////////////
695

    
696
  public int getInventor(int numLayers)
697
    {
698
    switch(numLayers)
699
      {
700
      case 2: return R.string.mirr2_inventor;
701
      case 3: return R.string.mirr3_inventor;
702
      }
703
    return R.string.mirr3_inventor;
704
    }
705

    
706
///////////////////////////////////////////////////////////////////////////////////////////////////
707

    
708
  public int getComplexity(int numLayers)
709
    {
710
    switch(numLayers)
711
      {
712
      case 2: return 5;
713
      case 3: return 7;
714
      }
715
    return 7;
716
    }
717
}
(17-17/25)