Project

General

Profile

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

magiccube / src / main / java / org / distorted / objects / TwistyMirror.java @ 62ec404d

1 abf36986 Leszek Koltunski
///////////////////////////////////////////////////////////////////////////////////////////////////
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 62ec404d Leszek Koltunski
  private static final float DY = 0.25f;
48
  private static final float DZ = 0.40f;
49 abf36986 Leszek Koltunski
50
  private ScrambleState[] mStates;
51
  private Static4D[] mQuats;
52
  private int[] mBasicAngle;
53
  private ObjectSticker[] mStickers;
54
  private float[][] mPositions;
55
56
///////////////////////////////////////////////////////////////////////////////////////////////////
57
58
  TwistyMirror(int size, Static4D quat, DistortedTexture texture, MeshSquare mesh,
59
               DistortedEffects effects, int[][] moves, Resources res, int scrWidth)
60
    {
61
    super(size, size, quat, texture, mesh, effects, moves, ObjectList.MIRR, res, scrWidth);
62
    }
63
64
///////////////////////////////////////////////////////////////////////////////////////////////////
65
66
  ScrambleState[] getScrambleStates()
67
    {
68
    if( mStates==null )
69
      {
70
      int size = getNumLayers();
71
      int[][] m = new int[16][];
72
      for(int i=1; i<16; i++) m[i] = createEdges(size,i);
73
74
      mStates = new ScrambleState[]
75
        {
76
        new ScrambleState( new int[][] { m[ 1], m[ 2], m[ 3] } ),  // 0
77
        new ScrambleState( new int[][] {  null, m[ 4], m[ 5] } ),  // x
78
        new ScrambleState( new int[][] { m[ 6],  null, m[ 7] } ),  // y
79
        new ScrambleState( new int[][] { m[ 8], m[ 8],  null } ),  // z
80
        new ScrambleState( new int[][] { m[10],  null, m[ 7] } ),  // xy
81
        new ScrambleState( new int[][] { m[11], m[ 9],  null } ),  // xz
82
        new ScrambleState( new int[][] {  null, m[12], m[ 5] } ),  // yx
83
        new ScrambleState( new int[][] { m[ 8], m[13],  null } ),  // yz
84
        new ScrambleState( new int[][] {  null, m[ 4], m[14] } ),  // zx
85
        new ScrambleState( new int[][] { m[ 6],  null, m[15] } ),  // zy
86
        new ScrambleState( new int[][] {  null,  null, m[ 5] } ),  // xyx
87
        new ScrambleState( new int[][] {  null, m[ 4],  null } ),  // xzx
88
        new ScrambleState( new int[][] {  null,  null, m[ 7] } ),  // yxy
89
        new ScrambleState( new int[][] { m[ 6],  null,  null } ),  // yzy
90
        new ScrambleState( new int[][] {  null, m[ 9],  null } ),  // zxz
91
        new ScrambleState( new int[][] { m[ 8],  null,  null } ),  // zyz
92
        };
93
      }
94
95
    return mStates;
96
    }
97
98
///////////////////////////////////////////////////////////////////////////////////////////////////
99
100
  private int[] createEdges(int size, int vertex)
101
    {
102
    int[] ret = new int[9*size];
103
104
    for(int l=0; l<size; l++)
105
      {
106
      ret[9*l  ] = l;
107
      ret[9*l+1] =-1;
108
      ret[9*l+2] = vertex;
109
      ret[9*l+3] = l;
110
      ret[9*l+4] = 1;
111
      ret[9*l+5] = vertex;
112
      ret[9*l+6] = l;
113
      ret[9*l+7] = 2;
114
      ret[9*l+8] = vertex;
115
      }
116
117
    return ret;
118
    }
119
120
///////////////////////////////////////////////////////////////////////////////////////////////////
121
122
  private void initializeQuats()
123
    {
124
    mQuats = new Static4D[]
125
         {
126
         new Static4D(  0.0f,   0.0f,   0.0f,   1.0f),
127
         new Static4D(  1.0f,   0.0f,   0.0f,   0.0f),
128
         new Static4D(  0.0f,   1.0f,   0.0f,   0.0f),
129
         new Static4D(  0.0f,   0.0f,   1.0f,   0.0f),
130
131
         new Static4D( SQ2/2,  SQ2/2,  0.0f ,   0.0f),
132
         new Static4D( SQ2/2, -SQ2/2,  0.0f ,   0.0f),
133
         new Static4D( SQ2/2,   0.0f,  SQ2/2,   0.0f),
134
         new Static4D(-SQ2/2,   0.0f,  SQ2/2,   0.0f),
135
         new Static4D( SQ2/2,   0.0f,   0.0f,  SQ2/2),
136
         new Static4D( SQ2/2,   0.0f,   0.0f, -SQ2/2),
137
         new Static4D(  0.0f,  SQ2/2,  SQ2/2,   0.0f),
138
         new Static4D(  0.0f,  SQ2/2, -SQ2/2,   0.0f),
139
         new Static4D(  0.0f,  SQ2/2,   0.0f,  SQ2/2),
140
         new Static4D(  0.0f,  SQ2/2,   0.0f, -SQ2/2),
141
         new Static4D(  0.0f,   0.0f,  SQ2/2,  SQ2/2),
142
         new Static4D(  0.0f,   0.0f,  SQ2/2, -SQ2/2),
143
144
         new Static4D(  0.5f,   0.5f,   0.5f,   0.5f),
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
         };
153
    }
154
155
///////////////////////////////////////////////////////////////////////////////////////////////////
156
// we cannot do this the standard, automatic way because there's only 1 color in the FACE_COLORS
157
// table and retCubitSolvedStatus() always returns -1,-1 or 0.
158
159
  int[] getSolvedQuats(int cubit, int numLayers)
160
    {
161
    if( numLayers==3 )
162
      {
163
      switch(cubit)
164
        {
165
        case  4:
166
        case 21: return new int[] {1,8,9};
167
        case 10:
168
        case 15: return new int[] {2,12,13};
169
        case 12:
170
        case 13: return new int[] {3,14,15};
171
        }
172
      }
173
174
    return null;
175
    }
176
177
///////////////////////////////////////////////////////////////////////////////////////////////////
178
179
  int getFaceColor(int cubit, int cubitface, int numLayers)
180
    {
181
    if( numLayers==2 )
182
      {
183
      switch(cubitface)
184
        {
185
        case 0: if( cubit==4 ) return 11;
186
                if( cubit==5 ) return 10;
187
                if( cubit==6 ) return  9;
188
                if( cubit==7 ) return  8;
189
                return NUM_TEXTURES;
190
        case 1: if( cubit==0 ) return 11;
191
                if( cubit==1 ) return 10;
192
                if( cubit==2 ) return  9;
193
                if( cubit==3 ) return  8;
194
                return NUM_TEXTURES;
195
        case 2: if( cubit==3 ) return  4;
196
                if( cubit==7 ) return  5;
197
                if( cubit==2 ) return  6;
198
                if( cubit==6 ) return  7;
199
                return NUM_TEXTURES;
200
        case 3: if( cubit==1 ) return  4;
201
                if( cubit==5 ) return  5;
202
                if( cubit==0 ) return  6;
203
                if( cubit==4 ) return  7;
204
                return NUM_TEXTURES;
205
        case 4: if( cubit==3 ) return  0;
206
                if( cubit==7 ) return  1;
207
                if( cubit==1 ) return  2;
208
                if( cubit==5 ) return  3;
209
                return NUM_TEXTURES;
210
        case 5: if( cubit==2 ) return  0;
211
                if( cubit==6 ) return  1;
212
                if( cubit==0 ) return  2;
213
                if( cubit==4 ) return  3;
214
                return NUM_TEXTURES;
215
        }
216
      }
217
    if( numLayers==3 )
218
      {
219
      switch(cubitface)
220
        {
221
        case 0: if( cubit==17 ) return 24;
222
                if( cubit==18 ) return 23;
223
                if( cubit==19 ) return 22;
224
                if( cubit==20 ) return 21;
225
                if( cubit==21 ) return  0;
226
                if( cubit==22 ) return 20;
227
                if( cubit==23 ) return 19;
228
                if( cubit==24 ) return 18;
229
                if( cubit==25 ) return 17;
230
                return NUM_TEXTURES;
231
        case 1: if( cubit== 0 ) return 24;
232
                if( cubit== 1 ) return 23;
233
                if( cubit== 2 ) return 22;
234
                if( cubit== 3 ) return 21;
235
                if( cubit== 4 ) return  0;
236
                if( cubit== 5 ) return 20;
237
                if( cubit== 6 ) return 19;
238
                if( cubit== 7 ) return 18;
239
                if( cubit== 8 ) return 17;
240
                return NUM_TEXTURES;
241
        case 2: if( cubit== 6 ) return 14;
242
                if( cubit==14 ) return  2; // theoretically should have been 15, but this must have gotten collapsed in the Factory
243
                if( cubit==23 ) return 16;
244
                if( cubit== 7 ) return 12;
245
                if( cubit==15 ) return  0;
246
                if( cubit==24 ) return 13;
247
                if( cubit== 8 ) return  9;
248 62ec404d Leszek Koltunski
                if( cubit==16 ) return 20; // ditto, theoretically 10
249 abf36986 Leszek Koltunski
                if( cubit==25 ) return 11;
250
                return NUM_TEXTURES;
251
        case 3: if( cubit== 0 ) return 14;
252
                if( cubit== 9 ) return  2; // ditto, theoretically 15
253
                if( cubit==17 ) return 16;
254
                if( cubit== 1 ) return 12;
255
                if( cubit==10 ) return  0;
256
                if( cubit==18 ) return 13;
257
                if( cubit== 2 ) return  9;
258 62ec404d Leszek Koltunski
                if( cubit==11 ) return 20; // ditto, theoretically 10
259 abf36986 Leszek Koltunski
                if( cubit==19 ) return 11;
260
                return NUM_TEXTURES;
261
        case 4: if( cubit== 8 ) return  1;
262
                if( cubit==16 ) return  2;
263
                if( cubit==25 ) return  3;
264
                if( cubit== 5 ) return  4;
265
                if( cubit==13 ) return  0;
266
                if( cubit==22 ) return  5;
267
                if( cubit== 2 ) return  6;
268
                if( cubit==11 ) return  7;
269
                if( cubit==19 ) return  8;
270
                return NUM_TEXTURES;
271
        case 5: if( cubit== 6 ) return  1;
272
                if( cubit==14 ) return  2;
273
                if( cubit==23 ) return  3;
274
                if( cubit== 3 ) return  4;
275
                if( cubit==12 ) return  0;
276
                if( cubit==20 ) return  5;
277
                if( cubit== 0 ) return  6;
278
                if( cubit== 9 ) return  7;
279
                if( cubit==17 ) return  8;
280
                return NUM_TEXTURES;
281
        }
282
      }
283
284
    return 0;
285
    }
286
287
///////////////////////////////////////////////////////////////////////////////////////////////////
288
289
  private float returnStroke(float x, float y)
290
    {
291
    return 0.08f/(Math.max(x,y));
292
    }
293
294
///////////////////////////////////////////////////////////////////////////////////////////////////
295
296
  private float[] generateStrokes()
297
    {
298
    int num = getNumLayers();
299
    final float A = 0.08f;
300
301
    if( num==2 )
302
      {
303
      return new float[] {
304
                           returnStroke(1-DX,1-DY),
305
                           returnStroke(1+DX,1-DY),
306
                           returnStroke(1-DX,1+DY),
307
                           returnStroke(1+DX,1+DY),
308
                           returnStroke(1-DX,1-DZ),
309
                           returnStroke(1+DX,1-DZ),
310
                           returnStroke(1-DX,1+DZ),
311
                           returnStroke(1+DX,1+DZ),
312
                           returnStroke(1-DZ,1-DY),
313
                           returnStroke(1+DZ,1-DY),
314
                           returnStroke(1-DZ,1+DY),
315
                           returnStroke(1+DZ,1+DY),
316
317
                           A/(1-DX), A/(1+DX), A/(1+DY), A/(1+DY),
318
                           A/(1-DX), A/(1+DX), A/(1+DZ), A/(1+DZ),
319
                           A/(1-DY), A/(1+DY), A/(1+DZ), A/(1+DZ),
320
                         };
321
      }
322
    else
323
      {
324
      return new float[] {
325
                           returnStroke(1   ,1   ),
326
327
                           returnStroke(1-DX,1-DY),
328
                           returnStroke(1   ,1-DY),
329
                           returnStroke(1+DX,1-DY),
330
                           returnStroke(1-DX,1   ),
331
                           returnStroke(1+DX,1   ),
332
                           returnStroke(1-DX,1+DY),
333
                           returnStroke(1   ,1+DY),
334
                           returnStroke(1+DX,1+DY),
335
336
                           returnStroke(1-DX,1-DZ),
337
                           returnStroke(1   ,1-DZ),
338
                           returnStroke(1+DX,1-DZ),
339
                           returnStroke(1-DX,1   ),
340
                           returnStroke(1+DX,1   ),
341
                           returnStroke(1-DX,1+DZ),
342
                           returnStroke(1   ,1+DZ),
343
                           returnStroke(1+DX,1+DZ),
344
345
                           returnStroke(1-DZ,1-DY),
346
                           returnStroke(1   ,1-DY),
347
                           returnStroke(1+DZ,1-DY),
348
                           returnStroke(1-DZ,1   ),
349
                           returnStroke(1+DZ,1   ),
350
                           returnStroke(1-DZ,1+DY),
351
                           returnStroke(1   ,1+DY),
352
                           returnStroke(1+DZ,1+DY),
353
                         };
354
      }
355
    }
356
357
///////////////////////////////////////////////////////////////////////////////////////////////////
358
359
  private float[] returnSticker(float x, float y)
360
    {
361
      float H = 0.5f;
362
363
      if( x<y ) { float D=H*x/y; return new float[] {-D,-H,+D,-H,+D,+H,-D,+H}; }
364
      else      { float D=H*y/x; return new float[] {-H,-D,+H,-D,+H,+D,-H,+D}; }
365
    }
366
367
///////////////////////////////////////////////////////////////////////////////////////////////////
368
369
  private float[][] generateStickers()
370
    {
371
    int num = getNumLayers();
372
373
    if( num==2 )
374
      {
375
      return new float[][]
376
          {
377
              returnSticker(1-DX,1-DY),
378
              returnSticker(1+DX,1-DY),
379
              returnSticker(1-DX,1+DY),
380
              returnSticker(1+DX,1+DY),
381
              returnSticker(1-DX,1-DZ),
382
              returnSticker(1+DX,1-DZ),
383
              returnSticker(1-DX,1+DZ),
384
              returnSticker(1+DX,1+DZ),
385
              returnSticker(1-DZ,1-DY),
386
              returnSticker(1+DZ,1-DY),
387
              returnSticker(1-DZ,1+DY),
388
              returnSticker(1+DZ,1+DY),
389
          };
390
      }
391
    else
392
      {
393
      return new float[][]
394
          {
395
              returnSticker(1   ,1   ),
396
397
              returnSticker(1-DX,1-DY),
398
              returnSticker(1   ,1-DY),
399
              returnSticker(1+DX,1-DY),
400
              returnSticker(1-DX,1   ),
401
              returnSticker(1+DX,1   ),
402
              returnSticker(1-DX,1+DY),
403
              returnSticker(1   ,1+DY),
404
              returnSticker(1+DX,1+DY),
405
406
              returnSticker(1-DX,1-DZ),
407
              returnSticker(1   ,1-DZ),
408
              returnSticker(1+DX,1-DZ),
409
              returnSticker(1-DX,1   ),
410
              returnSticker(1+DX,1   ),
411
              returnSticker(1-DX,1+DZ),
412
              returnSticker(1   ,1+DZ),
413
              returnSticker(1+DX,1+DZ),
414
415
              returnSticker(1-DZ,1-DY),
416
              returnSticker(1   ,1-DY),
417
              returnSticker(1+DZ,1-DY),
418
              returnSticker(1-DZ,1   ),
419
              returnSticker(1+DZ,1   ),
420
              returnSticker(1-DZ,1+DY),
421
              returnSticker(1   ,1+DY),
422
              returnSticker(1+DZ,1+DY),
423
          };
424
      }
425
    }
426
427
///////////////////////////////////////////////////////////////////////////////////////////////////
428
429
  ObjectSticker retSticker(int face)
430
    {
431
    if( mStickers==null )
432
      {
433
      final float[][] STICKERS = generateStickers();
434
      final float[] STROKES = generateStrokes();
435
      final int NUM_STICKERS = STICKERS.length;
436
      final float radius = 0.10f;
437
      final float[] radii = {radius,radius,radius,radius};
438
      mStickers = new ObjectSticker[NUM_STICKERS];
439
440
      for(int i=0; i<NUM_STICKERS; i++)
441
        {
442
        mStickers[i] = new ObjectSticker(STICKERS[i],null,radii,STROKES[i]);
443
        }
444
      }
445
446
    return mStickers[face/NUM_FACE_COLORS];
447
    }
448
449
///////////////////////////////////////////////////////////////////////////////////////////////////
450
451
  int getNumStickerTypes(int numLayers)
452
    {
453
    return numLayers==2 ? 12 : 25;
454
    }
455
456
///////////////////////////////////////////////////////////////////////////////////////////////////
457
458
  private int getRow(int cubit, int numLayers, int dim)
459
    {
460
    return (int)(mPositions[cubit][dim] + 0.5f*(numLayers-1));
461
    }
462
463
///////////////////////////////////////////////////////////////////////////////////////////////////
464
465
  ObjectShape getObjectShape(int cubit, int numLayers)
466
    {
467
    int extraI, extraV, num;
468
    float height;
469
470
    switch(numLayers)
471
      {
472
      case 2 : num = 6; extraI = 2; extraV = 2; height = 0.045f; break;
473
      case 3 : num = 5; extraI = 2; extraV = 2; height = 0.045f; break;
474
      case 4 : num = 5; extraI = 1; extraV = 1; height = 0.045f; break;
475
      default: num = 5; extraI = 0; extraV = 0; height = 0.045f; break;
476
      }
477
478
    int xrow = getRow(cubit,numLayers,0);
479
    int yrow = getRow(cubit,numLayers,1);
480
    int zrow = getRow(cubit,numLayers,2);
481
482
    float XL = -0.5f + (xrow==          0 ? DX : 0);
483
    float XR = +0.5f + (xrow==numLayers-1 ? DX : 0);
484
    float YL = -0.5f - (yrow==          0 ? DY : 0);
485
    float YR = +0.5f - (yrow==numLayers-1 ? DY : 0);
486
    float ZL = -0.5f - (zrow==          0 ? DZ : 0);
487
    float ZR = +0.5f - (zrow==numLayers-1 ? DZ : 0);
488
489
    double[][] vertices = new double[][]
490
          {
491
              { XR, YR, ZR },
492
              { XR, YR, ZL },
493
              { XR, YL, ZR },
494
              { XR, YL, ZL },
495
              { XL, YR, ZR },
496
              { XL, YR, ZL },
497
              { XL, YL, ZR },
498
              { XL, YL, ZL },
499
          };
500
501
    int[][] vert_indices = new int[][]
502
          {
503
              {2,3,1,0},
504
              {7,6,4,5},
505
              {4,0,1,5},
506
              {7,3,2,6},
507
              {6,2,0,4},
508
              {3,7,5,1}
509
          };
510
511
    float[][] bands     = new float[][] { {height,35,0.5f,0.7f,num,extraI,extraV} };
512
    int[] bandIndices   = new int[] { 0,0,0,0,0,0};
513
    float[][] corners   = new float[][] { {0.036f,0.12f} };
514
    int[] cornerIndices = new int[] { 0,0,0,0,0,0,0,0 };
515
    float[][] centers   = new float[][] { {0.0f, 0.0f, 0.0f} };
516
    int[] centerIndices = new int[] { 0,0,0,0,0,0,0,0 };
517
518
    return new ObjectShape(vertices,vert_indices,bands,bandIndices,corners,cornerIndices,centers,centerIndices,getNumCubitFaces(), null);
519
    }
520
521
///////////////////////////////////////////////////////////////////////////////////////////////////
522
523
  Static4D getQuat(int cubit, int numLayers)
524
    {
525
    if( mQuats ==null ) initializeQuats();
526
    return mQuats[0];
527
    }
528
529
///////////////////////////////////////////////////////////////////////////////////////////////////
530
531
  int getNumCubitVariants(int numLayers)
532
    {
533
    return 6*numLayers*numLayers - 12*numLayers + 8;
534
    }
535
536
///////////////////////////////////////////////////////////////////////////////////////////////////
537
538
  int getCubitVariant(int cubit, int numLayers)
539
    {
540
    return cubit;
541
    }
542
543
///////////////////////////////////////////////////////////////////////////////////////////////////
544
545
  int getColor(int face)
546
    {
547
    return FACE_COLORS[face];
548
    }
549
550
///////////////////////////////////////////////////////////////////////////////////////////////////
551
552
  float[][] getCubitPositions(int numLayers)
553
    {
554
    if( mPositions==null )
555
      {
556
      int numCubits = numLayers>1 ? 6*numLayers*numLayers - 12*numLayers + 8 : 1;
557
      mPositions = new float[numCubits][];
558
559
      float diff = 0.5f*(numLayers-1);
560
      int currentPosition = 0;
561
562
      for(int x = 0; x<numLayers; x++)
563
        for(int y = 0; y<numLayers; y++)
564
          for(int z = 0; z<numLayers; z++)
565
            if( x==0 || x==numLayers-1 || y==0 || y==numLayers-1 || z==0 || z==numLayers-1 )
566
              {
567
              mPositions[currentPosition++] = new float[] {x-diff,y-diff,z-diff};
568
              }
569
      }
570
571
    return mPositions;
572
    }
573
574
///////////////////////////////////////////////////////////////////////////////////////////////////
575
576
  Static4D[] getQuats()
577
    {
578
    if( mQuats ==null ) initializeQuats();
579
    return mQuats;
580
    }
581
582
///////////////////////////////////////////////////////////////////////////////////////////////////
583
584
  boolean shouldResetTextureMaps()
585
    {
586
    return false;
587
    }
588
589
///////////////////////////////////////////////////////////////////////////////////////////////////
590
591
  int getNumFaceColors()
592
    {
593
    return FACE_COLORS.length;
594
    }
595
596
///////////////////////////////////////////////////////////////////////////////////////////////////
597
598
  float[][] getCuts(int numLayers)
599
    {
600
    float[][] cuts = new float[3][numLayers-1];
601
602
    for(int i=0; i<numLayers-1; i++)
603
      {
604
      float cut = (2-numLayers)*0.5f + i;
605
      cuts[0][i] = cut;
606
      cuts[1][i] = cut;
607
      cuts[2][i] = cut;
608
      }
609
610
    return cuts;
611
    }
612
613
///////////////////////////////////////////////////////////////////////////////////////////////////
614
615
  int getSolvedFunctionIndex()
616
    {
617
    return 0;
618
    }
619
620
///////////////////////////////////////////////////////////////////////////////////////////////////
621
622
  int getNumCubitFaces()
623
    {
624
    return 6;
625
    }
626
627
///////////////////////////////////////////////////////////////////////////////////////////////////
628
629
  float getScreenRatio()
630
    {
631
    return 0.5f;
632
    }
633
634
///////////////////////////////////////////////////////////////////////////////////////////////////
635
636
  float returnMultiplier()
637
    {
638
    return getNumLayers();
639
    }
640
641
///////////////////////////////////////////////////////////////////////////////////////////////////
642
// PUBLIC API
643
644
  public Static3D[] getRotationAxis()
645
    {
646
    return ROT_AXIS;
647
    }
648
649
///////////////////////////////////////////////////////////////////////////////////////////////////
650
651
  public int[] getBasicAngle()
652
    {
653
    if( mBasicAngle==null ) mBasicAngle = new int[] { 4,4,4 };
654
    return mBasicAngle;
655
    }
656
657
///////////////////////////////////////////////////////////////////////////////////////////////////
658
659
  public int getObjectName(int numLayers)
660
    {
661
    switch(numLayers)
662
      {
663
      case 2: return R.string.mirr2;
664
      case 3: return R.string.mirr3;
665
      }
666
    return R.string.mirr3;
667
    }
668
669
///////////////////////////////////////////////////////////////////////////////////////////////////
670
671
  public int getInventor(int numLayers)
672
    {
673
    switch(numLayers)
674
      {
675
      case 2: return R.string.mirr2_inventor;
676
      case 3: return R.string.mirr3_inventor;
677
      }
678
    return R.string.mirr3_inventor;
679
    }
680
681
///////////////////////////////////////////////////////////////////////////////////////////////////
682
683
  public int getComplexity(int numLayers)
684
    {
685
    switch(numLayers)
686
      {
687
      case 2: return 5;
688
      case 3: return 7;
689
      }
690
    return 7;
691
    }
692
}