Project

General

Profile

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

magiccube / src / main / java / org / distorted / objects / TwistyDiamond.java @ 31cd7256

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

    
437
        FactoryCubit factory = FactoryCubit.getInstance();
438

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

    
456
        FactoryCubit factory = FactoryCubit.getInstance();
457

    
458
        factory.createNewFaceTransform(VERTICES_TETRA,VERT_INDEXES_TETRA);
459
        mMeshes[1] = factory.createRoundedSolid(VERTICES_TETRA, VERT_INDEXES_TETRA,
460
                                                bands, bandIndexes,
461
                                                corners, cornerIndexes,
462
                                                getNumCubitFaces() );
463
        }
464
      mesh = mMeshes[1].copy(true);
465
      }
466

    
467
    Static4D sQ = getQuat(cubit,numLayers,numO);
468
    MatrixEffectQuaternion quat = new MatrixEffectQuaternion( sQ, new Static3D(0,0,0) );
469
    mesh.apply(quat,0xffffffff,0);
470

    
471
    return mesh;
472
    }
473

    
474
///////////////////////////////////////////////////////////////////////////////////////////////////
475

    
476
  int getFaceColor(int cubit, int cubitface, int size)
477
    {
478
    int numO = getNumOctahedrons(size);
479

    
480
    if( cubit<numO )
481
      {
482
      int axis = 0;
483
      int layer= 1;
484

    
485
      switch(cubitface)
486
        {
487
        case 0: axis = 2; layer =             1; break;
488
        case 1: axis = 0; layer = (1<<(size-1)); break;
489
        case 2: axis = 3; layer =             1; break;
490
        case 3: axis = 1; layer = (1<<(size-1)); break;
491
        case 4: axis = 3; layer = (1<<(size-1)); break;
492
        case 5: axis = 1; layer =             1; break;
493
        case 6: axis = 2; layer = (1<<(size-1)); break;
494
        case 7: axis = 0; layer =             1; break;
495
        }
496

    
497
      return CUBITS[cubit].mRotationRow[axis] == layer ? cubitface : NUM_TEXTURES;
498
      }
499
    else
500
      {
501
      return cubitface>0 ? NUM_TEXTURES : retFaceTetraBelongsTo(cubit-numO, size);
502
      }
503
    }
504

    
505
///////////////////////////////////////////////////////////////////////////////////////////////////
506

    
507
  void createFaceTexture(Canvas canvas, Paint paint, int face, int left, int top)
508
    {
509
    float R = 0.06f;
510
    float S = 0.07f;
511

    
512
    FactorySticker factory = FactorySticker.getInstance();
513
    factory.drawRoundedPolygon(canvas, paint, left, top, STICKERS[0], S, FACE_COLORS[face], R);
514
    }
515

    
516
///////////////////////////////////////////////////////////////////////////////////////////////////
517

    
518
  float returnMultiplier()
519
    {
520
    return 1.5f;
521
    }
522

    
523
///////////////////////////////////////////////////////////////////////////////////////////////////
524

    
525
  float[] getRowChances(int numLayers)
526
    {
527
    float[] chances = new float[numLayers];
528

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

    
531
    return chances;
532
    }
533

    
534
///////////////////////////////////////////////////////////////////////////////////////////////////
535
// PUBLIC API
536

    
537
  public Static3D[] getRotationAxis()
538
    {
539
    return ROT_AXIS;
540
    }
541

    
542
///////////////////////////////////////////////////////////////////////////////////////////////////
543

    
544
  public int getBasicAngle()
545
    {
546
    return 3;
547
    }
548

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

    
551
  public void randomizeNewScramble(int[][] scramble, Random rnd, int num)
552
    {
553
    if( num==0 )
554
      {
555
      scramble[num][0] = rnd.nextInt(ROTATION_AXIS.length);
556
      }
557
    else
558
      {
559
      int newVector = rnd.nextInt(ROTATION_AXIS.length-1);
560
      scramble[num][0] = (newVector>=scramble[num-1][0] ? newVector+1 : newVector);
561
      }
562

    
563
    float rowFloat = rnd.nextFloat();
564

    
565
    for(int row=0; row<mRowChances.length; row++)
566
      {
567
      if( rowFloat<=mRowChances[row] )
568
        {
569
        scramble[num][1] = row;
570
        break;
571
        }
572
      }
573

    
574
    switch( rnd.nextInt(2) )
575
      {
576
      case 0: scramble[num][2] = -1; break;
577
      case 1: scramble[num][2] =  1; break;
578
      }
579
    }
580

    
581
///////////////////////////////////////////////////////////////////////////////////////////////////
582

    
583
  int mulQuat(int q1, int q2)
584
    {
585
    Static4D result = RubikSurfaceView.quatMultiply(QUATS[q1],QUATS[q2]);
586

    
587
    float rX = result.get0();
588
    float rY = result.get1();
589
    float rZ = result.get2();
590
    float rW = result.get3();
591

    
592
    final float MAX_ERROR = 0.1f;
593
    float dX,dY,dZ,dW;
594

    
595
    for(int i=0; i<QUATS.length; i++)
596
      {
597
      dX = QUATS[i].get0() - rX;
598
      dY = QUATS[i].get1() - rY;
599
      dZ = QUATS[i].get2() - rZ;
600
      dW = QUATS[i].get3() - rW;
601

    
602
      if( dX<MAX_ERROR && dX>-MAX_ERROR &&
603
          dY<MAX_ERROR && dY>-MAX_ERROR &&
604
          dZ<MAX_ERROR && dZ>-MAX_ERROR &&
605
          dW<MAX_ERROR && dW>-MAX_ERROR  ) return i;
606

    
607
      dX = QUATS[i].get0() + rX;
608
      dY = QUATS[i].get1() + rY;
609
      dZ = QUATS[i].get2() + rZ;
610
      dW = QUATS[i].get3() + rW;
611

    
612
      if( dX<MAX_ERROR && dX>-MAX_ERROR &&
613
          dY<MAX_ERROR && dY>-MAX_ERROR &&
614
          dZ<MAX_ERROR && dZ>-MAX_ERROR &&
615
          dW<MAX_ERROR && dW>-MAX_ERROR  ) return i;
616
      }
617

    
618
    return -1;
619
    }
620

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

    
632
  public boolean isSolved()
633
    {
634
    int q = CUBITS[0].mQuatIndex;
635
    int layers = getNumLayers();
636
    int numO = getNumOctahedrons(layers);
637

    
638
    for(int i=1; i<numO; i++)
639
      {
640
      if( CUBITS[i].mQuatIndex != q ) return false;
641
      }
642

    
643
    int qI, q1Index, q2Index, face;
644

    
645
    for(int i=numO; i<NUM_CUBITS; i++)
646
      {
647
      face    = retFaceTetraBelongsTo(i-numO,layers);
648
      q1Index = mFaceNeutralQuatIndex[face][0];
649
      q2Index = mFaceNeutralQuatIndex[face][1];
650
      qI      = CUBITS[i].mQuatIndex;
651

    
652
      if(  qI != q && qI != mulQuat(q,q1Index) && qI != mulQuat(q,q2Index) ) return false;
653
      }
654

    
655
    return true;
656
    }
657

    
658
///////////////////////////////////////////////////////////////////////////////////////////////////
659
// only needed for solvers - there are no Diamond solvers ATM
660

    
661
  public String retObjectString()
662
    {
663
    return "";
664
    }
665

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

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

    
676
    return 0;
677
    }
678

    
679
///////////////////////////////////////////////////////////////////////////////////////////////////
680

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

    
689
    return 0;
690
    }
691

    
692
///////////////////////////////////////////////////////////////////////////////////////////////////
693

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

    
702
    return 0;
703
    }
704
}
(20-20/33)