Project

General

Profile

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

distorted-objectlib / src / main / java / org / distorted / objectlib / objects / TwistyDiamond.java @ 43a4ccff

1 29b82486 Leszek Koltunski
///////////////////////////////////////////////////////////////////////////////////////////////////
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.objectlib.objects;
21
22 59c20632 Leszek Koltunski
import static org.distorted.objectlib.main.Movement.MOVEMENT_OCTAHEDRON;
23 29b82486 Leszek Koltunski
import static org.distorted.objectlib.main.Movement.TYPE_NOT_SPLIT;
24
25
import android.content.res.Resources;
26
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
33
import org.distorted.objectlib.R;
34
import org.distorted.objectlib.main.Movement8;
35 8592461c Leszek Koltunski
import org.distorted.objectlib.main.ObjectControl;
36 8005e762 Leszek Koltunski
import org.distorted.objectlib.main.ObjectType;
37 198c5bf0 Leszek Koltunski
import org.distorted.objectlib.helpers.ObjectShape;
38
import org.distorted.objectlib.helpers.ObjectSticker;
39
import org.distorted.objectlib.helpers.ScrambleState;
40 29b82486 Leszek Koltunski
import org.distorted.objectlib.main.Twisty8;
41
42
///////////////////////////////////////////////////////////////////////////////////////////////////
43
44
public class TwistyDiamond extends Twisty8
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 ScrambleState[] mStates;
56
  private int[] mBasicAngle;
57
  private int[] mFaceMap;
58
  private float[][] mCuts;
59
  private Static4D[] mQuats;
60
  private int[] mTetraToFaceMap;
61
  private ObjectSticker[] mStickers;
62
63
///////////////////////////////////////////////////////////////////////////////////////////////////
64
65 a57e6870 Leszek Koltunski
  public TwistyDiamond(int[] numL, Static4D quat, Static3D move, DistortedTexture texture,
66 e7daa161 Leszek Koltunski
                       MeshSquare mesh, DistortedEffects effects, Resources res, int surfaceW, int surfaceH)
67 29b82486 Leszek Koltunski
    {
68 e7daa161 Leszek Koltunski
    super(numL, numL[0], quat, move, texture, mesh, effects, res, surfaceW, surfaceH);
69 29b82486 Leszek Koltunski
    }
70
71
///////////////////////////////////////////////////////////////////////////////////////////////////
72
73 f9a81f52 Leszek Koltunski
  public ScrambleState[] getScrambleStates()
74 29b82486 Leszek Koltunski
    {
75
    if( mStates==null )
76
      {
77 a57e6870 Leszek Koltunski
      int[] numLayers = getNumLayers();
78
      int numL = numLayers[0];
79
      int[] tmp = new int[3*2*numL];
80 29b82486 Leszek Koltunski
81 a57e6870 Leszek Koltunski
      for(int i=0; i<2*numL; i++)
82 29b82486 Leszek Koltunski
        {
83 a57e6870 Leszek Koltunski
        tmp[3*i  ] = (i<numL) ?  i:i-numL;
84 29b82486 Leszek Koltunski
        tmp[3*i+1] = (i%2==0) ? -1:1;
85
        tmp[3*i+2] = 0;
86
        }
87
88
      mStates = new ScrambleState[]
89
        {
90
        new ScrambleState( new int[][] {tmp,tmp,tmp,tmp} )
91
        };
92
      }
93
94
    return mStates;
95
    }
96
97 4e1dc313 Leszek Koltunski
///////////////////////////////////////////////////////////////////////////////////////////////////
98
99 a57e6870 Leszek Koltunski
  protected int getResource(int[] numLayers)
100 4e1dc313 Leszek Koltunski
    {
101 a57e6870 Leszek Koltunski
    switch(numLayers[0])
102 4e1dc313 Leszek Koltunski
      {
103
      case 2: return R.raw.diam2;
104
      case 3: return R.raw.diam3;
105
      case 4: return R.raw.diam4;
106
      }
107
108
    return 0;
109
    }
110
111 29b82486 Leszek Koltunski
///////////////////////////////////////////////////////////////////////////////////////////////////
112
113
  private void initializeQuats()
114
    {
115
    mQuats = new Static4D[]
116
         {
117
          new Static4D(  0.0f,  0.0f,   0.0f,  1.0f ),
118
          new Static4D(  0.0f,  1.0f,   0.0f,  0.0f ),
119
          new Static4D(+SQ2/2,  0.0f, -SQ2/2,  0.0f ),
120
          new Static4D(-SQ2/2,  0.0f, -SQ2/2,  0.0f ),
121
122
          new Static4D(+SQ2/2,  0.5f,   0.0f,  0.5f ),
123
          new Static4D(-SQ2/2,  0.5f,   0.0f,  0.5f ),
124
          new Static4D(  0.0f,  0.5f, +SQ2/2,  0.5f ),
125
          new Static4D(  0.0f,  0.5f, -SQ2/2,  0.5f ),
126
          new Static4D(+SQ2/2,  0.5f,   0.0f, -0.5f ),
127
          new Static4D(-SQ2/2,  0.5f,   0.0f, -0.5f ),
128
          new Static4D(  0.0f,  0.5f, +SQ2/2, -0.5f ),
129
          new Static4D(  0.0f,  0.5f, -SQ2/2, -0.5f )
130
         };
131
    }
132
133
///////////////////////////////////////////////////////////////////////////////////////////////////
134
135 7b832206 Leszek Koltunski
  public int[] getSolvedQuats(int cubit, int[] numLayers)
136 29b82486 Leszek Koltunski
    {
137
    if( mQuats==null ) initializeQuats();
138
    if( mFaceMap==null ) mFaceMap = new int[] {4,0,6,2,7,3,5,1};
139
    int status = retCubitSolvedStatus(cubit,numLayers);
140
    return status<0 ? null : buildSolvedQuats(Movement8.FACE_AXIS[mFaceMap[status]],mQuats);
141
    }
142
143
///////////////////////////////////////////////////////////////////////////////////////////////////
144
145 1bb09f88 Leszek Koltunski
  public Static4D[] getQuats()
146 29b82486 Leszek Koltunski
    {
147
    if( mQuats==null ) initializeQuats();
148
    return mQuats;
149
    }
150
151
///////////////////////////////////////////////////////////////////////////////////////////////////
152
153 59c20632 Leszek Koltunski
  public int getSolvedFunctionIndex()
154 29b82486 Leszek Koltunski
    {
155
    return 0;
156
    }
157
158
///////////////////////////////////////////////////////////////////////////////////////////////////
159
160 1bb09f88 Leszek Koltunski
  public int getNumStickerTypes(int[] numLayers)
161 29b82486 Leszek Koltunski
    {
162
    return 1;
163
    }
164
165
///////////////////////////////////////////////////////////////////////////////////////////////////
166
167 7bbfc84f Leszek Koltunski
  public float[][] getCuts(int[] numLayers)
168 29b82486 Leszek Koltunski
    {
169 a57e6870 Leszek Koltunski
    int numL = numLayers[0];
170
    if( numL<2 ) return null;
171 29b82486 Leszek Koltunski
172
    if( mCuts==null )
173
      {
174 a57e6870 Leszek Koltunski
      mCuts = new float[4][numL-1];
175
      float cut = (SQ6/6)*(2-numL);
176 29b82486 Leszek Koltunski
177 a57e6870 Leszek Koltunski
      for(int i=0; i<numL-1; i++)
178 29b82486 Leszek Koltunski
        {
179
        mCuts[0][i] = cut;
180
        mCuts[1][i] = cut;
181
        mCuts[2][i] = cut;
182
        mCuts[3][i] = cut;
183
        cut += SQ6/3;
184
        }
185
      }
186
187
    return mCuts;
188
    }
189
190
///////////////////////////////////////////////////////////////////////////////////////////////////
191
192 59c20632 Leszek Koltunski
  public boolean[][] getLayerRotatable(int[] numLayers)
193 29b82486 Leszek Koltunski
    {
194 59c20632 Leszek Koltunski
    int numAxis = ROT_AXIS.length;
195
    boolean[][] layerRotatable = new boolean[numAxis][];
196 a57e6870 Leszek Koltunski
197 59c20632 Leszek Koltunski
    for(int i=0; i<numAxis; i++)
198
      {
199
      layerRotatable[i] = new boolean[numLayers[i]];
200
      for(int j=0; j<numLayers[i]; j++) layerRotatable[i][j] = true;
201 29b82486 Leszek Koltunski
      }
202 59c20632 Leszek Koltunski
203
    return layerRotatable;
204
    }
205
206
///////////////////////////////////////////////////////////////////////////////////////////////////
207
208
  public int getMovementType()
209
    {
210
    return MOVEMENT_OCTAHEDRON;
211
    }
212
213
///////////////////////////////////////////////////////////////////////////////////////////////////
214
215
  public int getMovementSplit()
216
    {
217
    return TYPE_NOT_SPLIT;
218
    }
219
220
///////////////////////////////////////////////////////////////////////////////////////////////////
221
222
  public int[][][] getEnabled()
223
    {
224
    return new int[][][]
225
      {
226
          {{1,2,3}},{{1,2,3}},{{0,2,3}},{{0,2,3}},{{0,1,3}},{{0,1,3}},{{0,1,2}},{{0,1,2}}
227
      };
228
    }
229
230
///////////////////////////////////////////////////////////////////////////////////////////////////
231
232
  public float[] getDist3D(int[] numLayers)
233
    {
234
    return null;
235 29b82486 Leszek Koltunski
    }
236
237
///////////////////////////////////////////////////////////////////////////////////////////////////
238
239
  protected int getNumCubitFaces()
240
    {
241
    return 8;
242
    }
243
244
///////////////////////////////////////////////////////////////////////////////////////////////////
245
246
  private int getNumOctahedrons(int layers)
247
    {
248
    return layers==1 ? 1 : 4*(layers-1)*(layers-1) + 2;
249
    }
250
251
///////////////////////////////////////////////////////////////////////////////////////////////////
252
253
  private int getNumTetrahedrons(int layers)
254
    {
255
    return 4*layers*(layers-1);
256
    }
257
258
///////////////////////////////////////////////////////////////////////////////////////////////////
259
260
  private int createOctaPositions(float[][] centers, int index, int layers, float height)
261
    {
262
    float x = (layers-1)*0.5f;
263
    float z = (layers+1)*0.5f;
264
265
    for(int i=0; i<layers; i++, index++)
266
      {
267
      z -= 1;
268
      centers[index][0] = x;
269
      centers[index][1] = height;
270
      centers[index][2] = z;
271
      }
272
273
    for(int i=0; i<layers-1; i++, index++)
274
      {
275
      x -= 1;
276
      centers[index][0] = x;
277
      centers[index][1] = height;
278
      centers[index][2] = z;
279
      }
280
281
    for(int i=0; i<layers-1; i++, index++)
282
      {
283
      z += 1;
284
      centers[index][0] = x;
285
      centers[index][1] = height;
286
      centers[index][2] = z;
287
      }
288
289
    for(int i=0; i<layers-2; i++, index++)
290
      {
291
      x += 1;
292
      centers[index][0] = x;
293
      centers[index][1] = height;
294
      centers[index][2] = z;
295
      }
296
297
    return index;
298
    }
299
300
///////////////////////////////////////////////////////////////////////////////////////////////////
301
302
  private int createTetraPositions(float[][] centers, int index, int layers, float height)
303
    {
304
    float x = (layers-1)*0.5f;
305
    float z =  layers*0.5f;
306
307
    for(int i=0; i<layers-1; i++, index++)
308
      {
309
      z -= 1;
310
      centers[index][0] = x;
311
      centers[index][1] = height;
312
      centers[index][2] = z;
313
      }
314
315
    x += 0.5f;
316
    z -= 0.5f;
317
318
    for(int i=0; i<layers-1; i++, index++)
319
      {
320
      x -= 1;
321
      centers[index][0] = x;
322
      centers[index][1] = height;
323
      centers[index][2] = z;
324
      }
325
326
    x -= 0.5f;
327
    z -= 0.5f;
328
329
    for(int i=0; i<layers-1; i++, index++)
330
      {
331
      z += 1;
332
      centers[index][0] = x;
333
      centers[index][1] = height;
334
      centers[index][2] = z;
335
      }
336
337
    x -= 0.5f;
338
    z += 0.5f;
339
340
    for(int i=0; i<layers-1; i++, index++)
341
      {
342
      x += 1;
343
      centers[index][0] = x;
344
      centers[index][1] = height;
345
      centers[index][2] = z;
346
      }
347
348
    return index;
349
    }
350
351
///////////////////////////////////////////////////////////////////////////////////////////////////
352
353 7b832206 Leszek Koltunski
  public float[][] getCubitPositions(int[] numLayers)
354 29b82486 Leszek Koltunski
    {
355 a57e6870 Leszek Koltunski
    int layers = numLayers[0];
356 29b82486 Leszek Koltunski
    int numO = getNumOctahedrons(layers);
357
    int numT = getNumTetrahedrons(layers);
358
    int index = 0;
359
    float height = 0.0f;
360
361
    float[][] CENTERS = new float[numO+numT][3];
362
363
    index = createOctaPositions(CENTERS,index,layers,height);
364
365
    for(int i=layers-1; i>0; i--)
366
      {
367
      height += SQ2/2;
368
      index = createOctaPositions(CENTERS,index,i,+height);
369
      index = createOctaPositions(CENTERS,index,i,-height);
370
      }
371
372
    height = SQ2/4;
373
374
    for(int i=layers; i>1; i--)
375
      {
376
      index = createTetraPositions(CENTERS,index,i,+height);
377
      index = createTetraPositions(CENTERS,index,i,-height);
378
      height += SQ2/2;
379
      }
380
381
    return CENTERS;
382
    }
383
384
///////////////////////////////////////////////////////////////////////////////////////////////////
385
386
  private int retFaceTetraBelongsTo(int tetra, int numLayers)
387
    {
388
    if( mTetraToFaceMap==null ) mTetraToFaceMap = new int[] {1,2,3,0,5,6,7,4};
389
390
    for(int i=numLayers-1; i>0; i--)
391
      {
392
      if( tetra < 8*i ) return mTetraToFaceMap[tetra/i];
393
      tetra -= 8*i;
394
      }
395
396
    return -1;
397
    }
398
399
///////////////////////////////////////////////////////////////////////////////////////////////////
400
401 e30c522a Leszek Koltunski
  public ObjectShape getObjectShape(int variant)
402 29b82486 Leszek Koltunski
    {
403 e30c522a Leszek Koltunski
    int numL = getNumLayers()[0];
404 a57e6870 Leszek Koltunski
    int N = numL>3 ? 5:6;
405
    int E = numL>2 ? (numL>3 ? 0:1):2;
406 29b82486 Leszek Koltunski
407
    if( variant==0 )
408
      {
409
      double[][] vertices = new double[][]
410
          {
411
             { 0.5,   0.0, 0.5},
412
             { 0.5,   0.0,-0.5},
413
             {-0.5,   0.0,-0.5},
414
             {-0.5,   0.0, 0.5},
415
             { 0.0, SQ2/2, 0.0},
416
             { 0.0,-SQ2/2, 0.0}
417
          };
418
419
      int[][] vert_indices = new int[][]
420
          {
421
             {3,0,4},
422
             {0,1,4},
423
             {1,2,4},
424
             {2,3,4},
425
             {5,0,3},
426
             {5,1,0},
427
             {5,2,1},
428
             {5,3,2}
429
          };
430
431
      float[][] bands     = new float[][] { {0.05f,35,0.5f,0.8f,N,E,E} };
432
      int[] bandIndices   = new int[] { 0,0,0,0,0,0,0,0 };
433
      float[][] corners   = new float[][] { {0.04f,0.20f} };
434
      int[] cornerIndices = new int[] { 0,0,0,0,0,0 };
435
      float[][] centers   = new float[][] { {0.0f, 0.0f, 0.0f} };
436
      int[] centerIndices = new int[] { 0,0,0,0,0,0 };
437
      return new ObjectShape(vertices,vert_indices,bands,bandIndices,corners,cornerIndices,centers,centerIndices,getNumCubitFaces(), null);
438
      }
439
    else
440
      {
441
      double[][] vertices = new double[][] { {-0.5, SQ2/4, 0.0}, { 0.5, SQ2/4, 0.0}, { 0.0,-SQ2/4, 0.5}, { 0.0,-SQ2/4,-0.5} };
442
      int[][] vert_indices = new int[][]  { {2,1,0}, {2,3,1}, {3,2,0}, {3,0,1} };
443
      float[][] bands     = new float[][] { {0.05f,35,0.5f,0.8f,N,E,E} };
444
      int[] bandIndices   = new int[] { 0,0,0,0 };
445
      float[][] corners   = new float[][] { {0.08f,0.15f} };
446
      int[] cornerIndices = new int[] { 0,0,0,0 };
447
      float[][] centers   = new float[][] { {0.0f, 0.0f, 0.0f} };
448
      int[] centerIndices = new int[] { 0,0,0,0 };
449
      return new ObjectShape(vertices,vert_indices,bands,bandIndices,corners,cornerIndices,centers,centerIndices,getNumCubitFaces(), null);
450
      }
451
    }
452
453
///////////////////////////////////////////////////////////////////////////////////////////////////
454
455 7b832206 Leszek Koltunski
  public Static4D getQuat(int cubit, int[] numLayers)
456 29b82486 Leszek Koltunski
    {
457
    if( mQuats==null ) initializeQuats();
458 a57e6870 Leszek Koltunski
459
    int numL = numLayers[0];
460
    int numO = getNumOctahedrons(numL);
461 29b82486 Leszek Koltunski
462
    if( cubit<numO ) return mQuats[0];
463
464 a57e6870 Leszek Koltunski
    switch( retFaceTetraBelongsTo(cubit-numO, numL) )
465 29b82486 Leszek Koltunski
      {
466
      case 0: return mQuats[0];                         // unit quat
467
      case 1: return new Static4D(0,-SQ2/2,0,SQ2/2);    //  90 along Y
468
      case 2: return mQuats[1];                         // 180 along Y
469
      case 3: return new Static4D(0,+SQ2/2,0,SQ2/2);    //  90 along
470
      case 4: return new Static4D(0,     0,1,    0);    // 180 along Z
471
      case 5: return new Static4D(SQ2/2, 0,SQ2/2,0);    //
472
      case 6: return new Static4D(     1,0,0,    0);    // 180 along X
473
      case 7: return new Static4D(-SQ2/2,0,SQ2/2,0);    //
474
      }
475
476
    return null;
477
    }
478
479
///////////////////////////////////////////////////////////////////////////////////////////////////
480
481 e30c522a Leszek Koltunski
  public int getNumCubitVariants(int[] numLayers)
482 29b82486 Leszek Koltunski
    {
483
    return 2;
484
    }
485
486
///////////////////////////////////////////////////////////////////////////////////////////////////
487
488 e30c522a Leszek Koltunski
  public int getCubitVariant(int cubit, int[] numLayers)
489 29b82486 Leszek Koltunski
    {
490 a57e6870 Leszek Koltunski
    return cubit<getNumOctahedrons(numLayers[0]) ? 0 : 1;
491 29b82486 Leszek Koltunski
    }
492
493
///////////////////////////////////////////////////////////////////////////////////////////////////
494
495 a57e6870 Leszek Koltunski
  protected int getFaceColor(int cubit, int cubitface, int[] numLayers)
496 29b82486 Leszek Koltunski
    {
497 a57e6870 Leszek Koltunski
    int numL = numLayers[0];
498
    int numO = getNumOctahedrons(numL);
499 29b82486 Leszek Koltunski
500
    if( cubit<numO )
501
      {
502
      int axis = 0;
503
      int layer= 1;
504
505
      switch(cubitface)
506
        {
507
        case 0: axis = 2; layer =             1; break;
508 a57e6870 Leszek Koltunski
        case 1: axis = 0; layer = (1<<(numL-1)); break;
509 29b82486 Leszek Koltunski
        case 2: axis = 3; layer =             1; break;
510 a57e6870 Leszek Koltunski
        case 3: axis = 1; layer = (1<<(numL-1)); break;
511
        case 4: axis = 3; layer = (1<<(numL-1)); break;
512 29b82486 Leszek Koltunski
        case 5: axis = 1; layer =             1; break;
513 a57e6870 Leszek Koltunski
        case 6: axis = 2; layer = (1<<(numL-1)); break;
514 29b82486 Leszek Koltunski
        case 7: axis = 0; layer =             1; break;
515
        }
516
517
      return CUBITS[cubit].getRotRow(axis) == layer ? cubitface : NUM_TEXTURES;
518
      }
519
    else
520
      {
521 a57e6870 Leszek Koltunski
      return cubitface>0 ? NUM_TEXTURES : retFaceTetraBelongsTo(cubit-numO, numL);
522 29b82486 Leszek Koltunski
      }
523
    }
524
525
///////////////////////////////////////////////////////////////////////////////////////////////////
526
527 1bb09f88 Leszek Koltunski
  public ObjectSticker retSticker(int sticker)
528 29b82486 Leszek Koltunski
    {
529
    if( mStickers==null )
530
      {
531
      float[][] STICKERS = new float[][] { { -0.4330127f, -0.25f, 0.4330127f, -0.25f, 0.0f, 0.5f } };
532
      float radius = 0.06f;
533
      float stroke = 0.07f;
534
      float[] radii = new float[] {radius,radius,radius};
535 8592461c Leszek Koltunski
536
      if( ObjectControl.isInIconMode() )
537
        {
538 a57e6870 Leszek Koltunski
        int[] numLayers = getNumLayers();
539
540
        switch(numLayers[0])
541 8592461c Leszek Koltunski
          {
542
          case 2: stroke*=1.4f; break;
543
          case 3: stroke*=2.0f; break;
544
          case 4: stroke*=2.1f; break;
545
          default:stroke*=2.2f; break;
546
          }
547
        }
548
549 29b82486 Leszek Koltunski
      mStickers     = new ObjectSticker[STICKERS.length];
550
      mStickers[0]  = new ObjectSticker(STICKERS[0],null,radii,stroke);
551
      }
552
553 1bb09f88 Leszek Koltunski
    return mStickers[sticker];
554
    }
555 29b82486 Leszek Koltunski
556
///////////////////////////////////////////////////////////////////////////////////////////////////
557
// PUBLIC API
558
559
  public Static3D[] getRotationAxis()
560
    {
561
    return ROT_AXIS;
562
    }
563
564
///////////////////////////////////////////////////////////////////////////////////////////////////
565
566
  public int[] getBasicAngle()
567
    {
568
    if( mBasicAngle ==null ) mBasicAngle = new int[] { 3,3,3,3 };
569
    return mBasicAngle;
570
    }
571
572 61aa85e4 Leszek Koltunski
///////////////////////////////////////////////////////////////////////////////////////////////////
573
574 a57e6870 Leszek Koltunski
  public ObjectType intGetObjectType(int[] numLayers)
575 61aa85e4 Leszek Koltunski
    {
576 a57e6870 Leszek Koltunski
    switch(numLayers[0])
577 61aa85e4 Leszek Koltunski
      {
578 8005e762 Leszek Koltunski
      case 2: return ObjectType.DIAM_2;
579
      case 3: return ObjectType.DIAM_3;
580
      case 4: return ObjectType.DIAM_4;
581 61aa85e4 Leszek Koltunski
      }
582
583 8005e762 Leszek Koltunski
    return ObjectType.DIAM_2;
584 61aa85e4 Leszek Koltunski
    }
585
586 29b82486 Leszek Koltunski
///////////////////////////////////////////////////////////////////////////////////////////////////
587
588 a57e6870 Leszek Koltunski
  public int getObjectName(int[] numLayers)
589 29b82486 Leszek Koltunski
    {
590 a57e6870 Leszek Koltunski
    switch(numLayers[0])
591 29b82486 Leszek Koltunski
      {
592
      case 2: return R.string.diam2;
593
      case 3: return R.string.diam3;
594
      case 4: return R.string.diam4;
595
      }
596
597
    return 0;
598
    }
599
600
///////////////////////////////////////////////////////////////////////////////////////////////////
601
602 a57e6870 Leszek Koltunski
  public int getInventor(int[] numLayers)
603 29b82486 Leszek Koltunski
    {
604 a57e6870 Leszek Koltunski
    switch(numLayers[0])
605 29b82486 Leszek Koltunski
      {
606
      case 2: return R.string.diam2_inventor;
607
      case 3: return R.string.diam3_inventor;
608
      case 4: return R.string.diam4_inventor;
609
      }
610
611
    return 0;
612
    }
613
614 59c20632 Leszek Koltunski
///////////////////////////////////////////////////////////////////////////////////////////////////
615
616
  public int getYearOfInvention(int[] numLayers)
617
    {
618
    switch(numLayers[0])
619
      {
620
      case 2: return 1984;
621
      case 3: return 2003;
622
      case 4: return 2011;
623
      }
624
    return 1984;
625
    }
626
627 29b82486 Leszek Koltunski
///////////////////////////////////////////////////////////////////////////////////////////////////
628
629 a57e6870 Leszek Koltunski
  public int getComplexity(int[] numLayers)
630 29b82486 Leszek Koltunski
    {
631 a57e6870 Leszek Koltunski
    switch(numLayers[0])
632 29b82486 Leszek Koltunski
      {
633
      case 2: return 4;
634
      case 3: return 6;
635
      case 4: return 8;
636
      }
637
638
    return 0;
639
    }
640
}