Project

General

Profile

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

distorted-objectlib / src / main / java / org / distorted / objectlib / objects / TwistyMegaminx.java @ 7b832206

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.objectlib.objects;
21

    
22
import static org.distorted.objectlib.main.Movement12.COS54;
23
import static org.distorted.objectlib.main.Movement12.SIN54;
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
import org.distorted.library.main.QuatHelper;
33

    
34
import org.distorted.objectlib.R;
35
import org.distorted.objectlib.main.ObjectControl;
36
import org.distorted.objectlib.main.ObjectType;
37
import org.distorted.objectlib.helpers.ObjectShape;
38
import org.distorted.objectlib.helpers.ObjectSticker;
39

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

    
42
public class TwistyMegaminx extends TwistyMinx
43
{
44
  static final float MEGA_D = 0.04f;
45
  private int[] mQuatCenterIndices;
46

    
47
///////////////////////////////////////////////////////////////////////////////////////////////////
48

    
49
  public TwistyMegaminx(int[] numL, Static4D quat, Static3D move, DistortedTexture texture,
50
                        MeshSquare mesh, DistortedEffects effects, Resources res, int surfaceW, int surfaceH)
51
    {
52
    super(numL, quat, move, texture, mesh, effects, res, surfaceW, surfaceH);
53
    }
54

    
55
///////////////////////////////////////////////////////////////////////////////////////////////////
56

    
57
  private void initializeCenterIndices()
58
    {
59
    mQuatCenterIndices = new int[] { 16, 18, 22,  1, 20, 13, 14, 15,  0, 12,  2,  3 };
60
    }
61

    
62
///////////////////////////////////////////////////////////////////////////////////////////////////
63

    
64
  private int numCubitsPerCorner(int numLayers)
65
    {
66
    return 3*((numLayers-1)/2)*((numLayers-3)/2) + 1;
67
    }
68

    
69
///////////////////////////////////////////////////////////////////////////////////////////////////
70

    
71
  private int numCubitsPerEdge(int numLayers)
72
    {
73
    return numLayers-2;
74
    }
75

    
76
///////////////////////////////////////////////////////////////////////////////////////////////////
77

    
78
  protected int getResource(int[] numLayers)
79
    {
80
    switch(numLayers[0])
81
      {
82
      case 3: return R.raw.mega3;
83
      case 5: return R.raw.mega5;
84
      }
85

    
86
    return 0;
87
    }
88

    
89
///////////////////////////////////////////////////////////////////////////////////////////////////
90

    
91
  public int getNumStickerTypes(int[] numLayers)
92
    {
93
    return (numLayers[0]+3)/2;
94
    }
95

    
96
///////////////////////////////////////////////////////////////////////////////////////////////////
97

    
98
  public float[][] getCuts(int[] numLayers)
99
    {
100
    return genericGetCuts(numLayers[0],0.5f-MEGA_D);
101
    }
102

    
103
///////////////////////////////////////////////////////////////////////////////////////////////////
104

    
105
  private float[] computeCenter(int center, int numLayers)
106
    {
107
    if( mCenterCoords==null ) initializeCenterCoords();
108
    float[] coords = mCenterCoords[center];
109
    float A = 0.33f*numLayers;
110

    
111
    return new float[] { A*coords[0], A*coords[1], A*coords[2] };
112
    }
113

    
114
///////////////////////////////////////////////////////////////////////////////////////////////////
115
// Fill out mCurrCorner{X,Y,Z} by applying appropriate Quat to mBasicCorner{X,Y,Z}
116
// Appropriate one: QUATS[QUAT_INDICES[corner]].
117

    
118
  private void computeBasicCornerVectors(int corner)
119
    {
120
    if( mQuatCornerIndices==null ) initializeQuatIndices();
121
    if( mQuats==null ) initializeQuats();
122
    if( mCurrCornerV==null || mBasicCornerV==null ) initializeCornerV();
123

    
124
    Static4D quat = mQuats[mQuatCornerIndices[corner]];
125

    
126
    mCurrCornerV[0] = QuatHelper.rotateVectorByQuat(mBasicCornerV[0],quat);
127
    mCurrCornerV[1] = QuatHelper.rotateVectorByQuat(mBasicCornerV[1],quat);
128
    mCurrCornerV[2] = QuatHelper.rotateVectorByQuat(mBasicCornerV[2],quat);
129
    }
130

    
131
///////////////////////////////////////////////////////////////////////////////////////////////////
132

    
133
  private float[] computeCorner(int numCubitsPerCorner, int numLayers, int corner, int part)
134
    {
135
    if( mCorners==null ) initializeCorners();
136
    if( mCurrCornerV==null || mBasicCornerV==null ) initializeCornerV();
137

    
138
    float D = numLayers/3.0f;
139
    float[] corn = mCorners[corner];
140

    
141
    if( part==0 )
142
      {
143
      return new float[] { corn[0]*D, corn[1]*D, corn[2]*D };
144
      }
145
    else
146
      {
147
      float E = 2.0f*D*(0.5f-MEGA_D)/(0.5f*(numLayers-1));
148
      int N = (numCubitsPerCorner-1)/3;
149
      int block = (part-1) % N;
150
      int index = (part-1) / N;
151
      Static4D pri = mCurrCornerV[index];
152
      Static4D sec = mCurrCornerV[(index+2)%3];
153

    
154
      int layers= (numLayers-3)/2;
155
      int multP = (block % layers) + 1;
156
      int multS = (block / layers);
157

    
158
      return new float[] {
159
                          corn[0]*D + (pri.get0()*multP + sec.get0()*multS)*E,
160
                          corn[1]*D + (pri.get1()*multP + sec.get1()*multS)*E,
161
                          corn[2]*D + (pri.get2()*multP + sec.get2()*multS)*E
162
                         };
163
      }
164
    }
165

    
166
///////////////////////////////////////////////////////////////////////////////////////////////////
167

    
168
  private int computeEdgeType(int cubit, int numCubitsPerCorner, int numCubitsPerEdge)
169
    {
170
    int part = (cubit - NUM_CORNERS*numCubitsPerCorner) % numCubitsPerEdge;
171
    return (part+1)/2;
172
    }
173

    
174
///////////////////////////////////////////////////////////////////////////////////////////////////
175

    
176
  private float[] computeEdge(int numLayers, int edge, int part)
177
    {
178
    if( mCenterCoords==null ) initializeCenterCoords();
179
    if( mCorners==null ) initializeCorners();
180
    if( mEdgeMap==null ) initializeEdgeMap();
181

    
182
    float D = numLayers/3.0f;
183
    float[] c1 = mCorners[ mEdgeMap[edge][0] ];
184
    float[] c2 = mCorners[ mEdgeMap[edge][1] ];
185
    float x = D * (c1[0]+c2[0]) / 2;
186
    float y = D * (c1[1]+c2[1]) / 2;
187
    float z = D * (c1[2]+c2[2]) / 2;
188

    
189
    if( part==0 )
190
      {
191
      return new float[] { x, y, z };
192
      }
193
    else
194
      {
195
      int mult = (part+1)/2;
196
      int dir  = (part+1)%2;
197
      float[] center = mCenterCoords[ mEdgeMap[edge][dir+2] ];
198

    
199
      float vX = D*center[0] - x;
200
      float vY = D*center[1] - y;
201
      float vZ = D*center[2] - z;
202

    
203
      float A = 3*mult*D*(0.5f-MEGA_D)*COS18/((numLayers-1)*0.5f);
204
      A /= (float)Math.sqrt(vX*vX+vY*vY+vZ*vZ);
205

    
206
      return new float[] { x+A*vX, y+A*vY, z+A*vZ };
207
      }
208
    }
209

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

    
212
  public float[][] getCubitPositions(int[] numLayers)
213
    {
214
    int numL = numLayers[0];
215
    int numCubitsPerCorner = numCubitsPerCorner(numL);
216
    int numCubitsPerEdge   = numCubitsPerEdge(numL);
217
    int numCubits = NUM_CORNERS*numCubitsPerCorner + NUM_EDGES*numCubitsPerEdge + NUM_CENTERS;
218
    int index=0;
219

    
220
    final float[][] CENTERS = new float[numCubits][];
221

    
222
    for(int corner=0; corner<NUM_CORNERS; corner++)
223
      {
224
      computeBasicCornerVectors(corner);
225

    
226
      for(int part=0; part<numCubitsPerCorner; part++, index++)
227
        {
228
        CENTERS[index] = computeCorner(numCubitsPerCorner,numL,corner,part);
229
        }
230
      }
231

    
232
    for(int edge=0; edge<NUM_EDGES; edge++)
233
      {
234
      for(int part=0; part<numCubitsPerEdge; part++, index++)
235
        {
236
        CENTERS[index] = computeEdge(numL, edge, part );
237
        }
238
      }
239

    
240
    for(int center=0; center<NUM_CENTERS; center++, index++)
241
      {
242
      CENTERS[index] = computeCenter(center, numL);
243
      }
244

    
245
    return CENTERS;
246
    }
247

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

    
250
  private int getQuat(int cubit, int numCubitsPerCorner, int numCubitsPerEdge)
251
    {
252
    if( mQuatCornerIndices==null || mQuatEdgeIndices==null ) initializeQuatIndices();
253
    if( mQuatCenterIndices==null ) initializeCenterIndices();
254

    
255
    if( cubit < NUM_CORNERS*numCubitsPerCorner )
256
      {
257
      int corner = cubit/numCubitsPerCorner;
258
      return mQuatCornerIndices[corner];
259
      }
260

    
261
    if( cubit < NUM_CORNERS*numCubitsPerCorner + NUM_EDGES*numCubitsPerEdge )
262
      {
263
      int edge = (cubit-NUM_CORNERS*numCubitsPerCorner)/numCubitsPerEdge;
264
      return mQuatEdgeIndices[edge];
265
      }
266

    
267
    int center = cubit - NUM_CORNERS*numCubitsPerCorner - NUM_EDGES*numCubitsPerEdge;
268
    return mQuatCenterIndices[center];
269
    }
270

    
271
///////////////////////////////////////////////////////////////////////////////////////////////////
272

    
273
  public ObjectShape getObjectShape(int variant)
274
    {
275
    int[] numLayers = getNumLayers();
276
    int numVariants = getNumCubitVariants(numLayers);
277
    int numL        = numLayers[0];
278

    
279
    if( variant==0 )
280
      {
281
      float width = numL*(0.5f-MEGA_D)/(0.5f*(numL-1));
282
      float A = (2*SQ3/3)*SIN54;
283
      float B = 0.4f;
284
      double X = width*COS18*SIN_HALFD;
285
      double Y = width*SIN18;
286
      double Z = width*COS18*COS_HALFD;
287
      int N = numL==3 ? 1:0;
288

    
289
      double[][] vertices = new double[][]
290
        {
291
            { 0.0, 0.0      , 0.0 },
292
            {   X,   Y      ,  -Z },
293
            { 0.0, 2*Y      ,-2*Z },
294
            {  -X,   Y      ,  -Z },
295
            { 0.0, 0.0-width, 0.0 },
296
            {   X,   Y-width,  -Z },
297
            { 0.0, 2*Y-width,-2*Z },
298
            {  -X,   Y-width,  -Z },
299
        };
300

    
301
      int[][] vertIndexes = new int[][]
302
        {
303
            {4,5,1,0},
304
            {7,4,0,3},
305
            {0,1,2,3},
306
            {4,5,6,7},
307
            {6,5,1,2},
308
            {7,6,2,3}
309
        };
310

    
311
      float[][] bands    = new float[][]
312
        {
313
         {0.04f,34,0.3f,0.2f, 3, N, 0},
314
         {0.00f, 0,0.0f,0.0f, 2, N, 0}
315
        };
316

    
317
      int[] bandIndices   = new int[] { 0,0,0,1,1,1};
318
      float[][] corners   = new float[][] { {0.04f,0.10f} };
319
      int[] cornerIndices = new int[] { 0,-1,-1,-1,-1,-1,-1,-1 };
320
      float[][] centers   = new float[][] { {0.0f, -(float)Math.sqrt(1-A*A)*B,-A*B} };
321
      int[] centerIndices = new int[] { 0,-1,-1,-1,-1,-1,-1,-1 };
322

    
323
      return new ObjectShape(vertices,vertIndexes,bands,bandIndices,corners,cornerIndices,centers,centerIndices,getNumCubitFaces(), null);
324
      }
325
    if( variant<numVariants-1 )
326
      {
327
      int type = variant-1;
328
      float height= numL*(0.5f-MEGA_D)*COS18/((numL-1)*0.5f);
329
      float width = numL*2*MEGA_D + 2*type*height*SIN18/COS18;
330

    
331
      double W = width/2;
332
      double X = height*SIN_HALFD;
333
      double Y = height*SIN18/COS18;
334
      double Z = height*COS_HALFD;
335

    
336
      double[][] vertices = new double[][]
337
        {
338
            { 0.0,   W   , 0.0 },
339
            {   X, W+Y   ,  -Z },
340
            { 0.0, W+2*Y ,-2*Z },
341
            {  -X, W+Y   ,  -Z },
342
            { 0.0,  -W   , 0.0 },
343
            {   X,-W-Y   ,  -Z },
344
            { 0.0,-W-2*Y ,-2*Z },
345
            {  -X,-W-Y   ,  -Z },
346
        };
347

    
348
      int[][] vertIndexes = new int[][]
349
        {
350
            {4,5,1,0},
351
            {7,4,0,3},
352
            {7,6,2,3},
353
            {6,5,1,2},
354
            {0,1,2,3},
355
            {4,5,6,7}
356
        };
357

    
358
      int N = numL<=5 ? 5 : 3;
359

    
360
      float[][] bands = new float[][]
361
        {
362
         {0.04f,34,0.2f,0.2f,N,0,0},
363
         {0.00f, 0,0.3f,0.2f,2,0,0}
364
        };
365
      int[] bandIndices   = new int[] { 0,0,1,1,1,1};
366
      float[][] corners   = new float[][] { {0.04f,0.10f} };
367
      int[] cornerIndices = new int[] { -1,-1,-1,-1, -1,-1,-1,-1 };
368
      float[][] centers   = new float[][] { {0.0f, 0.0f, (float)(-2*Z)} };
369
      int[] centerIndices = new int[] { -1,-1,-1,-1, -1,-1,-1,-1 };
370

    
371
      return new ObjectShape(vertices,vertIndexes,bands,bandIndices,corners,cornerIndices,centers,centerIndices,getNumCubitFaces(), null);
372
      }
373
    else
374
      {
375
      float width = 2*numL*(MEGA_D+(0.5f-MEGA_D)*SIN18);
376
      final double V = 0.83;   // ??
377
      final double ANGLE = V*Math.PI;
378
      final double cosA  = Math.cos(ANGLE);
379
      final double sinA  = Math.sin(ANGLE);
380

    
381
      float R  = 0.5f*width/COS54;
382
      float X1 = R*COS54;
383
      float Y1 = R*SIN54;
384
      float X2 = R*COS18;
385
      float Y2 = R*SIN18;
386

    
387
      double[][] vertices = new double[][]
388
        {
389
          {-X1,+Y1*sinA, Y1*cosA},
390
          {-X2,-Y2*sinA,-Y2*cosA},
391
          {0.0f,-R*sinA, -R*cosA},
392
          {+X2,-Y2*sinA,-Y2*cosA},
393
          {+X1,+Y1*sinA, Y1*cosA}
394
        };
395

    
396
      int[][] vertIndexes = new int[][]
397
        {
398
          {0,1,2,3,4},
399
          {0,1,2,3,4}
400
        };
401

    
402
      int N = numL==3 ? 4 : 3;
403

    
404
      float[][] bands = new float[][]
405
        {
406
         {0.04f,45, R/3,0.2f,N,0,0},
407
         {0.00f, 0, R/3,0.2f,2,0,0}
408
        };
409

    
410
      int[] bandIndices   = new int[] { 0,1 };
411
      float[][] corners   = new float[][] { {0.04f,0.10f} };
412
      int[] cornerIndices = new int[] { -1,-1,-1,-1, -1 };
413
      float[][] centers   = new float[][] { {0.0f, 0.0f, 0.0f} };
414
      int[] centerIndices = new int[] { -1,-1,-1,-1, -1 };
415

    
416
      return new ObjectShape(vertices,vertIndexes,bands,bandIndices,corners,cornerIndices,centers,centerIndices,getNumCubitFaces(), null);
417
      }
418
    }
419

    
420
///////////////////////////////////////////////////////////////////////////////////////////////////
421

    
422
  public Static4D getQuat(int cubit, int[] numLayers)
423
    {
424
    if( mQuats==null ) initializeQuats();
425

    
426
    int numL = numLayers[0];
427
    int numCubitsPerCorner = numCubitsPerCorner(numL);
428
    int numCubitsPerEdge   = numCubitsPerEdge(numL);
429

    
430
    return mQuats[getQuat(cubit,numCubitsPerCorner,numCubitsPerEdge)];
431
    }
432

    
433
///////////////////////////////////////////////////////////////////////////////////////////////////
434

    
435
  public int getNumCubitVariants(int[] numLayers)
436
    {
437
    switch(numLayers[0])
438
      {
439
      case 3: return 3;
440
      case 5: return 4;
441
      }
442

    
443
    return 3;
444
    }
445

    
446
///////////////////////////////////////////////////////////////////////////////////////////////////
447

    
448
  public int getCubitVariant(int cubit, int[] numLayers)
449
    {
450
    int numL = numLayers[0];
451
    int numCubitsPerCorner = numCubitsPerCorner(numL);
452

    
453
    if( cubit<NUM_CORNERS*numCubitsPerCorner ) return 0;
454

    
455
    int numCubitsPerEdge = numCubitsPerEdge(numL);
456

    
457
    if( cubit<NUM_CORNERS*numCubitsPerCorner + NUM_EDGES*numCubitsPerEdge )
458
      {
459
      int type = computeEdgeType(cubit,numCubitsPerCorner,numCubitsPerEdge);
460
      return type+1;
461
      }
462

    
463
    return getNumCubitVariants(numLayers)-1;
464
    }
465

    
466
///////////////////////////////////////////////////////////////////////////////////////////////////
467

    
468
  int getCornerColor(int cubit, int cubitface, int numLayers, int numCubitsPerCorner)
469
    {
470
    if( mCornerFaceMap==null ) initializeCornerFaceMap();
471
    if( cubitface<0 || cubitface>2 ) return NUM_TEXTURES;
472

    
473
    int part  = cubit % numCubitsPerCorner;
474
    int corner= cubit / numCubitsPerCorner;
475

    
476
    if( part==0 )
477
      {
478
      return mCornerFaceMap[corner][cubitface];
479
      }
480
    else
481
      {
482
      int N = (numCubitsPerCorner-1)/3;
483
      int block = (part-1) % N;
484
      int index = (part-1) / N;
485

    
486
      if( block< (numLayers-3)/2 )
487
        {
488
        switch(index)
489
          {
490
          case 0: return cubitface==1 ? NUM_TEXTURES : mCornerFaceMap[corner][cubitface];
491
          case 1: return cubitface==0 ? NUM_TEXTURES : mCornerFaceMap[corner][cubitface];
492
          case 2: return cubitface==2 ? NUM_TEXTURES : mCornerFaceMap[corner][cubitface];
493
          }
494
        }
495
      else
496
        {
497
        switch(index)
498
          {
499
          case 0: return cubitface==0 ? mCornerFaceMap[corner][cubitface] : NUM_TEXTURES;
500
          case 1: return cubitface==2 ? mCornerFaceMap[corner][cubitface] : NUM_TEXTURES;
501
          case 2: return cubitface==1 ? mCornerFaceMap[corner][cubitface] : NUM_TEXTURES;
502
          }
503
        }
504
      }
505

    
506
    return NUM_TEXTURES;
507
    }
508

    
509
///////////////////////////////////////////////////////////////////////////////////////////////////
510

    
511
  int getEdgeColor(int edge, int cubitface, int numCubitsPerEdge)
512
    {
513
    if( cubitface<0 || cubitface>1 ) return NUM_TEXTURES;
514

    
515
    int part    = edge % numCubitsPerEdge;
516
    int variant = edge / numCubitsPerEdge;
517
    if( mEdgeMap==null ) initializeEdgeMap();
518

    
519
    return (part==0 || cubitface==((part+1)%2)) ? mEdgeMap[variant][cubitface+2] + ((part+3)/2)*NUM_FACE_COLORS : NUM_TEXTURES;
520
    }
521

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

    
524
  int getCenterColor(int center, int cubitface, int numLayers)
525
    {
526
    return cubitface>0 ? NUM_TEXTURES : center + NUM_FACE_COLORS*(numLayers+1)/2;
527
    }
528

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

    
531
  protected int getFaceColor(int cubit, int cubitface, int[] numLayers)
532
    {
533
    int numL = numLayers[0];
534
    int numCubitsPerCorner = numCubitsPerCorner(numL);
535
    int numCubitsPerEdge   = numCubitsPerEdge(numL);
536

    
537
    if( cubit < NUM_CORNERS*numCubitsPerCorner )
538
      {
539
      return getCornerColor(cubit,cubitface,numL,numCubitsPerCorner);
540
      }
541
    else if( cubit<NUM_CORNERS*numCubitsPerCorner + NUM_EDGES*numCubitsPerEdge )
542
      {
543
      int edge = cubit - NUM_CORNERS*numCubitsPerCorner;
544
      return getEdgeColor(edge,cubitface,numCubitsPerEdge);
545
      }
546
    else
547
      {
548
      int center = cubit-NUM_CORNERS*numCubitsPerCorner-NUM_EDGES*numCubitsPerEdge;
549
      return getCenterColor( center, cubitface, numL);
550
      }
551
    }
552

    
553
///////////////////////////////////////////////////////////////////////////////////////////////////
554

    
555
  public ObjectSticker retSticker(int sticker)
556
    {
557
    if( mStickers==null )
558
      {
559
      float[][] STICKERS = new float[][]
560
        {
561
          { -0.36327127f, -0.5f, 0.36327127f, -0.26393202f, 0.36327127f, 0.5f, -0.36327127f, 0.26393202f },
562
          { -0.5f, -0.0914315f, 0.5f, -0.4163512f, 0.5f, 0.4163512f, -0.5f, 0.0914315f },
563
          { -0.49233657f, -0.18006028f, 0.49233657f, -0.5f, 0.49233657f, 0.5f, -0.49233657f, 0.18006028f },
564
          { -0.3002273f, -0.30490047f, 0.3002273f, -0.5f, 0.3002273f, 0.5f, -0.3002273f, 0.30490047f },
565
          { -0.29389262f, 0.4045085f, -0.47552824f, -0.1545085f, 0.0f, -0.5f, 0.47552824f, -0.1545085f, 0.29389262f, 0.4045085f }
566
        };
567

    
568
      mStickers = new ObjectSticker[STICKERS.length];
569

    
570
      final float R0 = 0.08f;
571
      final float R1 = 0.12f;
572
      final float R2 = 0.12f;
573
      final float R3 = 0.08f;
574
      final float R4 = 0.10f;
575
      final float[][] radii = { {R0,R0,R0,R0},{R1,R1,R1,R1},{R2,R2,R2,R2},{R3,R3,R3,R3},{R4,R4,R4,R4,R4} };
576
      float[] strokes = { 0.10f,0.12f,0.12f,0.08f,0.07f };
577

    
578
      if( ObjectControl.isInIconMode() )
579
        {
580
        int[] numLayers = getNumLayers();
581
        float mult = numLayers[0]==3 ? 1.5f : 2.2f;
582

    
583
        strokes[0]*=mult;
584
        strokes[1]*=mult;
585
        strokes[2]*=mult;
586
        strokes[3]*=mult;
587
        strokes[4]*=mult;
588
        }
589

    
590
      for(int s=0; s<STICKERS.length; s++)
591
        {
592
        mStickers[s] = new ObjectSticker(STICKERS[s],null,radii[s],strokes[s]);
593
        }
594
      }
595

    
596
    return mStickers[sticker];
597
    }
598

    
599
///////////////////////////////////////////////////////////////////////////////////////////////////
600

    
601
  protected int getStickerIndex(int face)
602
    {
603
    int variant = face/NUM_FACE_COLORS;
604

    
605
    if( variant==0 ) return 0;
606

    
607
    int[] numLayers = getNumLayers();
608
    int numL = numLayers[0];
609

    
610
    if( variant < (numL+1)/2 )
611
      {
612
      return numL==3 ? 1 : ( variant==1 ? 2 : 3 );
613
      }
614

    
615
    return 4;
616
    }
617

    
618
///////////////////////////////////////////////////////////////////////////////////////////////////
619

    
620
  public ObjectType intGetObjectType(int[] numLayers)
621
    {
622
    switch(numLayers[0])
623
      {
624
      case 3: return ObjectType.MEGA_3;
625
      case 5: return ObjectType.MEGA_5;
626
      }
627

    
628
    return ObjectType.MEGA_3;
629
    }
630

    
631
///////////////////////////////////////////////////////////////////////////////////////////////////
632

    
633
  public int getObjectName(int[] numLayers)
634
    {
635
    int numL = numLayers[0];
636

    
637
    if( numL==3 ) return R.string.minx3;
638
    if( numL==5 ) return R.string.minx5;
639

    
640
    return 0;
641
    }
642

    
643
///////////////////////////////////////////////////////////////////////////////////////////////////
644

    
645
  public int getInventor(int[] numLayers)
646
    {
647
    int numL = numLayers[0];
648

    
649
    if( numL==3 ) return R.string.minx3_inventor;
650
    if( numL==5 ) return R.string.minx5_inventor;
651

    
652
    return 0;
653
    }
654

    
655
///////////////////////////////////////////////////////////////////////////////////////////////////
656

    
657
  public int getYearOfInvention(int[] numLayers)
658
    {
659
    switch(numLayers[0])
660
      {
661
      case 3: return 1982;
662
      case 5: return 2006;
663
      }
664
    return 1982;
665
    }
666

    
667
///////////////////////////////////////////////////////////////////////////////////////////////////
668

    
669
  public int getComplexity(int[] numLayers)
670
    {
671
    int numL = numLayers[0];
672

    
673
    if( numL==3 ) return 7;
674
    if( numL==5 ) return 9;
675

    
676
    return 9;
677
    }
678
}
(15-15/25)