Project

General

Profile

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

magiccube / src / main / java / org / distorted / objects / TwistyDiamond.java @ b3c9061a

1
///////////////////////////////////////////////////////////////////////////////////////////////////
2
// Copyright 2020 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
import android.graphics.Canvas;
24
import android.graphics.Paint;
25

    
26
import org.distorted.helpers.FactoryCubit;
27
import org.distorted.helpers.FactorySticker;
28
import org.distorted.library.effect.MatrixEffectQuaternion;
29
import org.distorted.library.main.DistortedEffects;
30
import org.distorted.library.main.DistortedTexture;
31
import org.distorted.library.mesh.MeshBase;
32
import org.distorted.library.mesh.MeshSquare;
33
import org.distorted.library.type.Static3D;
34
import org.distorted.library.type.Static4D;
35
import org.distorted.main.R;
36
import org.distorted.main.RubikSurfaceView;
37

    
38
import java.util.Random;
39

    
40
///////////////////////////////////////////////////////////////////////////////////////////////////
41

    
42
public class TwistyDiamond extends TwistyObject
43
{
44
  private static final int FACES_PER_CUBIT =8;
45

    
46
  // the four rotation axis of a Diamond. Must be normalized.
47
  static final Static3D[] ROT_AXIS = new Static3D[]
48
         {
49
           new Static3D(+SQ6/3,+SQ3/3,     0),
50
           new Static3D(-SQ6/3,+SQ3/3,     0),
51
           new Static3D(     0,-SQ3/3,-SQ6/3),
52
           new Static3D(     0,-SQ3/3,+SQ6/3)
53
         };
54

    
55
  private static final int[] FACE_COLORS = new int[]
56
         {
57
           COLOR_ORANGE, COLOR_VIOLET,
58
           COLOR_WHITE , COLOR_BLUE  ,
59
           COLOR_YELLOW, COLOR_RED   ,
60
           COLOR_GREEN , COLOR_GREY
61
         };
62

    
63
  // All legal rotation quats of a Diamond: unit + three 180 deg turns + 8 generators
64
  private static final Static4D[] QUATS = new Static4D[]
65
         {
66
           new Static4D(  0.0f,  0.0f,   0.0f,  1.0f ),
67
           new Static4D(  0.0f,  1.0f,   0.0f,  0.0f ),
68
           new Static4D(+SQ2/2,  0.0f, -SQ2/2,  0.0f ),
69
           new Static4D(-SQ2/2,  0.0f, -SQ2/2,  0.0f ),
70

    
71
           new Static4D(+SQ2/2,  0.5f,   0.0f,  0.5f ),
72
           new Static4D(-SQ2/2,  0.5f,   0.0f,  0.5f ),
73
           new Static4D(  0.0f,  0.5f, +SQ2/2,  0.5f ),
74
           new Static4D(  0.0f,  0.5f, -SQ2/2,  0.5f ),
75
           new Static4D(+SQ2/2,  0.5f,   0.0f, -0.5f ),
76
           new Static4D(-SQ2/2,  0.5f,   0.0f, -0.5f ),
77
           new Static4D(  0.0f,  0.5f, +SQ2/2, -0.5f ),
78
           new Static4D(  0.0f,  0.5f, -SQ2/2, -0.5f )
79
         };
80

    
81
  private static final float DIST = 0.50f;
82

    
83
  private static final int[][] mFaceNeutralQuatIndex = new int[][]
84
         {
85
             {6,10},
86
             {4, 8},
87
             {7,11},
88
             {5, 9},
89
             {7,11},
90
             {5, 9},
91
             {6,10},
92
             {4, 8}
93
         };
94

    
95
  private static final int[] mTetraToFaceMap = new int[] {1,2,3,0,5,6,7,4};
96

    
97
  private static final double[][] VERTICES_TETRA = new double[][]
98
          {
99
             {-0.5, SQ2/4, 0.0},
100
             { 0.5, SQ2/4, 0.0},
101
             { 0.0,-SQ2/4, 0.5},
102
             { 0.0,-SQ2/4,-0.5}
103
          };
104

    
105
  private static final int[][] VERT_INDEXES_TETRA = new int[][]
106
          {
107
             {2,1,0},   // counterclockwise!
108
             {2,3,1},
109
             {3,2,0},
110
             {3,0,1}
111
          };
112

    
113
  private static final double[][] VERTICES_OCTA = new double[][]
114
          {
115
             { 0.5,   0.0, 0.5},
116
             { 0.5,   0.0,-0.5},
117
             {-0.5,   0.0,-0.5},
118
             {-0.5,   0.0, 0.5},
119
             { 0.0, SQ2/2, 0.0},
120
             { 0.0,-SQ2/2, 0.0}
121
          };
122

    
123
  private static final int[][] VERT_INDEXES_OCTA = new int[][]
124
          {
125
             {3,0,4},   // counterclockwise!
126
             {0,1,4},
127
             {1,2,4},
128
             {2,3,4},
129
             {5,0,3},
130
             {5,1,0},
131
             {5,2,1},
132
             {5,3,2}
133
          };
134

    
135
  private static final float[][] STICKERS = new float[][]
136
          {
137
             { -0.4330127f, -0.25f, 0.4330127f, -0.25f, 0.0f, 0.5f }
138
          };
139

    
140
  private static MeshBase[] mMeshes;
141

    
142
///////////////////////////////////////////////////////////////////////////////////////////////////
143

    
144
  TwistyDiamond(int size, Static4D quat, DistortedTexture texture,
145
                MeshSquare mesh, DistortedEffects effects, int[][] moves, Resources res, int scrWidth)
146
    {
147
    super(size, size, quat, texture, mesh, effects, moves, ObjectList.DIAM, res, scrWidth);
148
    }
149

    
150
///////////////////////////////////////////////////////////////////////////////////////////////////
151

    
152
  double[][] getVertices(int cubitType)
153
    {
154
    if( cubitType==0 ) return VERTICES_OCTA;
155
    if( cubitType==1 ) return VERTICES_TETRA;
156
    return null;
157
    }
158

    
159
///////////////////////////////////////////////////////////////////////////////////////////////////
160

    
161
  int[][] getVertIndexes(int cubitType)
162
    {
163
    if( cubitType==0 ) return VERT_INDEXES_OCTA;
164
    if( cubitType==1 ) return VERT_INDEXES_TETRA;
165
    return null;
166
    }
167

    
168
///////////////////////////////////////////////////////////////////////////////////////////////////
169

    
170
  int getNumCubitTypes(int numLayers)
171
    {
172
    return 2;
173
    }
174

    
175
///////////////////////////////////////////////////////////////////////////////////////////////////
176

    
177
  float getScreenRatio()
178
    {
179
    return 0.65f;
180
    }
181

    
182
///////////////////////////////////////////////////////////////////////////////////////////////////
183

    
184
  Static4D[] getQuats()
185
    {
186
    return QUATS;
187
    }
188

    
189
///////////////////////////////////////////////////////////////////////////////////////////////////
190

    
191
  int getNumFaces()
192
    {
193
    return FACE_COLORS.length;
194
    }
195

    
196
///////////////////////////////////////////////////////////////////////////////////////////////////
197

    
198
  boolean shouldResetTextureMaps()
199
    {
200
    return false;
201
    }
202

    
203
///////////////////////////////////////////////////////////////////////////////////////////////////
204

    
205
  int getNumStickerTypes(int numLayers)
206
    {
207
    return STICKERS.length;
208
    }
209

    
210
///////////////////////////////////////////////////////////////////////////////////////////////////
211

    
212
  float[] getCuts(int numLayers)
213
    {
214
    if( numLayers<2 )
215
      {
216
      return null;
217
      }
218
    else
219
      {
220
      float[] cuts = new float[numLayers-1];
221
      float dist = SQ6*0.666f*DIST;
222
      float cut  = 0.5f*dist*(2-numLayers);
223

    
224
      for(int i=0; i<numLayers-1; i++)
225
        {
226
        cuts[i] = cut;
227
        cut += dist;
228
        }
229

    
230
      return cuts;
231
      }
232
    }
233

    
234
///////////////////////////////////////////////////////////////////////////////////////////////////
235

    
236
  int getNumCubitFaces()
237
    {
238
    return FACES_PER_CUBIT;
239
    }
240

    
241
///////////////////////////////////////////////////////////////////////////////////////////////////
242

    
243
  private int getNumOctahedrons(int layers)
244
    {
245
    return layers==1 ? 1 : 4*(layers-1)*(layers-1) + 2;
246
    }
247

    
248
///////////////////////////////////////////////////////////////////////////////////////////////////
249

    
250
  private int getNumTetrahedrons(int layers)
251
    {
252
    return 4*layers*(layers-1);
253
    }
254

    
255
///////////////////////////////////////////////////////////////////////////////////////////////////
256

    
257
  private int createOctaPositions(float[][] centers, int index, int layers, float height)
258
    {
259
    float x = DIST*(layers-1);
260
    float z = DIST*(layers+1);
261

    
262
    for(int i=0; i<layers; i++, index++)
263
      {
264
      z -= 2*DIST;
265
      centers[index][0] = x;
266
      centers[index][1] = height;
267
      centers[index][2] = z;
268
      }
269

    
270
    for(int i=0; i<layers-1; i++, index++)
271
      {
272
      x -= 2*DIST;
273
      centers[index][0] = x;
274
      centers[index][1] = height;
275
      centers[index][2] = z;
276
      }
277

    
278
    for(int i=0; i<layers-1; i++, index++)
279
      {
280
      z += 2*DIST;
281
      centers[index][0] = x;
282
      centers[index][1] = height;
283
      centers[index][2] = z;
284
      }
285

    
286
    for(int i=0; i<layers-2; i++, index++)
287
      {
288
      x += 2*DIST;
289
      centers[index][0] = x;
290
      centers[index][1] = height;
291
      centers[index][2] = z;
292
      }
293

    
294
    return index;
295
    }
296

    
297
///////////////////////////////////////////////////////////////////////////////////////////////////
298

    
299
  private int createTetraPositions(float[][] centers, int index, int layers, float height)
300
    {
301
    float x = DIST*(layers-1);
302
    float z = DIST*layers;
303

    
304
    for(int i=0; i<layers-1; i++, index++)
305
      {
306
      z -= 2*DIST;
307
      centers[index][0] = x;
308
      centers[index][1] = height;
309
      centers[index][2] = z;
310
      }
311

    
312
    x += DIST;
313
    z -= DIST;
314

    
315
    for(int i=0; i<layers-1; i++, index++)
316
      {
317
      x -= 2*DIST;
318
      centers[index][0] = x;
319
      centers[index][1] = height;
320
      centers[index][2] = z;
321
      }
322

    
323
    x -= DIST;
324
    z -= DIST;
325

    
326
    for(int i=0; i<layers-1; i++, index++)
327
      {
328
      z += 2*DIST;
329
      centers[index][0] = x;
330
      centers[index][1] = height;
331
      centers[index][2] = z;
332
      }
333

    
334
    x -= DIST;
335
    z += DIST;
336

    
337
    for(int i=0; i<layers-1; i++, index++)
338
      {
339
      x += 2*DIST;
340
      centers[index][0] = x;
341
      centers[index][1] = height;
342
      centers[index][2] = z;
343
      }
344

    
345
    return index;
346
    }
347

    
348
///////////////////////////////////////////////////////////////////////////////////////////////////
349

    
350
  float[][] getCubitPositions(int layers)
351
    {
352
    int numO = getNumOctahedrons(layers);
353
    int numT = getNumTetrahedrons(layers);
354
    int index = 0;
355
    float height = 0.0f;
356

    
357
    float[][] CENTERS = new float[numO+numT][3];
358

    
359
    index = createOctaPositions(CENTERS,index,layers,height);
360

    
361
    for(int i=layers-1; i>0; i--)
362
      {
363
      height += SQ2*DIST;
364
      index = createOctaPositions(CENTERS,index,i,+height);
365
      index = createOctaPositions(CENTERS,index,i,-height);
366
      }
367

    
368
    height = DIST*SQ2/2;
369

    
370
    for(int i=layers; i>1; i--)
371
      {
372
      index = createTetraPositions(CENTERS,index,i,+height);
373
      index = createTetraPositions(CENTERS,index,i,-height);
374
      height += SQ2*DIST;
375
      }
376

    
377
    return CENTERS;
378
    }
379

    
380
///////////////////////////////////////////////////////////////////////////////////////////////////
381

    
382
  private int retFaceTetraBelongsTo(int tetra, int numLayers)
383
    {
384
    for(int i=numLayers-1; i>0; i--)
385
      {
386
      if( tetra < 8*i ) return mTetraToFaceMap[tetra/i];
387
      tetra -= 8*i;
388
      }
389

    
390
    return -1;
391
    }
392

    
393
///////////////////////////////////////////////////////////////////////////////////////////////////
394

    
395
  private Static4D getQuat(int cubit, int numLayers, int numO)
396
    {
397
    if( cubit<numO ) return QUATS[0];
398

    
399
    switch( retFaceTetraBelongsTo(cubit-numO, numLayers) )
400
      {
401
      case 0: return QUATS[0];                          // unit quat
402
      case 1: return new Static4D(0,-SQ2/2,0,SQ2/2);    //  90 along Y
403
      case 2: return QUATS[1];                          // 180 along Y
404
      case 3: return new Static4D(0,+SQ2/2,0,SQ2/2);    //  90 along
405
      case 4: return new Static4D(0,     0,1,    0);    // 180 along Z
406
      case 5: return new Static4D(SQ2/2, 0,SQ2/2,0);    //
407
      case 6: return new Static4D(     1,0,0,    0);    // 180 along X
408
      case 7: return new Static4D(-SQ2/2,0,SQ2/2,0);    //
409
      }
410

    
411
    return null;
412
    }
413

    
414
///////////////////////////////////////////////////////////////////////////////////////////////////
415

    
416
  MeshBase createCubitMesh(int cubit, int numLayers)
417
    {
418
    if( mMeshes==null )
419
      {
420
      FactoryCubit factory = FactoryCubit.getInstance();
421
      factory.clear();
422
      mMeshes = new MeshBase[2];
423
      }
424

    
425
    MeshBase mesh;
426
    int numO = getNumOctahedrons(numLayers);
427

    
428
    if( cubit<numO )
429
      {
430
      if( mMeshes[0]==null )
431
        {
432
        float[][] bands     = new float[][] { {0.05f,35,0.5f,0.8f,6,2,2} };
433
        int[] bandIndexes   = new int[] { 0,0,0,0,0,0,0,0 };
434
        float[][] corners   = new float[][] { {0.04f,0.20f} };
435
        int[] cornerIndexes = new int[] { 0,0,0,0,0,0 };
436
        float[][] centers   = new float[][] { {0.0f, 0.0f, 0.0f} };
437
        int[] centerIndexes = new int[] { 0,0,0,0,0,0 };
438

    
439
        FactoryCubit factory = FactoryCubit.getInstance();
440

    
441
        factory.createNewFaceTransform(VERTICES_OCTA,VERT_INDEXES_OCTA);
442
        mMeshes[0] = factory.createRoundedSolid(VERTICES_OCTA, VERT_INDEXES_OCTA,
443
                                                bands, bandIndexes,
444
                                                corners, cornerIndexes,
445
                                                centers, centerIndexes,
446
                                                getNumCubitFaces() );
447
        }
448
      mesh = mMeshes[0].copy(true);
449
      }
450
    else
451
      {
452
      if( mMeshes[1]==null )
453
        {
454
        float[][] bands     = new float[][] { {0.05f,35,0.5f,0.8f,6,2,2} };
455
        int[] bandIndexes   = new int[] { 0,0,0,0 };
456
        float[][] corners   = new float[][] { {0.08f,0.15f} };
457
        int[] cornerIndexes = new int[] { 0,0,0,0 };
458
        float[][] centers   = new float[][] { {0.0f, 0.0f, 0.0f} };
459
        int[] centerIndexes = new int[] { 0,0,0,0 };
460

    
461
        FactoryCubit factory = FactoryCubit.getInstance();
462

    
463
        factory.createNewFaceTransform(VERTICES_TETRA,VERT_INDEXES_TETRA);
464
        mMeshes[1] = factory.createRoundedSolid(VERTICES_TETRA, VERT_INDEXES_TETRA,
465
                                                bands, bandIndexes,
466
                                                corners, cornerIndexes,
467
                                                centers, centerIndexes,
468
                                                getNumCubitFaces() );
469
        }
470
      mesh = mMeshes[1].copy(true);
471
      }
472

    
473
    Static4D sQ = getQuat(cubit,numLayers,numO);
474
    MatrixEffectQuaternion quat = new MatrixEffectQuaternion( sQ, new Static3D(0,0,0) );
475
    mesh.apply(quat,0xffffffff,0);
476

    
477
    return mesh;
478
    }
479

    
480
///////////////////////////////////////////////////////////////////////////////////////////////////
481

    
482
  int getFaceColor(int cubit, int cubitface, int size)
483
    {
484
    int numO = getNumOctahedrons(size);
485

    
486
    if( cubit<numO )
487
      {
488
      int axis = 0;
489
      int layer= 1;
490

    
491
      switch(cubitface)
492
        {
493
        case 0: axis = 2; layer =             1; break;
494
        case 1: axis = 0; layer = (1<<(size-1)); break;
495
        case 2: axis = 3; layer =             1; break;
496
        case 3: axis = 1; layer = (1<<(size-1)); break;
497
        case 4: axis = 3; layer = (1<<(size-1)); break;
498
        case 5: axis = 1; layer =             1; break;
499
        case 6: axis = 2; layer = (1<<(size-1)); break;
500
        case 7: axis = 0; layer =             1; break;
501
        }
502

    
503
      return CUBITS[cubit].mRotationRow[axis] == layer ? cubitface : NUM_TEXTURES;
504
      }
505
    else
506
      {
507
      return cubitface>0 ? NUM_TEXTURES : retFaceTetraBelongsTo(cubit-numO, size);
508
      }
509
    }
510

    
511
///////////////////////////////////////////////////////////////////////////////////////////////////
512

    
513
  void createFaceTexture(Canvas canvas, Paint paint, int face, int left, int top)
514
    {
515
    float R = 0.06f;
516
    float S = 0.07f;
517

    
518
    FactorySticker factory = FactorySticker.getInstance();
519
    factory.drawRoundedPolygon(canvas, paint, left, top, STICKERS[0], S, FACE_COLORS[face], R);
520
    }
521

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

    
524
  float returnMultiplier()
525
    {
526
    return 1.5f;
527
    }
528

    
529
///////////////////////////////////////////////////////////////////////////////////////////////////
530

    
531
  float[] getRowChances(int numLayers)
532
    {
533
    float[] chances = new float[numLayers];
534

    
535
    for(int i=0; i<numLayers; i++) chances[i] = ((float)(i+1))/numLayers;
536

    
537
    return chances;
538
    }
539

    
540
///////////////////////////////////////////////////////////////////////////////////////////////////
541
// PUBLIC API
542

    
543
  public Static3D[] getRotationAxis()
544
    {
545
    return ROT_AXIS;
546
    }
547

    
548
///////////////////////////////////////////////////////////////////////////////////////////////////
549

    
550
  public int getBasicAngle()
551
    {
552
    return 3;
553
    }
554

    
555
///////////////////////////////////////////////////////////////////////////////////////////////////
556

    
557
  public void randomizeNewScramble(int[][] scramble, Random rnd, int num)
558
    {
559
    if( num==0 )
560
      {
561
      scramble[num][0] = rnd.nextInt(ROTATION_AXIS.length);
562
      }
563
    else
564
      {
565
      int newVector = rnd.nextInt(ROTATION_AXIS.length-1);
566
      scramble[num][0] = (newVector>=scramble[num-1][0] ? newVector+1 : newVector);
567
      }
568

    
569
    float rowFloat = rnd.nextFloat();
570

    
571
    for(int row=0; row<mRowChances.length; row++)
572
      {
573
      if( rowFloat<=mRowChances[row] )
574
        {
575
        scramble[num][1] = row;
576
        break;
577
        }
578
      }
579

    
580
    switch( rnd.nextInt(2) )
581
      {
582
      case 0: scramble[num][2] = -1; break;
583
      case 1: scramble[num][2] =  1; break;
584
      }
585
    }
586

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

    
589
  int mulQuat(int q1, int q2)
590
    {
591
    Static4D result = RubikSurfaceView.quatMultiply(QUATS[q1],QUATS[q2]);
592

    
593
    float rX = result.get0();
594
    float rY = result.get1();
595
    float rZ = result.get2();
596
    float rW = result.get3();
597

    
598
    final float MAX_ERROR = 0.1f;
599
    float dX,dY,dZ,dW;
600

    
601
    for(int i=0; i<QUATS.length; i++)
602
      {
603
      dX = QUATS[i].get0() - rX;
604
      dY = QUATS[i].get1() - rY;
605
      dZ = QUATS[i].get2() - rZ;
606
      dW = QUATS[i].get3() - rW;
607

    
608
      if( dX<MAX_ERROR && dX>-MAX_ERROR &&
609
          dY<MAX_ERROR && dY>-MAX_ERROR &&
610
          dZ<MAX_ERROR && dZ>-MAX_ERROR &&
611
          dW<MAX_ERROR && dW>-MAX_ERROR  ) return i;
612

    
613
      dX = QUATS[i].get0() + rX;
614
      dY = QUATS[i].get1() + rY;
615
      dZ = QUATS[i].get2() + rZ;
616
      dW = QUATS[i].get3() + rW;
617

    
618
      if( dX<MAX_ERROR && dX>-MAX_ERROR &&
619
          dY<MAX_ERROR && dY>-MAX_ERROR &&
620
          dZ<MAX_ERROR && dZ>-MAX_ERROR &&
621
          dW<MAX_ERROR && dW>-MAX_ERROR  ) return i;
622
      }
623

    
624
    return -1;
625
    }
626

    
627
///////////////////////////////////////////////////////////////////////////////////////////////////
628
// The Diamond is solved if and only if:
629
//
630
// 1) all octahedrons are rotated with the same quat
631
// 2) all tetrahedrons might be also optionally rotated by a 'face neutral' pair of quats
632
//    (indexes of those are kept in the 'mFaceNeutralQuattIndex' table)
633
//
634
// Note: this works for any size, because even if layers>3 - and then there are 'face-internal'
635
// octahedrons which, it would seem, can be rotated by those 'face neutral' pairs of quats - but
636
// in reality no, because if they were, the octahedrons would then not fit in the lattice...
637

    
638
  public boolean isSolved()
639
    {
640
    int q = CUBITS[0].mQuatIndex;
641
    int layers = getNumLayers();
642
    int numO = getNumOctahedrons(layers);
643

    
644
    for(int i=1; i<numO; i++)
645
      {
646
      if( CUBITS[i].mQuatIndex != q ) return false;
647
      }
648

    
649
    int qI, q1Index, q2Index, face;
650

    
651
    for(int i=numO; i<NUM_CUBITS; i++)
652
      {
653
      face    = retFaceTetraBelongsTo(i-numO,layers);
654
      q1Index = mFaceNeutralQuatIndex[face][0];
655
      q2Index = mFaceNeutralQuatIndex[face][1];
656
      qI      = CUBITS[i].mQuatIndex;
657

    
658
      if(  qI != q && qI != mulQuat(q,q1Index) && qI != mulQuat(q,q2Index) ) return false;
659
      }
660

    
661
    return true;
662
    }
663

    
664
///////////////////////////////////////////////////////////////////////////////////////////////////
665
// only needed for solvers - there are no Diamond solvers ATM
666

    
667
  public String retObjectString()
668
    {
669
    return "";
670
    }
671

    
672
///////////////////////////////////////////////////////////////////////////////////////////////////
673

    
674
  public int getObjectName(int numLayers)
675
    {
676
    switch(numLayers)
677
      {
678
      case 2: return R.string.diam2;
679
      case 3: return R.string.diam3;
680
      }
681

    
682
    return 0;
683
    }
684

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

    
687
  public int getInventor(int numLayers)
688
    {
689
    switch(numLayers)
690
      {
691
      case 2: return R.string.diam2_inventor;
692
      case 3: return R.string.diam3_inventor;
693
      }
694

    
695
    return 0;
696
    }
697

    
698
///////////////////////////////////////////////////////////////////////////////////////////////////
699

    
700
  public int getComplexity(int numLayers)
701
    {
702
    switch(numLayers)
703
      {
704
      case 2: return 5;
705
      case 3: return 7;
706
      }
707

    
708
    return 0;
709
    }
710
}
(20-20/33)