Project

General

Profile

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

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

1 ece1b58d 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.objects;
21
22
import android.content.res.Resources;
23
24 f10a88a8 Leszek Koltunski
import org.distorted.helpers.ObjectShape;
25 9c06394a Leszek Koltunski
import org.distorted.helpers.ObjectSticker;
26 ece1b58d Leszek Koltunski
import org.distorted.library.main.DistortedEffects;
27
import org.distorted.library.main.DistortedTexture;
28
import org.distorted.library.mesh.MeshSquare;
29
import org.distorted.library.type.Static3D;
30
import org.distorted.library.type.Static4D;
31 6fd4a72c Leszek Koltunski
import org.distorted.main.R;
32 ece1b58d Leszek Koltunski
33
import java.util.Random;
34
35
///////////////////////////////////////////////////////////////////////////////////////////////////
36
37 9c2f0c91 Leszek Koltunski
public class TwistyDiamond extends TwistyObject
38 ece1b58d Leszek Koltunski
{
39
  private static final int FACES_PER_CUBIT =8;
40
41
  // the four rotation axis of a Diamond. Must be normalized.
42
  static final Static3D[] ROT_AXIS = new Static3D[]
43
         {
44
           new Static3D(+SQ6/3,+SQ3/3,     0),
45
           new Static3D(-SQ6/3,+SQ3/3,     0),
46 cc99cf91 Leszek Koltunski
           new Static3D(     0,-SQ3/3,-SQ6/3),
47
           new Static3D(     0,-SQ3/3,+SQ6/3)
48 ece1b58d Leszek Koltunski
         };
49
50 925ed78f Leszek Koltunski
  private static final int[] BASIC_ANGLE = new int[] { 3,3,3,3 };
51
52 ece1b58d Leszek Koltunski
  private static final int[] FACE_COLORS = new int[]
53
         {
54 2ef489e2 Leszek Koltunski
           COLOR_ORANGE, COLOR_VIOLET,
55
           COLOR_WHITE , COLOR_BLUE  ,
56
           COLOR_YELLOW, COLOR_RED   ,
57
           COLOR_GREEN , COLOR_GREY
58 ece1b58d Leszek Koltunski
         };
59
60 a480ee80 Leszek Koltunski
  private static final int[] mFaceMap = new int[] {4,0,6,2,7,3,5,1};
61
62 ab0c28f0 Leszek Koltunski
  // All legal rotation quats of a Diamond: unit + three 180 deg turns + 8 generators
63 ece1b58d Leszek Koltunski
  private static final Static4D[] QUATS = new Static4D[]
64
         {
65
           new Static4D(  0.0f,  0.0f,   0.0f,  1.0f ),
66
           new Static4D(  0.0f,  1.0f,   0.0f,  0.0f ),
67 ab0c28f0 Leszek Koltunski
           new Static4D(+SQ2/2,  0.0f, -SQ2/2,  0.0f ),
68
           new Static4D(-SQ2/2,  0.0f, -SQ2/2,  0.0f ),
69
70 ece1b58d Leszek Koltunski
           new Static4D(+SQ2/2,  0.5f,   0.0f,  0.5f ),
71
           new Static4D(-SQ2/2,  0.5f,   0.0f,  0.5f ),
72
           new Static4D(  0.0f,  0.5f, +SQ2/2,  0.5f ),
73
           new Static4D(  0.0f,  0.5f, -SQ2/2,  0.5f ),
74
           new Static4D(+SQ2/2,  0.5f,   0.0f, -0.5f ),
75
           new Static4D(-SQ2/2,  0.5f,   0.0f, -0.5f ),
76
           new Static4D(  0.0f,  0.5f, +SQ2/2, -0.5f ),
77 ab0c28f0 Leszek Koltunski
           new Static4D(  0.0f,  0.5f, -SQ2/2, -0.5f )
78 ece1b58d Leszek Koltunski
         };
79
80
  private static final float DIST = 0.50f;
81
82 68b5f9c5 Leszek Koltunski
  private static final int[] mTetraToFaceMap = new int[] {1,2,3,0,5,6,7,4};
83
84 31cd7256 Leszek Koltunski
  private static final double[][] VERTICES_TETRA = new double[][]
85 b1f2ccf5 Leszek Koltunski
          {
86
             {-0.5, SQ2/4, 0.0},
87
             { 0.5, SQ2/4, 0.0},
88
             { 0.0,-SQ2/4, 0.5},
89
             { 0.0,-SQ2/4,-0.5}
90
          };
91
92 31cd7256 Leszek Koltunski
  private static final int[][] VERT_INDEXES_TETRA = new int[][]
93 b1f2ccf5 Leszek Koltunski
          {
94
             {2,1,0},   // counterclockwise!
95
             {2,3,1},
96
             {3,2,0},
97
             {3,0,1}
98
          };
99
100 31cd7256 Leszek Koltunski
  private static final double[][] VERTICES_OCTA = new double[][]
101 b1f2ccf5 Leszek Koltunski
          {
102
             { 0.5,   0.0, 0.5},
103
             { 0.5,   0.0,-0.5},
104
             {-0.5,   0.0,-0.5},
105
             {-0.5,   0.0, 0.5},
106
             { 0.0, SQ2/2, 0.0},
107
             { 0.0,-SQ2/2, 0.0}
108
          };
109
110 31cd7256 Leszek Koltunski
  private static final int[][] VERT_INDEXES_OCTA = new int[][]
111 b1f2ccf5 Leszek Koltunski
          {
112
             {3,0,4},   // counterclockwise!
113
             {0,1,4},
114
             {1,2,4},
115
             {2,3,4},
116
             {5,0,3},
117
             {5,1,0},
118
             {5,2,1},
119
             {5,3,2}
120
          };
121
122 31cd7256 Leszek Koltunski
  private static final float[][] STICKERS = new float[][]
123
          {
124
             { -0.4330127f, -0.25f, 0.4330127f, -0.25f, 0.0f, 0.5f }
125
          };
126
127 9c06394a Leszek Koltunski
  private static final ObjectSticker[] mStickers;
128
129
  static
130
    {
131
    float radius = 0.06f;
132
    float stroke = 0.07f;
133
    float[] radii = new float[] {radius,radius,radius};
134
    mStickers = new ObjectSticker[STICKERS.length];
135
    mStickers[0] = new ObjectSticker(STICKERS[0],null,radii,stroke);
136
    }
137
138 ece1b58d Leszek Koltunski
///////////////////////////////////////////////////////////////////////////////////////////////////
139
140 9c2f0c91 Leszek Koltunski
  TwistyDiamond(int size, Static4D quat, DistortedTexture texture,
141
                MeshSquare mesh, DistortedEffects effects, int[][] moves, Resources res, int scrWidth)
142 ece1b58d Leszek Koltunski
    {
143 db875721 Leszek Koltunski
    super(size, size, quat, texture, mesh, effects, moves, ObjectList.DIAM, res, scrWidth);
144 ece1b58d Leszek Koltunski
    }
145
146 a480ee80 Leszek Koltunski
///////////////////////////////////////////////////////////////////////////////////////////////////
147
148
  int[] getSolvedQuats(int cubit, int numLayers)
149
    {
150
    int status = retCubitSolvedStatus(cubit,numLayers);
151
    return status<0 ? null : buildSolvedQuats(MovementDiamond.FACE_AXIS[mFaceMap[status]],QUATS);
152
    }
153
154 ece1b58d Leszek Koltunski
///////////////////////////////////////////////////////////////////////////////////////////////////
155
156
  float getScreenRatio()
157
    {
158 ab0c28f0 Leszek Koltunski
    return 0.65f;
159 ece1b58d Leszek Koltunski
    }
160
161
///////////////////////////////////////////////////////////////////////////////////////////////////
162
163
  Static4D[] getQuats()
164
    {
165
    return QUATS;
166
    }
167
168
///////////////////////////////////////////////////////////////////////////////////////////////////
169
170
  int getNumFaces()
171
    {
172
    return FACE_COLORS.length;
173
    }
174
175
///////////////////////////////////////////////////////////////////////////////////////////////////
176
177
  boolean shouldResetTextureMaps()
178
    {
179
    return false;
180
    }
181
182
///////////////////////////////////////////////////////////////////////////////////////////////////
183
184 a64e07d0 Leszek Koltunski
  int getNumStickerTypes(int numLayers)
185 ece1b58d Leszek Koltunski
    {
186 31cd7256 Leszek Koltunski
    return STICKERS.length;
187 ece1b58d Leszek Koltunski
    }
188
189
///////////////////////////////////////////////////////////////////////////////////////////////////
190
191 e6734aa9 Leszek Koltunski
  float[][] getCuts(int numLayers)
192 ece1b58d Leszek Koltunski
    {
193 680f921e Leszek Koltunski
    if( numLayers<2 )
194
      {
195
      return null;
196
      }
197
    else
198
      {
199 e6734aa9 Leszek Koltunski
      float[][] cuts = new float[4][numLayers-1];
200 68b5f9c5 Leszek Koltunski
      float dist = SQ6*0.666f*DIST;
201 680f921e Leszek Koltunski
      float cut  = 0.5f*dist*(2-numLayers);
202
203
      for(int i=0; i<numLayers-1; i++)
204
        {
205 e6734aa9 Leszek Koltunski
        cuts[0][i] = cut;
206
        cuts[1][i] = cut;
207
        cuts[2][i] = cut;
208
        cuts[3][i] = cut;
209 680f921e Leszek Koltunski
        cut += dist;
210
        }
211
212
      return cuts;
213
      }
214 ece1b58d Leszek Koltunski
    }
215
216
///////////////////////////////////////////////////////////////////////////////////////////////////
217
218
  int getNumCubitFaces()
219
    {
220
    return FACES_PER_CUBIT;
221
    }
222
223
///////////////////////////////////////////////////////////////////////////////////////////////////
224
225 680f921e Leszek Koltunski
  private int getNumOctahedrons(int layers)
226
    {
227
    return layers==1 ? 1 : 4*(layers-1)*(layers-1) + 2;
228
    }
229
230
///////////////////////////////////////////////////////////////////////////////////////////////////
231
232
  private int getNumTetrahedrons(int layers)
233
    {
234
    return 4*layers*(layers-1);
235
    }
236
237
///////////////////////////////////////////////////////////////////////////////////////////////////
238
239 31cd7256 Leszek Koltunski
  private int createOctaPositions(float[][] centers, int index, int layers, float height)
240 680f921e Leszek Koltunski
    {
241
    float x = DIST*(layers-1);
242
    float z = DIST*(layers+1);
243
244
    for(int i=0; i<layers; i++, index++)
245
      {
246
      z -= 2*DIST;
247
      centers[index][0] = x;
248
      centers[index][1] = height;
249
      centers[index][2] = z;
250
      }
251
252
    for(int i=0; i<layers-1; i++, index++)
253
      {
254
      x -= 2*DIST;
255
      centers[index][0] = x;
256
      centers[index][1] = height;
257
      centers[index][2] = z;
258
      }
259
260
    for(int i=0; i<layers-1; i++, index++)
261
      {
262
      z += 2*DIST;
263
      centers[index][0] = x;
264
      centers[index][1] = height;
265
      centers[index][2] = z;
266
      }
267
268
    for(int i=0; i<layers-2; i++, index++)
269
      {
270
      x += 2*DIST;
271
      centers[index][0] = x;
272
      centers[index][1] = height;
273
      centers[index][2] = z;
274
      }
275
276
    return index;
277
    }
278
279
///////////////////////////////////////////////////////////////////////////////////////////////////
280
281 31cd7256 Leszek Koltunski
  private int createTetraPositions(float[][] centers, int index, int layers, float height)
282 ece1b58d Leszek Koltunski
    {
283 680f921e Leszek Koltunski
    float x = DIST*(layers-1);
284
    float z = DIST*layers;
285
286
    for(int i=0; i<layers-1; i++, index++)
287
      {
288
      z -= 2*DIST;
289
      centers[index][0] = x;
290
      centers[index][1] = height;
291
      centers[index][2] = z;
292
      }
293
294
    x += DIST;
295
    z -= DIST;
296
297
    for(int i=0; i<layers-1; i++, index++)
298
      {
299
      x -= 2*DIST;
300
      centers[index][0] = x;
301
      centers[index][1] = height;
302
      centers[index][2] = z;
303
      }
304
305
    x -= DIST;
306
    z -= DIST;
307
308
    for(int i=0; i<layers-1; i++, index++)
309
      {
310
      z += 2*DIST;
311
      centers[index][0] = x;
312
      centers[index][1] = height;
313
      centers[index][2] = z;
314
      }
315
316
    x -= DIST;
317
    z += DIST;
318
319
    for(int i=0; i<layers-1; i++, index++)
320
      {
321
      x += 2*DIST;
322
      centers[index][0] = x;
323
      centers[index][1] = height;
324
      centers[index][2] = z;
325
      }
326
327
    return index;
328
    }
329
330
///////////////////////////////////////////////////////////////////////////////////////////////////
331
332
  float[][] getCubitPositions(int layers)
333
    {
334
    int numO = getNumOctahedrons(layers);
335
    int numT = getNumTetrahedrons(layers);
336
    int index = 0;
337
    float height = 0.0f;
338
339
    float[][] CENTERS = new float[numO+numT][3];
340
341 31cd7256 Leszek Koltunski
    index = createOctaPositions(CENTERS,index,layers,height);
342 680f921e Leszek Koltunski
343
    for(int i=layers-1; i>0; i--)
344
      {
345
      height += SQ2*DIST;
346 31cd7256 Leszek Koltunski
      index = createOctaPositions(CENTERS,index,i,+height);
347
      index = createOctaPositions(CENTERS,index,i,-height);
348 680f921e Leszek Koltunski
      }
349
350
    height = DIST*SQ2/2;
351
352
    for(int i=layers; i>1; i--)
353
      {
354 31cd7256 Leszek Koltunski
      index = createTetraPositions(CENTERS,index,i,+height);
355
      index = createTetraPositions(CENTERS,index,i,-height);
356 680f921e Leszek Koltunski
      height += SQ2*DIST;
357
      }
358
359 ece1b58d Leszek Koltunski
    return CENTERS;
360
    }
361
362
///////////////////////////////////////////////////////////////////////////////////////////////////
363
364 680f921e Leszek Koltunski
  private int retFaceTetraBelongsTo(int tetra, int numLayers)
365 ece1b58d Leszek Koltunski
    {
366 68b5f9c5 Leszek Koltunski
    for(int i=numLayers-1; i>0; i--)
367 ece1b58d Leszek Koltunski
      {
368 68b5f9c5 Leszek Koltunski
      if( tetra < 8*i ) return mTetraToFaceMap[tetra/i];
369
      tetra -= 8*i;
370 680f921e Leszek Koltunski
      }
371 68b5f9c5 Leszek Koltunski
372
    return -1;
373 680f921e Leszek Koltunski
    }
374
375 f10a88a8 Leszek Koltunski
///////////////////////////////////////////////////////////////////////////////////////////////////
376
377
  ObjectShape getObjectShape(int cubit, int numLayers)
378
    {
379
    int variant = getCubitVariant(cubit,numLayers);
380 f56b53cb Leszek Koltunski
    int N = numLayers>3 ? 5:6;
381 7d11f930 Leszek Koltunski
    int E = numLayers>2 ? (numLayers>3 ? 0:1):2;
382 ece1b58d Leszek Koltunski
383 f10a88a8 Leszek Koltunski
    if( variant==0 )
384 ece1b58d Leszek Koltunski
      {
385 f10a88a8 Leszek Koltunski
      float[][] bands     = new float[][] { {0.05f,35,0.5f,0.8f,N,E,E} };
386
      int[] bandIndices   = new int[] { 0,0,0,0,0,0,0,0 };
387
      float[][] corners   = new float[][] { {0.04f,0.20f} };
388
      int[] cornerIndices = new int[] { 0,0,0,0,0,0 };
389
      float[][] centers   = new float[][] { {0.0f, 0.0f, 0.0f} };
390
      int[] centerIndices = new int[] { 0,0,0,0,0,0 };
391
      return new ObjectShape(VERTICES_OCTA,VERT_INDEXES_OCTA,bands,bandIndices,corners,cornerIndices,centers,centerIndices,getNumCubitFaces(), null);
392 ece1b58d Leszek Koltunski
      }
393
    else
394
      {
395 f10a88a8 Leszek Koltunski
      float[][] bands     = new float[][] { {0.05f,35,0.5f,0.8f,N,E,E} };
396
      int[] bandIndices   = new int[] { 0,0,0,0 };
397
      float[][] corners   = new float[][] { {0.08f,0.15f} };
398
      int[] cornerIndices = new int[] { 0,0,0,0 };
399
      float[][] centers   = new float[][] { {0.0f, 0.0f, 0.0f} };
400
      int[] centerIndices = new int[] { 0,0,0,0 };
401
      return new ObjectShape(VERTICES_TETRA,VERT_INDEXES_TETRA,bands,bandIndices,corners,cornerIndices,centers,centerIndices,getNumCubitFaces(), null);
402
      }
403
    }
404
405
///////////////////////////////////////////////////////////////////////////////////////////////////
406
407 3e605536 Leszek Koltunski
  Static4D getQuat(int cubit, int numLayers)
408 f10a88a8 Leszek Koltunski
    {
409 3e605536 Leszek Koltunski
    int numO = getNumOctahedrons(numLayers);
410 f10a88a8 Leszek Koltunski
411 3e605536 Leszek Koltunski
    if( cubit<numO ) return QUATS[0];
412 f10a88a8 Leszek Koltunski
413 3e605536 Leszek Koltunski
    switch( retFaceTetraBelongsTo(cubit-numO, numLayers) )
414 f10a88a8 Leszek Koltunski
      {
415 3e605536 Leszek Koltunski
      case 0: return QUATS[0];                          // unit quat
416
      case 1: return new Static4D(0,-SQ2/2,0,SQ2/2);    //  90 along Y
417
      case 2: return QUATS[1];                          // 180 along Y
418
      case 3: return new Static4D(0,+SQ2/2,0,SQ2/2);    //  90 along
419
      case 4: return new Static4D(0,     0,1,    0);    // 180 along Z
420
      case 5: return new Static4D(SQ2/2, 0,SQ2/2,0);    //
421
      case 6: return new Static4D(     1,0,0,    0);    // 180 along X
422
      case 7: return new Static4D(-SQ2/2,0,SQ2/2,0);    //
423 ece1b58d Leszek Koltunski
      }
424
425 3e605536 Leszek Koltunski
    return null;
426
    }
427
428
///////////////////////////////////////////////////////////////////////////////////////////////////
429 ece1b58d Leszek Koltunski
430 3e605536 Leszek Koltunski
  int getNumCubitVariants(int numLayers)
431
    {
432
    return 2;
433
    }
434
435
///////////////////////////////////////////////////////////////////////////////////////////////////
436
437
  int getCubitVariant(int cubit, int numLayers)
438
    {
439
    return cubit<getNumOctahedrons(numLayers) ? 0 : 1;
440 ece1b58d Leszek Koltunski
    }
441
442
///////////////////////////////////////////////////////////////////////////////////////////////////
443
444 2ef489e2 Leszek Koltunski
  int getFaceColor(int cubit, int cubitface, int size)
445 ece1b58d Leszek Koltunski
    {
446 2ef489e2 Leszek Koltunski
    int numO = getNumOctahedrons(size);
447 680f921e Leszek Koltunski
448
    if( cubit<numO )
449
      {
450 2ef489e2 Leszek Koltunski
      int axis = 0;
451
      int layer= 1;
452
453
      switch(cubitface)
454
        {
455
        case 0: axis = 2; layer =             1; break;
456
        case 1: axis = 0; layer = (1<<(size-1)); break;
457
        case 2: axis = 3; layer =             1; break;
458
        case 3: axis = 1; layer = (1<<(size-1)); break;
459
        case 4: axis = 3; layer = (1<<(size-1)); break;
460
        case 5: axis = 1; layer =             1; break;
461
        case 6: axis = 2; layer = (1<<(size-1)); break;
462
        case 7: axis = 0; layer =             1; break;
463
        }
464
465 a4962b9c Leszek Koltunski
      return CUBITS[cubit].mRotationRow[axis] == layer ? cubitface : NUM_TEXTURES;
466 680f921e Leszek Koltunski
      }
467
    else
468
      {
469 a4962b9c Leszek Koltunski
      return cubitface>0 ? NUM_TEXTURES : retFaceTetraBelongsTo(cubit-numO, size);
470 680f921e Leszek Koltunski
      }
471 ece1b58d Leszek Koltunski
    }
472
473
///////////////////////////////////////////////////////////////////////////////////////////////////
474
475 9c06394a Leszek Koltunski
  int getColor(int face)
476 ece1b58d Leszek Koltunski
    {
477 9c06394a Leszek Koltunski
    return FACE_COLORS[face];
478
    }
479
480
///////////////////////////////////////////////////////////////////////////////////////////////////
481 76c2bd07 Leszek Koltunski
482 9c06394a Leszek Koltunski
  ObjectSticker retSticker(int face)
483
    {
484
    return mStickers[face/NUM_FACES];
485 ece1b58d Leszek Koltunski
    }
486
487
///////////////////////////////////////////////////////////////////////////////////////////////////
488
489
  float returnMultiplier()
490
    {
491 cc99cf91 Leszek Koltunski
    return 1.5f;
492 ece1b58d Leszek Koltunski
    }
493
494
///////////////////////////////////////////////////////////////////////////////////////////////////
495
// PUBLIC API
496
497
  public Static3D[] getRotationAxis()
498
    {
499
    return ROT_AXIS;
500
    }
501
502
///////////////////////////////////////////////////////////////////////////////////////////////////
503
504 925ed78f Leszek Koltunski
  public int[] getBasicAngle()
505 ece1b58d Leszek Koltunski
    {
506 925ed78f Leszek Koltunski
    return BASIC_ANGLE;
507 ece1b58d Leszek Koltunski
    }
508
509
///////////////////////////////////////////////////////////////////////////////////////////////////
510
511 9f171eba Leszek Koltunski
  public void randomizeNewScramble(int[][] scramble, Random rnd, int curr, int total)
512 ece1b58d Leszek Koltunski
    {
513 9f171eba Leszek Koltunski
    if( curr==0 )
514 ece1b58d Leszek Koltunski
      {
515 9f171eba Leszek Koltunski
      scramble[curr][0] = rnd.nextInt(NUM_AXIS);
516 ece1b58d Leszek Koltunski
      }
517
    else
518
      {
519 582617c1 Leszek Koltunski
      int newVector = rnd.nextInt(NUM_AXIS -1);
520 9f171eba Leszek Koltunski
      scramble[curr][0] = (newVector>=scramble[curr-1][0] ? newVector+1 : newVector);
521 ece1b58d Leszek Koltunski
      }
522
523
    float rowFloat = rnd.nextFloat();
524 0203be88 Leszek Koltunski
    int numLayers = getNumLayers();
525 ece1b58d Leszek Koltunski
526 0203be88 Leszek Koltunski
    for(int row=0; row<numLayers; row++)
527 ece1b58d Leszek Koltunski
      {
528 0203be88 Leszek Koltunski
      if( rowFloat*numLayers <= row+1 )
529 bbc6471c Leszek Koltunski
        {
530 9f171eba Leszek Koltunski
        scramble[curr][1] = row;
531 bbc6471c Leszek Koltunski
        break;
532
        }
533 ece1b58d Leszek Koltunski
      }
534
535 5043d5d0 Leszek Koltunski
    switch( rnd.nextInt(2) )
536
      {
537 9f171eba Leszek Koltunski
      case 0: scramble[curr][2] = -1; break;
538
      case 1: scramble[curr][2] =  1; break;
539 5043d5d0 Leszek Koltunski
      }
540 ece1b58d Leszek Koltunski
    }
541
542 6fd4a72c Leszek Koltunski
///////////////////////////////////////////////////////////////////////////////////////////////////
543
544
  public int getObjectName(int numLayers)
545
    {
546 2ef489e2 Leszek Koltunski
    switch(numLayers)
547
      {
548
      case 2: return R.string.diam2;
549
      case 3: return R.string.diam3;
550 2adf1263 Leszek Koltunski
      case 4: return R.string.diam4;
551 2ef489e2 Leszek Koltunski
      }
552
553
    return 0;
554 6fd4a72c Leszek Koltunski
    }
555
556
///////////////////////////////////////////////////////////////////////////////////////////////////
557
558
  public int getInventor(int numLayers)
559
    {
560 2ef489e2 Leszek Koltunski
    switch(numLayers)
561
      {
562
      case 2: return R.string.diam2_inventor;
563
      case 3: return R.string.diam3_inventor;
564 2adf1263 Leszek Koltunski
      case 4: return R.string.diam4_inventor;
565 2ef489e2 Leszek Koltunski
      }
566
567
    return 0;
568 6fd4a72c Leszek Koltunski
    }
569
570
///////////////////////////////////////////////////////////////////////////////////////////////////
571
572
  public int getComplexity(int numLayers)
573
    {
574 2ef489e2 Leszek Koltunski
    switch(numLayers)
575
      {
576 2adf1263 Leszek Koltunski
      case 2: return 4;
577
      case 3: return 6;
578
      case 4: return 8;
579 2ef489e2 Leszek Koltunski
      }
580
581
    return 0;
582 6fd4a72c Leszek Koltunski
    }
583 ece1b58d Leszek Koltunski
}