Project

General

Profile

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

distorted-objectlib / src / main / java / org / distorted / objectlib / objects / TwistyCrazy3x3.java @ cf93ea4e

1
///////////////////////////////////////////////////////////////////////////////////////////////////
2
// Copyright 2022 Leszek Koltunski                                                               //
3
//                                                                                               //
4
// This file is part of Magic Cube.                                                              //
5
//                                                                                               //
6
// Magic Cube is proprietary software licensed under an EULA which you should have received      //
7
// along with the code. If not, check https://distorted.org/magic/License-Magic-Cube.html        //
8
///////////////////////////////////////////////////////////////////////////////////////////////////
9

    
10
package org.distorted.objectlib.objects;
11

    
12
import java.util.ArrayList;
13

    
14
import org.distorted.library.type.Static3D;
15
import org.distorted.library.type.Static4D;
16
import org.distorted.objectlib.helpers.FactoryCubit;
17
import org.distorted.objectlib.helpers.ObjectFaceShape;
18
import org.distorted.objectlib.helpers.ObjectShape;
19
import org.distorted.objectlib.helpers.ObjectSignature;
20
import org.distorted.objectlib.helpers.ObjectStickerOverride;
21
import org.distorted.objectlib.helpers.ObjectVertexEffects;
22
import org.distorted.objectlib.main.InitAssets;
23
import org.distorted.objectlib.main.ObjectSignatures;
24
import org.distorted.objectlib.scrambling.ScrambleEdgeGenerator;
25
import org.distorted.objectlib.main.TwistyObjectCubit;
26
import org.distorted.objectlib.main.InitData;
27
import org.distorted.objectlib.main.ObjectType;
28
import org.distorted.objectlib.shape.ShapeHexahedron;
29
import org.distorted.objectlib.touchcontrol.TouchControlHexahedron;
30

    
31
import static org.distorted.objectlib.touchcontrol.TouchControl.TC_HEXAHEDRON;
32
import static org.distorted.objectlib.touchcontrol.TouchControl.TYPE_NOT_SPLIT;
33

    
34
///////////////////////////////////////////////////////////////////////////////////////////////////
35

    
36
public class TwistyCrazy3x3 extends ShapeHexahedron
37
{
38
  public static final int CRAZY   = 0x3f;
39
  public static final int MERCURY = 0x2f;
40
  public static final int VENUS   = 0x0f;
41
  public static final int EARTH   = 0x2b;
42
  public static final int MARS    = 0x0b;
43
  public static final int JUPITER = 0x10;
44
  public static final int SATURN  = 0x30;
45
  public static final int URANUS  = 0x14;
46
  public static final int NEPTUNE = 0x16;
47

    
48
  private static final float DIAMETER_RATIO = 0.75f;
49
  private static final float DIFF = 0.6f;
50
  private static final int NUMBER_CORNER_SEGMENTS = 4;
51
  private static final int NUMBER_EDGE_SEGMENTS = 4;
52

    
53
  static final Static3D[] ROT_AXIS = new Static3D[]
54
         {
55
           new Static3D(1,0,0),
56
           new Static3D(0,1,0),
57
           new Static3D(0,0,1)
58
         };
59

    
60
  private int[][] mEdges;
61
  private int[][] mBasicAngle;
62
  private float[][] mCuts;
63
  private float[][] mPositions;
64
  private int[] mQuatIndex;
65
  private float[][] mOffsets;
66

    
67
///////////////////////////////////////////////////////////////////////////////////////////////////
68

    
69
  public TwistyCrazy3x3(int meshState, int iconMode, Static4D quat, Static3D move, float scale, InitData data, InitAssets asset)
70
    {
71
    super(meshState, iconMode, data.getNumLayers()[0], quat, move, scale, data, asset);
72
    }
73

    
74
///////////////////////////////////////////////////////////////////////////////////////////////////
75

    
76
  @Override
77
  public void adjustStickerCoords()
78
    {
79
    final float A = 0.3645522f;
80
    final float B = 0.0744520f;
81
    final float C = 0.1823852f;
82
    final float D = 0.3098326f;
83
    final float E = 0.1033291f;
84
    final float F = 0.4044531f;
85
    final float G = 0.4103489f;
86

    
87
    mStickerCoords = new float[][]
88
      {
89
         { A, 0.5f, -0.5f, 0.5f, -0.5f, -A, -B, -A, A, B },
90
         { 0.5f, -C, 0.5f, D, -0.5f, D, -0.5f, -C },
91
         { -0.5f, -0.5f, 0.5f, -0.5f, 0.5f, 0.5f, -0.5f, 0.5f },
92
         { -0.5f, E, -0.5f, -F, 0.5f, -F, 0.5f, E },
93
         { -G, 0.5f, -G, -G, 0.5f, -G }
94
      };
95
    }
96

    
97
///////////////////////////////////////////////////////////////////////////////////////////////////
98

    
99
  private boolean cubitIsOverriden(int cubit)
100
    {
101
    float[] offset = getCubitRowOffset(cubit);
102
    return offset[0]*offset[0]+offset[1]*offset[1]+offset[2]*offset[2] == 0;
103
    }
104

    
105
///////////////////////////////////////////////////////////////////////////////////////////////////
106

    
107
  @Override
108
  public ObjectStickerOverride[] getStickerOverrides()
109
    {
110
    ArrayList<Integer> cubits = new ArrayList<>();
111

    
112
    for(int i=0; i<6; i++)
113
      if( cubitIsOverriden(20+i) ) cubits.add(20+i);
114

    
115
    int numOverrides = cubits.size();
116

    
117
    if( numOverrides>0 )
118
      {
119
      ObjectStickerOverride[] overrides = new ObjectStickerOverride[1];
120
      int[] cubfac = new int[2*numOverrides];
121
      for(int i=0; i<numOverrides; i++)
122
        {
123
        cubfac[2*i  ] = cubits.get(i);
124
        cubfac[2*i+1] = 6;
125
        }
126
      overrides[0] = new ObjectStickerOverride(cubfac,0x00ffffff);
127
      return overrides;
128
      }
129

    
130
    return null;
131
    }
132

    
133
///////////////////////////////////////////////////////////////////////////////////////////////////
134

    
135
  @Override
136
  public int getCubitRotationType(int cubit)
137
    {
138
    int[] numLayers = getNumLayers();
139
    int variant = getCubitVariant(cubit,numLayers);
140

    
141
    switch(variant)
142
      {
143
      case  2: return TwistyObjectCubit.TYPE_DECIDER;
144
      case  3:
145
      case  4: return TwistyObjectCubit.TYPE_FOLLOWER;
146
      default: return TwistyObjectCubit.TYPE_NORMAL;
147
      }
148
    }
149

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

    
152
  @Override
153
  public float[] getCubitRowOffset(int cubitIndex)
154
    {
155
    if( mOffsets==null )
156
      {
157
      float[] tmp = new float[] {0,0,0};
158
      int numCubits = mPositions.length;
159
      mOffsets = new float[numCubits][];
160

    
161
      int param = getInitData().getParam();
162

    
163
      int R = (param>>5)&0x1;
164
      int L = (param>>4)&0x1;
165
      int U = (param>>3)&0x1;
166
      int D = (param>>2)&0x1;
167
      int F = (param>>1)&0x1;
168
      int B = (param   )&0x1;
169

    
170
      for(int i=0; i<numCubits; i++)
171
        {
172
        switch(i)
173
          {
174
          case 20: mOffsets[i] = new float[] {0,0,-DIFF*F}; break;
175
          case 21: mOffsets[i] = new float[] {0,0, DIFF*B}; break;
176
          case 22: mOffsets[i] = new float[] {0,-DIFF*U,0}; break;
177
          case 23: mOffsets[i] = new float[] {0, DIFF*D,0}; break;
178
          case 24: mOffsets[i] = new float[] {-DIFF*R,0,0}; break;
179
          case 25: mOffsets[i] = new float[] { DIFF*L,0,0}; break;
180
          default: mOffsets[i] = tmp;
181
          }
182
        }
183
      }
184

    
185
    return mOffsets[cubitIndex];
186
    }
187

    
188
///////////////////////////////////////////////////////////////////////////////////////////////////
189

    
190
  public int[][] getScrambleEdges()
191
    {
192
    if( mEdges==null ) mEdges = ScrambleEdgeGenerator.getScrambleEdgesCuboid(3,3,3);
193
    return mEdges;
194
    }
195

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

    
198
  public float[][] getCuts(int[] numLayers)
199
    {
200
    if( mCuts==null )
201
      {
202
      float C = 0.5f;
203
      float[] cut = new float[] {-C,+C};
204
      mCuts = new float[][] { cut,cut,cut };
205
      }
206

    
207
    return mCuts;
208
    }
209

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

    
212
  public boolean[][] getLayerRotatable(int[] numLayers)
213
    {
214
    boolean[] tmp = new boolean[] {true,true,true};
215
    return new boolean[][] { tmp,tmp,tmp };
216
    }
217

    
218
///////////////////////////////////////////////////////////////////////////////////////////////////
219

    
220
  public int getTouchControlType()
221
    {
222
    return TC_HEXAHEDRON;
223
    }
224

    
225
///////////////////////////////////////////////////////////////////////////////////////////////////
226

    
227
  public int getTouchControlSplit()
228
    {
229
    return TYPE_NOT_SPLIT;
230
    }
231

    
232
///////////////////////////////////////////////////////////////////////////////////////////////////
233

    
234
  public int[][][] getEnabled()
235
    {
236
    return new int[][][] { {{1,2}},{{1,2}},{{0,2}},{{0,2}},{{0,1}},{{0,1}} };
237
    }
238

    
239
///////////////////////////////////////////////////////////////////////////////////////////////////
240

    
241
  public float[] getDist3D(int[] numLayers)
242
    {
243
    return TouchControlHexahedron.D3D;
244
    }
245

    
246
///////////////////////////////////////////////////////////////////////////////////////////////////
247

    
248
  public Static3D[] getFaceAxis()
249
    {
250
    return TouchControlHexahedron.FACE_AXIS;
251
    }
252

    
253
///////////////////////////////////////////////////////////////////////////////////////////////////
254

    
255
  public float[][] getCubitPositions(int[] numLayers)
256
    {
257
    if( mPositions==null )
258
      {
259
      mPositions = new float[][]
260
         {
261
             { 1.0f, 1.0f, 1.0f},
262
             { 1.0f, 1.0f,-1.0f},
263
             { 1.0f,-1.0f, 1.0f},
264
             { 1.0f,-1.0f,-1.0f},
265
             {-1.0f, 1.0f, 1.0f},
266
             {-1.0f, 1.0f,-1.0f},
267
             {-1.0f,-1.0f, 1.0f},
268
             {-1.0f,-1.0f,-1.0f},
269

    
270
             { 1.0f, 1.0f, 0.0f},
271
             { 1.0f,-1.0f, 0.0f},
272
             { 1.0f, 0.0f, 1.0f},
273
             { 1.0f, 0.0f,-1.0f},
274
             {-1.0f, 1.0f, 0.0f},
275
             {-1.0f,-1.0f, 0.0f},
276
             {-1.0f, 0.0f, 1.0f},
277
             {-1.0f, 0.0f,-1.0f},
278
             { 0.0f, 1.0f, 1.0f},
279
             { 0.0f, 1.0f,-1.0f},
280
             { 0.0f,-1.0f, 1.0f},
281
             { 0.0f,-1.0f,-1.0f},
282

    
283
             { 0.0f, 0.0f, DIFF},
284
             { 0.0f, 0.0f,-DIFF},
285
             { 0.0f, DIFF, 0.0f},
286
             { 0.0f,-DIFF, 0.0f},
287
             { DIFF, 0.0f, 0.0f},
288
             {-DIFF, 0.0f, 0.0f},
289

    
290
             { 0.0f, 1.0f, DIFF},
291
             {-DIFF, 1.0f, 0.0f},
292
             { 0.0f, 1.0f,-DIFF},
293
             { DIFF, 1.0f, 0.0f},
294
             { 0.0f,-1.0f, DIFF},
295
             {-DIFF,-1.0f, 0.0f},
296
             { 0.0f,-1.0f,-DIFF},
297
             { DIFF,-1.0f, 0.0f},
298
             { DIFF, 0.0f, 1.0f},
299
             { 0.0f,-DIFF, 1.0f},
300
             {-DIFF, 0.0f, 1.0f},
301
             { 0.0f, DIFF, 1.0f},
302
             { DIFF, 0.0f,-1.0f},
303
             { 0.0f,-DIFF,-1.0f},
304
             {-DIFF, 0.0f,-1.0f},
305
             { 0.0f, DIFF,-1.0f},
306
             { 1.0f, DIFF, 0.0f},
307
             { 1.0f, 0.0f,-DIFF},
308
             { 1.0f,-DIFF, 0.0f},
309
             { 1.0f, 0.0f, DIFF},
310
             {-1.0f, DIFF, 0.0f},
311
             {-1.0f, 0.0f,-DIFF},
312
             {-1.0f,-DIFF, 0.0f},
313
             {-1.0f, 0.0f, DIFF},
314

    
315
             { 1.0f, 1.0f, DIFF},
316
             { 1.0f, 1.0f,-DIFF},
317
             { 1.0f,-1.0f, DIFF},
318
             { 1.0f,-1.0f,-DIFF},
319
             {-1.0f, 1.0f, DIFF},
320
             {-1.0f, 1.0f,-DIFF},
321
             {-1.0f,-1.0f, DIFF},
322
             {-1.0f,-1.0f,-DIFF},
323
             { 1.0f, DIFF, 1.0f},
324
             { 1.0f,-DIFF, 1.0f},
325
             { 1.0f, DIFF,-1.0f},
326
             { 1.0f,-DIFF,-1.0f},
327
             {-1.0f, DIFF, 1.0f},
328
             {-1.0f,-DIFF, 1.0f},
329
             {-1.0f, DIFF,-1.0f},
330
             {-1.0f,-DIFF,-1.0f},
331
             { DIFF, 1.0f, 1.0f},
332
             {-DIFF, 1.0f, 1.0f},
333
             { DIFF, 1.0f,-1.0f},
334
             {-DIFF, 1.0f,-1.0f},
335
             { DIFF,-1.0f, 1.0f},
336
             {-DIFF,-1.0f, 1.0f},
337
             { DIFF,-1.0f,-1.0f},
338
             {-DIFF,-1.0f,-1.0f},
339
         };
340
      }
341

    
342
    return mPositions;
343
    }
344

    
345
///////////////////////////////////////////////////////////////////////////////////////////////////
346

    
347
  public Static4D getCubitQuats(int cubit, int[] numLayers)
348
    {
349
    if( mQuatIndex==null ) mQuatIndex = new int[] { 0,1,17,22,4,5,8,19,
350
                                                    6,17,7,12,4,16,9,10,0,5,3,2,
351
                                                    0,2,1,3,6,4,
352
                                                    0,4,5,6, 8,16,2,17, 21,3,20,14, 12,11,10,1, 13,18,22,7, 15,19,23,9,
353
                                                    0,18,7,2, 9,5,8,19, 13,3,1,22, 14,23,15,11, 21,4,6,10, 17,20,12,16 };
354
    return mObjectQuats[mQuatIndex[cubit]];
355
    }
356

    
357
///////////////////////////////////////////////////////////////////////////////////////////////////
358

    
359
  private float[][] getVertices(int variant)
360
    {
361
    if( variant==0 )
362
      {
363
      final float INIT_ALPHA = (float)Math.asin(1/(3*DIAMETER_RATIO));
364
      final float STEP_CORNER= (float)((Math.PI/2-2*INIT_ALPHA)/NUMBER_CORNER_SEGMENTS);
365
      final int SINGLE_ARC = NUMBER_CORNER_SEGMENTS+1;
366
      final int SINGLE_INNER_ARC = (NUMBER_CORNER_SEGMENTS+1)/2;
367
      final int NUM_VERTICES = 4 + 3*SINGLE_ARC + 1 + 3*SINGLE_INNER_ARC;
368
      float[][] vertices = new float[NUM_VERTICES][];
369

    
370
      vertices[0] = new float[] { +0.5f, +0.5f, +0.5f };
371
      vertices[1] = new float[] { -0.5f, +0.5f, +0.5f };
372
      vertices[2] = new float[] { +0.5f, -0.5f, +0.5f };
373
      vertices[3] = new float[] { +0.5f, +0.5f, -0.5f };
374

    
375
      float[][] tmp = new float[SINGLE_ARC][2];
376

    
377
      for(int i=0; i<SINGLE_ARC; i++)
378
        {
379
        float alpha = INIT_ALPHA + i*STEP_CORNER;
380
        tmp[i][0] = (float)(1.5f*DIAMETER_RATIO*Math.sin(alpha) - 1.0f);
381
        tmp[i][1] = (float)(1.5f*DIAMETER_RATIO*Math.cos(alpha) - 1.0f);
382
        }
383

    
384
      for(int i=0; i<SINGLE_ARC; i++)
385
        {
386
        float s = tmp[i][0];
387
        float c = tmp[i][1];
388

    
389
        vertices[4             +i] = new float[] {0.5f,+s,+c};
390
        vertices[4+  SINGLE_ARC+i] = new float[] {+c,0.5f,+s};
391
        vertices[4+2*SINGLE_ARC+i] = new float[] {+s,+c,0.5f};
392
        }
393

    
394
      final float EXTRA = (NUMBER_CORNER_SEGMENTS%2)==0 ? 1.0f : (float)Math.cos((Math.PI/2-2*INIT_ALPHA)/(2*NUMBER_CORNER_SEGMENTS));
395
      final float LEN = 1.5f*DIAMETER_RATIO*EXTRA;
396
      final float M = (float)(LEN*Math.sin(Math.PI/4) - 1.0f);
397
      vertices[4+3*SINGLE_ARC] = new float[] {M,M,M};
398

    
399
      for(int i=0; i<SINGLE_INNER_ARC; i++)
400
        {
401
        float s = tmp[i][0];
402
        float c = tmp[i][1];
403

    
404
        vertices[4+3*SINGLE_ARC+1                   +i] = new float[] {s,c,c};
405
        vertices[4+3*SINGLE_ARC+1+  SINGLE_INNER_ARC+i] = new float[] {c,s,c};
406
        vertices[4+3*SINGLE_ARC+1+2*SINGLE_INNER_ARC+i] = new float[] {c,c,s};
407
        }
408
      return vertices;
409
      }
410
    else if( variant==1 )
411
      {
412
      final int NUM_VERTICES = 8 + 3*(NUMBER_EDGE_SEGMENTS-1);
413
      final float INIT_ALPHA = (float)Math.asin(1/(3*DIAMETER_RATIO));
414
      final float H = 0.5f*((float)Math.sqrt(9*DIAMETER_RATIO*DIAMETER_RATIO-1))-1.0f;
415

    
416
      float[][] vertices = new float[NUM_VERTICES][];
417

    
418
      vertices[0] = new float[] {-0.5f,+0.5f,+0.5f};
419
      vertices[1] = new float[] {+0.5f,+0.5f,+0.5f};
420
      vertices[2] = new float[] {-0.5f,    H,+0.5f};
421
      vertices[3] = new float[] {+0.5f,    H,+0.5f};
422
      vertices[4] = new float[] {-0.5f,+0.5f,    H};
423
      vertices[5] = new float[] {+0.5f,+0.5f,    H};
424
      vertices[6] = new float[] {-0.5f,    H,    H};
425
      vertices[7] = new float[] {+0.5f,    H,    H};
426

    
427
      final int NUM_VERTS = NUMBER_EDGE_SEGMENTS-1;
428
      for(int i=0; i<NUM_VERTS; i++)
429
        {
430
        float beta = INIT_ALPHA*((2.0f*(i+1))/NUMBER_EDGE_SEGMENTS -1 );
431
        float A = (float)(1.5f*DIAMETER_RATIO*Math.sin(beta));
432
        float B = (float)(1.5f*DIAMETER_RATIO*Math.cos(beta)-1.0f);
433
        vertices[8            +i] = new float[] {A,B,0.5f};
434
        vertices[8+  NUM_VERTS+i] = new float[] {A,0.5f,B};
435
        vertices[8+2*NUM_VERTS+i] = new float[] {A,B,B};
436
        }
437
      return vertices;
438
      }
439
    else if( variant==2 )
440
      {
441
      final float D = 1.0f-DIFF;
442
      final float A = 0.1f;
443
      final float B = 0.2f;
444
      final float C = 0.55f+D;
445

    
446
      return new float[][]
447
        {
448
            {-0.5f,-0.5f,-0.5f+D},
449
            {-0.5f,-0.5f, 0.5f+D},
450
            {-0.5f,+0.5f,-0.5f+D},
451
            {-0.5f,+0.5f, 0.5f+D},
452
            {+0.5f,-0.5f,-0.5f+D},
453
            {+0.5f,-0.5f, 0.5f+D},
454
            {+0.5f,+0.5f,-0.5f+D},
455
            {+0.5f,+0.5f, 0.5f+D},
456

    
457
            {   0,-A  , C},
458
            {   B,-A-B, C},
459
            { A+B,  -B, C},
460
            { A  ,   0, C},
461
            { A+B,   B, C},
462
            {   B, A+B, C},
463
            {   0, A  , C},
464
            {  -B, A+B, C},
465
            {-A-B,   B, C},
466
            {-A  ,   0, C},
467
            {-A-B,  -B, C},
468
            {  -B,-A-B, C},
469
        };
470
      }
471
    else if( variant==3 )
472
      {
473
      final float D = 1.0f-DIFF;
474
      final float INIT_ALPHA = (float)Math.asin(1/(3*DIAMETER_RATIO));
475
      final float H = 0.5f*((float)Math.sqrt(9*DIAMETER_RATIO*DIAMETER_RATIO-1))-1.0f;
476
      final int NUM_VERTICES = 8 + 2*(NUMBER_EDGE_SEGMENTS-1);
477
      final int NUM_VERTS = NUMBER_EDGE_SEGMENTS-1;
478
      float[][] vertices = new float[NUM_VERTICES][];
479

    
480
      vertices[0] = new float[] {-0.5f,-0.5f, 0.5f+D};
481
      vertices[1] = new float[] {-0.5f,-0.5f,-0.5f+D};
482
      vertices[2] = new float[] {+0.5f,-0.5f, 0.5f+D};
483
      vertices[3] = new float[] {+0.5f,-0.5f,-0.5f+D};
484
      vertices[4] = new float[] {-0.5f,    H, 0.5f+D};
485
      vertices[5] = new float[] {-0.5f,    H,-0.5f+D};
486
      vertices[6] = new float[] {+0.5f,    H, 0.5f+D};
487
      vertices[7] = new float[] {+0.5f,    H,-0.5f+D};
488

    
489
      for(int i=0; i<NUM_VERTS; i++)
490
        {
491
        float beta = INIT_ALPHA*((2.0f*(i+1))/NUMBER_EDGE_SEGMENTS -1 );
492
        float A = (float)(1.5f*DIAMETER_RATIO*Math.sin(beta));
493
        float B = (float)(1.5f*DIAMETER_RATIO*Math.cos(beta)-1.0f);
494
        vertices[8          +i] = new float[] {A,B, 0.5f+D};
495
        vertices[8+NUM_VERTS+i] = new float[] {A,B,-0.5f+D};
496
        }
497
      return vertices;
498
      }
499
    else
500
      {
501
      final float D = 1.02f-DIFF;
502
      final float H = 0.5f*((float)Math.sqrt(9*DIAMETER_RATIO*DIAMETER_RATIO-1))-1.0f;
503
      final float INIT_ALPHA = (float)Math.asin(1/(3*DIAMETER_RATIO));
504
      final float STEP_CORNER= (float)((Math.PI/2-2*INIT_ALPHA)/NUMBER_CORNER_SEGMENTS);
505
      final int NUM_VERTICES = 6 + 2*(NUMBER_CORNER_SEGMENTS-1);
506

    
507
      float[][] vertices = new float[NUM_VERTICES][];
508

    
509
      vertices[0] = new float[] {-0.5f,    H, 0.5f+D};
510
      vertices[1] = new float[] {    H,-0.5f, 0.5f+D};
511
      vertices[2] = new float[] {-0.5f,-0.5f, 0.5f+D};
512
      vertices[3] = new float[] {-0.5f,    H,-0.5f+D};
513
      vertices[4] = new float[] {    H,-0.5f,-0.5f+D};
514
      vertices[5] = new float[] {-0.5f,-0.5f,-0.5f+D};
515

    
516
      for(int i=0; i<NUMBER_CORNER_SEGMENTS-1; i++)
517
        {
518
        float alpha = INIT_ALPHA + (i+1)*STEP_CORNER;
519
        float A = (float)(1.5f*DIAMETER_RATIO*Math.sin(alpha) - 1.0f);
520
        float B = (float)(1.5f*DIAMETER_RATIO*Math.cos(alpha) - 1.0f);
521

    
522
        vertices[6                       +i] = new float[] {A,B, 0.5f+D};
523
        vertices[5+NUMBER_CORNER_SEGMENTS+i] = new float[] {A,B,-0.5f+D};
524
        }
525

    
526
      return vertices;
527
      }
528
    }
529

    
530
///////////////////////////////////////////////////////////////////////////////////////////////////
531

    
532
  private ObjectShape getCornerShape()
533
    {
534
    final int SINGLE_ARC = NUMBER_CORNER_SEGMENTS+1;
535
    final int SINGLE_INNER_ARC = (NUMBER_CORNER_SEGMENTS+1)/2;
536
    final int NUM_FACES = 6 + 3*NUMBER_CORNER_SEGMENTS;
537
    final int NUM_VERTS = 4 +   NUMBER_CORNER_SEGMENTS;
538

    
539
    int[][] indices = new int[NUM_FACES][];
540

    
541
    indices[0] = new int[NUM_VERTS];
542
    indices[1] = new int[NUM_VERTS];
543
    indices[2] = new int[NUM_VERTS];
544

    
545
    indices[0][0] = 3;
546
    indices[0][1] = 0;
547
    indices[0][2] = 2;
548
    indices[1][0] = 1;
549
    indices[1][1] = 0;
550
    indices[1][2] = 3;
551
    indices[2][0] = 2;
552
    indices[2][1] = 0;
553
    indices[2][2] = 1;
554

    
555
    for(int i=0; i<SINGLE_ARC; i++)
556
      {
557
      indices[0][3+i] = 4+i;
558
      indices[1][3+i] = 4+i+  SINGLE_ARC;
559
      indices[2][3+i] = 4+i+2*SINGLE_ARC;
560
      }
561

    
562
    indices[3] = new int[] { 1, 4+2*SINGLE_ARC-1, 4+3*SINGLE_ARC+1                   , 4+2*SINGLE_ARC};
563
    indices[4] = new int[] { 2, 4+3*SINGLE_ARC-1, 4+3*SINGLE_ARC+1+  SINGLE_INNER_ARC, 4             };
564
    indices[5] = new int[] { 3, 4+  SINGLE_ARC-1, 4+3*SINGLE_ARC+1+2*SINGLE_INNER_ARC, 4+  SINGLE_ARC};
565

    
566
    int start,i0,i1,i2,i3;
567
    int MID = (NUMBER_CORNER_SEGMENTS)/2;
568
    int MID2= (NUMBER_CORNER_SEGMENTS+1)/2;
569

    
570
    if( (NUMBER_CORNER_SEGMENTS%2) == 0 )
571
      {
572
      start = 12;
573
      indices[ 6] = new int[] { 4+3*SINGLE_ARC, 4+SINGLE_ARC+MID, 4+SINGLE_ARC+MID-1, 4+3*SINGLE_ARC+1+2*SINGLE_INNER_ARC+MID-1};
574
      indices[ 7] = new int[] { 4+3*SINGLE_ARC, 4+3*SINGLE_ARC+1+MID-1,  4+SINGLE_ARC+MID+1, 4+SINGLE_ARC+MID};
575
      indices[ 8] = new int[] { 4+3*SINGLE_ARC, 4+3*SINGLE_ARC+1+2*SINGLE_INNER_ARC+MID-1, 4+MID+1, 4+MID };
576
      indices[ 9] = new int[] { 4+3*SINGLE_ARC, 4+MID, 4+MID-1, 4+3*SINGLE_ARC+1+SINGLE_INNER_ARC+MID-1 };
577
      indices[10] = new int[] { 4+3*SINGLE_ARC, 4+2*SINGLE_ARC+MID, 4+2*SINGLE_ARC+MID-1, 4+3*SINGLE_ARC+1+MID-1 };
578
      indices[11] = new int[] { 4+3*SINGLE_ARC, 4+3*SINGLE_ARC+1+SINGLE_INNER_ARC+MID-1, 4+2*SINGLE_ARC+MID+1, 4+2*SINGLE_ARC+MID };
579
      }
580
    else
581
      {
582
      start = 9;
583
      indices[ 6] = new int[] { 4+3*SINGLE_ARC, 4+3*SINGLE_ARC+1+MID, 4+SINGLE_ARC+MID+1, 4+SINGLE_ARC+MID, 4+3*SINGLE_ARC+1+2*SINGLE_INNER_ARC+MID};
584
      indices[ 7] = new int[] { 4+3*SINGLE_ARC, 4+3*SINGLE_ARC+1+2*SINGLE_INNER_ARC+MID,  4+MID+1, 4+MID, 4+3*SINGLE_ARC+1+SINGLE_INNER_ARC+MID};
585
      indices[ 8] = new int[] { 4+3*SINGLE_ARC, 4+3*SINGLE_ARC+1+SINGLE_INNER_ARC+MID, 4+2*SINGLE_ARC+MID+1, 4+2*SINGLE_ARC+MID, 4+3*SINGLE_ARC+1+MID};
586
      }
587

    
588
    for(int j=0; j<MID2-1; j++)
589
      {
590
      i0 = 4+3*SINGLE_ARC+1+2*SINGLE_INNER_ARC+j;
591
      i1 = 4+3*SINGLE_ARC+1+2*SINGLE_INNER_ARC+j+1;
592
      i2 = 4+SINGLE_ARC+j+1;
593
      i3 = 4+SINGLE_ARC+j;
594

    
595
      indices[start+j] = new int[] {i0,i1,i2,i3};
596

    
597
      i0 = 4+3*SINGLE_ARC+1+2*SINGLE_INNER_ARC+j+1;
598
      i1 = 4+3*SINGLE_ARC+1+2*SINGLE_INNER_ARC+j;
599
      i2 = 4+(SINGLE_ARC-1)-j;
600
      i3 = 4+(SINGLE_ARC-1)-(j+1);
601

    
602
      indices[start+j+(MID2-1)] = new int[] {i0,i1,i2,i3};
603

    
604
      i0 = 4+3*SINGLE_ARC+1+j;
605
      i1 = 4+3*SINGLE_ARC+1+j+1;
606
      i2 = 4+2*SINGLE_ARC+j+1;
607
      i3 = 4+2*SINGLE_ARC+j;
608

    
609
      indices[start+j+2*(MID2-1)] = new int[] {i0,i1,i2,i3};
610

    
611
      i0 = 4+3*SINGLE_ARC+1+j+1;
612
      i1 = 4+3*SINGLE_ARC+1+j;
613
      i2 = 4+(2*SINGLE_ARC-1)-j;
614
      i3 = 4+(2*SINGLE_ARC-1)-(j+1);
615

    
616
      indices[start+j+3*(MID2-1)] = new int[] {i0,i1,i2,i3};
617

    
618
      i0 = 4+3*SINGLE_ARC+1+SINGLE_INNER_ARC+j;
619
      i1 = 4+3*SINGLE_ARC+1+SINGLE_INNER_ARC+j+1;
620
      i2 = 4+j+1;
621
      i3 = 4+j;
622

    
623
      indices[start+j+4*(MID2-1)] = new int[] {i0,i1,i2,i3};
624

    
625
      i0 = 4+3*SINGLE_ARC+1+SINGLE_INNER_ARC+j+1;
626
      i1 = 4+3*SINGLE_ARC+1+SINGLE_INNER_ARC+j;
627
      i2 = 4+(3*SINGLE_ARC-1)-j;
628
      i3 = 4+(3*SINGLE_ARC-1)-(j+1);
629

    
630
      indices[start+j+5*(MID2-1)] = new int[] {i0,i1,i2,i3};
631
      }
632

    
633
    float[][] vertices = getVertices(0);
634
    return new ObjectShape(vertices,indices);
635
    }
636

    
637
///////////////////////////////////////////////////////////////////////////////////////////////////
638

    
639
  private ObjectShape getEdgeShape()
640
    {
641
    final int NUM_VERTS = NUMBER_EDGE_SEGMENTS-1;
642
    final int NUM_FACES = 4 + 2*NUMBER_EDGE_SEGMENTS;
643
    int[][] indices = new int[NUM_FACES][];
644

    
645
    int NUMV = 3+NUMBER_EDGE_SEGMENTS;
646

    
647
    indices[0] = new int[NUMV];
648
    indices[0][0] = 3;
649
    indices[0][1] = 1;
650
    indices[0][2] = 0;
651
    indices[0][3] = 2;
652
    for(int i=0; i<NUM_VERTS; i++) indices[0][4+i] = 8+i;
653

    
654
    indices[1] = new int[NUMV];
655
    indices[1][0] = 4;
656
    indices[1][1] = 0;
657
    indices[1][2] = 1;
658
    indices[1][3] = 5;
659
    for(int i=0; i<NUM_VERTS; i++) indices[1][4+i] = 7+2*NUM_VERTS-i;
660

    
661
    indices[2] = new int[] {5,1,3,7};
662
    indices[3] = new int[] {0,4,6,2};
663
    indices[4] = new int[] {8,2,6,8+2*NUM_VERTS};
664
    indices[5] = new int[] {3,7+NUM_VERTS,7+3*NUM_VERTS,7};
665
    indices[6] = new int[] {6,4,8+NUM_VERTS,8+2*NUM_VERTS};
666
    indices[7] = new int[] {5,7,7+3*NUM_VERTS,7+2*NUM_VERTS};
667

    
668
    int i0,i1,i2,i3;
669

    
670
    for(int i=0; i<NUMBER_EDGE_SEGMENTS-2; i++)
671
      {
672
      i0 = 9+i;
673
      i1 = 8+i;
674
      i2 = 8+2*NUM_VERTS+i;
675
      i3 = 9+2*NUM_VERTS+i;
676

    
677
      indices[8+i] = new int[] {i0,i1,i2,i3};
678

    
679
      i0 = 9+2*NUM_VERTS+i;
680
      i1 = 8+2*NUM_VERTS+i;
681
      i2 = 8+NUM_VERTS+i;
682
      i3 = 9+NUM_VERTS+i;
683

    
684
      indices[8+NUMBER_EDGE_SEGMENTS-2+i] = new int[] {i0,i1,i2,i3};
685
      }
686

    
687
    float[][] vertices = getVertices(1);
688
    return new ObjectShape(vertices,indices);
689
    }
690

    
691
///////////////////////////////////////////////////////////////////////////////////////////////////
692

    
693
  private ObjectShape getCenterShape()
694
    {
695
    int[][] indices = new int[][]
696
        {
697
            {1,5,7,3},
698
            {5,4,6,7},
699
            {0,1,3,2},
700
            {3,7,6,2},
701
            {0,4,5,1},
702
            {4,0,2,6},
703

    
704
            {8,9,10,11,12,13,14,15,16,17,18,19}
705
        };
706

    
707
    float[][] vertices = getVertices(2);
708
    return new ObjectShape(vertices,indices);
709
    }
710

    
711
///////////////////////////////////////////////////////////////////////////////////////////////////
712

    
713
  private ObjectShape getBigCircleShape()
714
    {
715
    final int NUM_VERTS = NUMBER_EDGE_SEGMENTS-1;
716
    final int NUM_FACES = NUMBER_EDGE_SEGMENTS+5;
717
    int[][] indices = new int[NUM_FACES][];
718

    
719
    int NUMV = 4+NUM_VERTS;
720
    indices[0] = new int[NUMV];
721
    indices[0][0] = 4;
722
    indices[0][1] = 0;
723
    indices[0][2] = 2;
724
    indices[0][3] = 6;
725
    for(int i=0; i<NUM_VERTS; i++) indices[0][4+i] = 7+NUM_VERTS-i;
726

    
727
    indices[1] = new int[NUMV];
728
    indices[1][0] = 7;
729
    indices[1][1] = 3;
730
    indices[1][2] = 1;
731
    indices[1][3] = 5;
732
    for(int i=0; i<NUM_VERTS; i++) indices[1][4+i] = 8+NUM_VERTS+i;
733

    
734
    indices[2] = new int[] {7,3,2,6};
735
    indices[3] = new int[] {4,0,1,5};
736
    indices[4] = new int[] {1,3,2,0};
737

    
738
    indices[5] = new int[] {5,4,8,8+NUM_VERTS};
739
    indices[6] = new int[] {7+NUM_VERTS,6,7,7+2*NUM_VERTS};
740

    
741
    for(int i=0; i<NUMBER_EDGE_SEGMENTS-2; i++)
742
      {
743
      int i0 = 8+i;
744
      int i1 = 9+i;
745
      int i2 = 9+NUM_VERTS+i;
746
      int i3 = 8+NUM_VERTS+i;
747

    
748
      indices[7+i] = new int[] {i0,i1,i2,i3};
749
      }
750

    
751
    float[][] vertices = getVertices(3);
752
    return new ObjectShape(vertices,indices);
753
    }
754

    
755
///////////////////////////////////////////////////////////////////////////////////////////////////
756

    
757
  private ObjectShape getSmallCircleShape()
758
    {
759
    final int NUM_FACES = 4 + NUMBER_CORNER_SEGMENTS;
760
    int[][] indices = new int[NUM_FACES][];
761

    
762
    int NUMV = 2+NUMBER_CORNER_SEGMENTS;
763
    indices[0] = new int[NUMV];
764
    indices[0][0] = 0;
765
    indices[0][1] = 2;
766
    indices[0][2] = 1;
767
    for(int i=3; i<NUMV; i++) indices[0][i] = 5+(NUMBER_CORNER_SEGMENTS-1)-(i-3);
768

    
769
    indices[1] = new int[NUMV];
770
    indices[1][0] = 4;
771
    indices[1][1] = 5;
772
    indices[1][2] = 3;
773
    for(int i=3; i<NUMV; i++) indices[1][i] = 5+NUMBER_CORNER_SEGMENTS+(i-3);
774

    
775
    indices[2] = new int[] {0,3,5,2};
776
    indices[3] = new int[] {1,2,5,4};
777

    
778
    indices[4] = new int[] {5+NUMBER_CORNER_SEGMENTS,3,0,6};
779
    indices[5] = new int[] {1,4,5+2*(NUMBER_CORNER_SEGMENTS-1),5+(NUMBER_CORNER_SEGMENTS-1)};
780

    
781
    for(int i=0; i<NUMBER_CORNER_SEGMENTS-2; i++)
782
      {
783
      int i0 = 6+i;
784
      int i1 = 7+i;
785
      int i2 = 6+NUMBER_CORNER_SEGMENTS+i;
786
      int i3 = 5+NUMBER_CORNER_SEGMENTS+i;
787

    
788
      indices[6+i] = new int[] {i0,i1,i2,i3};
789
      }
790

    
791
    float[][] vertices = getVertices(4);
792
    return new ObjectShape(vertices,indices);
793
    }
794

    
795
///////////////////////////////////////////////////////////////////////////////////////////////////
796

    
797
  public ObjectShape getObjectShape(int variant)
798
    {
799
    switch(variant)
800
      {
801
      case 0: return getCornerShape();
802
      case 1: return getEdgeShape();
803
      case 2: return getCenterShape();
804
      case 3: return getBigCircleShape();
805
      case 4: return getSmallCircleShape();
806
      }
807

    
808
    return null;
809
    }
810

    
811
///////////////////////////////////////////////////////////////////////////////////////////////////
812

    
813
  public ObjectFaceShape getObjectFaceShape(int variant)
814
    {
815
    if( variant==0 )
816
      {
817
      float h1 = isInIconMode() ? 0.001f : 0.04f;
818
      float h2 = 0.001f;
819
      float[][] bands   = { {h1,45,0.3f,0.7f,5,0,0}, {h2,5,0.3f,0.2f,5,0,0}, {h2,5,0.3f,0.2f,2,0,0} };
820
      final int NUM_BANDS = 6+3*NUMBER_CORNER_SEGMENTS;
821
      int[] indices = new int[NUM_BANDS];
822
      indices[0] = indices[1] = indices[2] = 0;
823
      indices[3] = indices[4] = indices[5] = 1;
824
      for(int i=6; i<NUM_BANDS; i++) indices[i] = 2;
825
      return new ObjectFaceShape(bands,indices,null);
826
      }
827
    if( variant==1 )
828
      {
829
      float h1 = isInIconMode() ? 0.001f : 0.03f;
830
      float[][] bands   = { {h1,45,0.2f,0.4f,5,0,0}, {0.001f,1,0.3f,0.5f,3,0,0}, {0.001f,1,0.3f,0.5f,2,0,0} };
831
      final int NUM_BANDS = 4 + 2*NUMBER_EDGE_SEGMENTS;
832
      int[] indices = new int[NUM_BANDS];
833
      indices[0] = indices[1] = 0;
834
      indices[2] = indices[3] = 1;
835
      for(int i=4; i<NUM_BANDS; i++) indices[i] = 2;
836
      return new ObjectFaceShape(bands,indices,null);
837
      }
838
    if( variant==2 )
839
      {
840
      float h1 = isInIconMode() ? 0.001f : 0.05f;
841
      float[][] bands   = { {h1,45,0.2f,0.4f,5,0,0}, {0.001f,1,0.3f,0.5f,2,0,0} };
842
      int[] indices = new int[] {0,1,1,1,1,1,1};
843
      return new ObjectFaceShape(bands,indices,null);
844
      }
845
    if( variant==3 )
846
      {
847
      float h1 = isInIconMode() ? 0.001f : 0.03f;
848
      float[][] bands   = { {h1,45,0.2f,0.4f,5,0,0}, {0.001f,1,0.3f,0.5f,3,0,0}, {0.001f,1,0.3f,0.5f,2,0,0} };
849
      final int NUM_BANDS = 5 + NUMBER_EDGE_SEGMENTS;
850
      int[] indices = new int[NUM_BANDS];
851
      indices[0] = 0;
852
      indices[1] = 2;
853
      indices[2] = indices[3] = indices[4] = 1;
854
      for(int i=5; i<NUM_BANDS; i++) indices[i] = 2;
855
      return new ObjectFaceShape(bands,indices,null);
856
      }
857
    else
858
      {
859
      float h1 = isInIconMode() ? 0.001f : 0.02f;
860
      float[][] bands   = { {h1,45,0.2f,0.4f,5,0,0}, {0.001f,1,0.3f,0.5f,3,0,0}, {0.001f,1,0.3f,0.5f,2,0,0} };
861
      final int NUM_BANDS = 4 + NUMBER_CORNER_SEGMENTS;
862
      int[] indices = new int[NUM_BANDS];
863
      indices[0] = 0;
864
      indices[1] = 2;
865
      indices[2] = indices[3] = 1;
866
      for(int i=4; i<NUM_BANDS; i++) indices[i] = 2;
867
      return new ObjectFaceShape(bands,indices,null);
868
      }
869
    }
870

    
871
///////////////////////////////////////////////////////////////////////////////////////////////////
872

    
873
  public ObjectVertexEffects getVertexEffects(int variant)
874
    {
875
    if( variant==0 )
876
      {
877
      float[][] corners = { {0.02f,0.09f} };
878
      float[][] centers = { { 0.0f, 0.0f, 0.0f } };
879
      final int SINGLE_ARC = NUMBER_CORNER_SEGMENTS+1;
880
      final int SINGLE_INNER_ARC = (NUMBER_CORNER_SEGMENTS+1)/2;
881
      final int NUM_VERTICES = 4 + 3*SINGLE_ARC + 1 + 3*SINGLE_INNER_ARC;
882
      int[] indices = new int[NUM_VERTICES];
883
      indices[0] = indices[1] = indices[2] = indices[3] = 0;
884
      for(int i=4; i<NUM_VERTICES; i++) indices[i] = -1;
885
      return FactoryCubit.generateVertexEffect(getVertices(variant),corners,indices,centers,indices);
886
      }
887
    if( variant==1 )
888
      {
889
      float[][] corners = { {0.02f,0.09f} };
890
      float[][] centers = { { 0.0f, 0.0f, 0.0f } };
891
      final int NUM_VERTICES = 8 + 3*(NUMBER_EDGE_SEGMENTS-1);
892
      int[] indices = new int[NUM_VERTICES];
893
      indices[0] = indices[1] = indices[2] = indices[3] = indices[4] = indices[5] = 0;
894
      for(int i=6; i<NUM_VERTICES; i++) indices[i] = -1;
895
      return FactoryCubit.generateVertexEffect(getVertices(variant),corners,indices,centers,indices);
896
      }
897
    if( variant==2 )
898
      {
899
      float[][] corners = { {0.02f,0.09f} };
900
      float[][] centers = { { 0.0f, 0.0f, 1.0f } };
901
      int[] indices = new int[] {0,0,0,0,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1};
902
      return FactoryCubit.generateVertexEffect(getVertices(variant),corners,indices,centers,indices);
903
      }
904
    if( variant==3 )
905
      {
906
      float[][] corners = { {0.02f,0.09f} };
907
      float[][] centers = { { 0.0f, 0.0f, 1.0f } };
908
      final int NUM_VERTICES = 8 + 2*(NUMBER_EDGE_SEGMENTS-1);
909
      int[] indices = new int[NUM_VERTICES];
910
      for(int i=0; i<NUM_VERTICES; i++) indices[i] = -1;
911
      indices[0] = indices[2] = indices[4] = indices[6] = 0;
912
      return FactoryCubit.generateVertexEffect(getVertices(variant),corners,indices,centers,indices);
913
      }
914
    else
915
      {
916
      float[][] corners = { {0.02f,0.09f} };
917
      float[][] centers = { { 0.0f, 0.0f, 1.0f } };
918
      final int NUM_VERTICES = 6 + 2*(NUMBER_CORNER_SEGMENTS-1);
919
      int[] indices = new int[NUM_VERTICES];
920
      for(int i=0; i<NUM_VERTICES; i++) indices[i] = -1;
921
      indices[0] = indices[1] = indices[2] = 0;
922
      return FactoryCubit.generateVertexEffect(getVertices(variant),corners,indices,centers,indices);
923
      }
924
    }
925

    
926
///////////////////////////////////////////////////////////////////////////////////////////////////
927

    
928
  public int getNumCubitVariants(int[] numLayers)
929
    {
930
    return 5;
931
    }
932

    
933
///////////////////////////////////////////////////////////////////////////////////////////////////
934

    
935
  public int getCubitVariant(int cubit, int[] numLayers)
936
    {
937
    if( cubit< 8 ) return 0;
938
    if( cubit<20 ) return 1;
939
    if( cubit<26 ) return 2;
940
    if( cubit<50 ) return 3;
941

    
942
    return 4;
943
    }
944

    
945
///////////////////////////////////////////////////////////////////////////////////////////////////
946

    
947
  public float getStickerRadius()
948
    {
949
    return 0.07f;
950
    }
951

    
952
///////////////////////////////////////////////////////////////////////////////////////////////////
953

    
954
  public float getStickerStroke()
955
    {
956
    return isInIconMode() ? 0.22f : 0.12f;
957
    }
958

    
959
///////////////////////////////////////////////////////////////////////////////////////////////////
960

    
961
  public float[][] getStickerAngles()
962
    {
963
    float D1 = (float)(Math.PI/8);
964
    float D2 = (float)(Math.PI/6);
965
    return new float[][] { { 0,0,0,-D1,0 },{ 0,0,0,-D2 },{0,0,0,0},{ 0,0,0,D2 },{ 0,0,D1 } };
966
    }
967

    
968
///////////////////////////////////////////////////////////////////////////////////////////////////
969
// PUBLIC API
970

    
971
  public Static3D[] getRotationAxis()
972
    {
973
    return ROT_AXIS;
974
    }
975

    
976
///////////////////////////////////////////////////////////////////////////////////////////////////
977

    
978
  public int[][] getBasicAngles()
979
    {
980
    if( mBasicAngle==null )
981
      {
982
      int[] tmp = new int[] {4,4,4};
983
      mBasicAngle = new int[][] { tmp,tmp,tmp };
984
      }
985

    
986
    return mBasicAngle;
987
    }
988

    
989
///////////////////////////////////////////////////////////////////////////////////////////////////
990

    
991
  public String getShortName()
992
    {
993
    int param = getInitData().getParam();
994

    
995
    switch(param)
996
      {
997
      case CRAZY  : return ObjectType.CRA1_3.name();
998
      case MERCURY: return ObjectType.CRA2_3.name();
999
      case VENUS  : return ObjectType.CRA3_3.name();
1000
      case EARTH  : return ObjectType.CRA4_3.name();
1001
      case MARS   : return ObjectType.CRA5_3.name();
1002
      case JUPITER: return ObjectType.CRA6_3.name();
1003
      case SATURN : return ObjectType.CRA7_3.name();
1004
      case URANUS : return ObjectType.CRA8_3.name();
1005
      case NEPTUNE: return ObjectType.CRA9_3.name();
1006
      }
1007

    
1008
    return null;
1009
    }
1010

    
1011
///////////////////////////////////////////////////////////////////////////////////////////////////
1012

    
1013
  public ObjectSignature getSignature()
1014
    {
1015
    int param = getInitData().getParam();
1016

    
1017
    switch(param)
1018
      {
1019
      case CRAZY  : return new ObjectSignature(ObjectSignatures.CRA1_3);
1020
      case MERCURY: return new ObjectSignature(ObjectSignatures.CRA2_3);
1021
      case VENUS  : return new ObjectSignature(ObjectSignatures.CRA3_3);
1022
      case EARTH  : return new ObjectSignature(ObjectSignatures.CRA4_3);
1023
      case MARS   : return new ObjectSignature(ObjectSignatures.CRA5_3);
1024
      case JUPITER: return new ObjectSignature(ObjectSignatures.CRA6_3);
1025
      case SATURN : return new ObjectSignature(ObjectSignatures.CRA7_3);
1026
      case URANUS : return new ObjectSignature(ObjectSignatures.CRA8_3);
1027
      case NEPTUNE: return new ObjectSignature(ObjectSignatures.CRA9_3);
1028
      }
1029

    
1030
    return null;
1031
    }
1032

    
1033
///////////////////////////////////////////////////////////////////////////////////////////////////
1034

    
1035
  public String getObjectName()
1036
    {
1037
    int param = getInitData().getParam();
1038

    
1039
    switch(param)
1040
      {
1041
      case CRAZY  : return "Circle 3x3";
1042
      case MERCURY: return "Crazy Plus Mercury";
1043
      case VENUS  : return "Crazy Plus Venus";
1044
      case EARTH  : return "Crazy Plus Earth";
1045
      case MARS   : return "Crazy Plus Mars";
1046
      case JUPITER: return "Crazy Plus Jupiter";
1047
      case SATURN : return "Crazy Plus Saturn";
1048
      case URANUS : return "Crazy Plus Uranus";
1049
      case NEPTUNE: return "Crazy Plus Neptune";
1050
      }
1051

    
1052
    return null;
1053
    }
1054

    
1055
///////////////////////////////////////////////////////////////////////////////////////////////////
1056

    
1057
  public String getInventor()
1058
    {
1059

    
1060
    return getInitData().getParam()==CRAZY ? "Aleh Hladzilin" : "Daqing Bao";
1061
    }
1062

    
1063
///////////////////////////////////////////////////////////////////////////////////////////////////
1064

    
1065
  public int getYearOfInvention()
1066
    {
1067
    return getInitData().getParam()==CRAZY ? 2008 : 2010;
1068
    }
1069

    
1070
///////////////////////////////////////////////////////////////////////////////////////////////////
1071

    
1072
  public int getComplexity()
1073
    {
1074
    int param = getInitData().getParam();
1075

    
1076
    switch(param)
1077
      {
1078
      case CRAZY  : return 2;
1079
      case MERCURY: return 4;
1080
      case VENUS  : return 4;
1081
      case EARTH  : return 4;
1082
      case MARS   : return 4;
1083
      case JUPITER: return 3;
1084
      case SATURN : return 4;
1085
      case URANUS : return 3;
1086
      case NEPTUNE: return 4;
1087
      }
1088

    
1089
    return 2;
1090
    }
1091

    
1092
///////////////////////////////////////////////////////////////////////////////////////////////////
1093

    
1094
  public String[][] getTutorials()
1095
    {
1096
    int param = getInitData().getParam();
1097

    
1098
    switch(param)
1099
      {
1100
      case CRAZY  : return new String[][]{
1101
                                          {"gb","7xUE8ond_Mg","Crazy 3x3x3 Cube Tutorial","SuperAntoniovivaldi"},
1102
                                          {"vn","N_AWJjHzqk0","Circle Crazy 3x3 Tutorial","VĂN CÔNG TÙNG"},
1103
                                         };
1104
      case MERCURY: return new String[][]{
1105
                                          {"gb","SeLGhxZP0E8","Crazy 3x3 Plus Mercury 1/3","SuperAntoniovivaldi"},
1106
                                          {"gb","nTBabfkdMe8","Crazy 3x3 Plus Mercury 2/3","SuperAntoniovivaldi"},
1107
                                          {"gb","Hd87z-VpTgM","Crazy 3x3 Plus Mercury 3a/3","SuperAntoniovivaldi"},
1108
                                          {"gb","MeMJ21vJLBc","Crazy 3x3 Plus Mercury 3b/3","SuperAntoniovivaldi"},
1109
                                          {"gb","s-kUXY5o5AQ","Crazy Mercury Plus Tutorial","twistypuzzling"},
1110
                                          {"es","LYMTrcGiAho","Crazy 3x3 Plus Mercurio","QBAndo"},
1111
                                          {"ru","2jtTsBwu3WY","Как собрать Crazy Mercury","RBcuber"},
1112
                                          {"fr","uxW652tv3_c","Solution crazy 3x3x3 Mercure 1/4","Laurent Boss"},
1113
                                          {"fr","QKuesX-0DaU","Solution crazy 3x3x3 Mercure 2a/4","Laurent Boss"},
1114
                                          {"fr","vDnAy1qYSCc","Solution crazy 3x3x3 Mercure 2b/4","Laurent Boss"},
1115
                                          {"fr","_eEILlsLurc","Solution crazy 3x3x3 Mercure 3/4","Laurent Boss"},
1116
                                          {"fr","4D3V9c3u7so","Solution crazy 3x3x3 Mercure 4/4","Laurent Boss"},
1117
                                          {"br","bMuDIEemCkI","Resolver Crazy Mercurio 1/5","Rafael Cinoto"},
1118
                                          {"br","FPP_nvOsnIQ","Resolver Crazy Mercurio 2/5","Rafael Cinoto"},
1119
                                          {"br","ouz20eYDlLM","Resolver Crazy Mercurio 3/5","Rafael Cinoto"},
1120
                                          {"br","IDHXszSX-UQ","Resolver Crazy Mercurio 4/5","Rafael Cinoto"},
1121
                                          {"br","Wbq701nq900","Resolver Crazy Mercurio 5/5","Rafael Cinoto"},
1122
                                          {"kr","NYBrUY9ngnc","크레이지 333 수성 1/3","듀나메스 큐브 해법연구소"},
1123
                                          {"kr","snT8xxMb0E0","크레이지 333 수성 2/3","듀나메스 큐브 해법연구소"},
1124
                                          {"kr","Pbfm3FZy_3k","크레이지 333 수성 3/3","듀나메스 큐브 해법연구소"},
1125
                                          {"vn","_1Pn2nqDF3A","Crazy Mercury 3x3 Tutorial","VĂN CÔNG TÙNG"},
1126
                                         };
1127
      case VENUS  : return new String[][]{
1128
                                          {"gb","I4f7UngHofc","Crazy 3x3 Plus Venus 1/3","SuperAntoniovivaldi"},
1129
                                          {"gb","p57W1iBXa0k","Crazy 3x3 Plus Venus 2/3","SuperAntoniovivaldi"},
1130
                                          {"gb","IUQcgfgYW3A","Crazy 3x3 Plus Venus 3/3","SuperAntoniovivaldi"},
1131
                                          {"es","L_o5b6i6iQc","Crazy 3x3 Plus Venus","QBAndo"},
1132
                                          {"ru","e6rFPDlpBoI","Как собрать Crazy Venus","Илья Топор-Гилка"},
1133
                                          {"fr","Ccu2XugYAhw","Solution crazy 3x3x3 Venus 1/6","Laurent Boss"},
1134
                                          {"fr","sz5JjDsBB4c","Solution crazy 3x3x3 Venus 2/6","Laurent Boss"},
1135
                                          {"fr","ap_m3-xY7LU","Solution crazy 3x3x3 Venus 3/6","Laurent Boss"},
1136
                                          {"fr","BkV1dyWIH1Q","Solution crazy 3x3x3 Venus 4/6","Laurent Boss"},
1137
                                          {"fr","spO_rh09h9s","Solution crazy 3x3x3 Venus 5/6","Laurent Boss"},
1138
                                          {"fr","kEmXDJgO0B4","Solution crazy 3x3x3 Venus 6/6","Laurent Boss"},
1139
                                          {"br","i781Mf0Fuag","Resolver Crazy Venus 1/3","Rafael Cinoto"},
1140
                                          {"br","3m0eyKbLaQ4","Resolver Crazy Venus 2/3","Rafael Cinoto"},
1141
                                          {"br","nKamBHo7oxo","Resolver Crazy Venus 3/3","Rafael Cinoto"},
1142
                                          {"kr","hsWfqlOa4_0","크레이지 (Crazy) 333 금성 1/5","듀나메스 큐브 해법연구소"},
1143
                                          {"kr","Z2sJczk29kg","크레이지 (Crazy) 333 금성 2/5","듀나메스 큐브 해법연구소"},
1144
                                          {"kr","8r1la2KEiBo","크레이지 (Crazy) 333 금성 3/5","듀나메스 큐브 해법연구소"},
1145
                                          {"kr","S9IcRa5AQHk","크레이지 (Crazy) 333 금성 4/5","듀나메스 큐브 해법연구소"},
1146
                                          {"kr","fs78ZSlShm0","크레이지 (Crazy) 333 금성 5/5","듀나메스 큐브 해법연구소"},
1147
                                          {"vn","_fG3VIKUwNo","Crazy Venus 3x3 Tutorial","VĂN CÔNG TÙNG"},
1148
                                         };
1149
      case EARTH  : return new String[][]{
1150
                                          {"gb","brNQ6Nl1-Mw","Crazy 3x3 Plus Earth 1/4","SuperAntoniovivaldi"},
1151
                                          {"gb","-3RSoC5OZGc","Crazy 3x3 Plus Earth 2/4","SuperAntoniovivaldi"},
1152
                                          {"gb","ahuXWFLTKRg","Crazy 3x3 Plus Earth 3/4","SuperAntoniovivaldi"},
1153
                                          {"gb","Lwt-7XKesUg","Crazy 3x3 Plus Earth 4/4","SuperAntoniovivaldi"},
1154
                                          {"es","GFHcLpYF620","Crazy 3x3 Plus Tierra","QBAndo"},
1155
                                          {"ru","YmEoI0XI5E4","Как собрать Crazy Earth","Илья Топор-Гилка"},
1156
                                          {"fr","QT4T4JV-L44","Solution crazy 3x3x3 Terre 1/6","Laurent Boss"},
1157
                                          {"fr","8On3fbrG5aA","Solution crazy 3x3x3 Terre 2/6","Laurent Boss"},
1158
                                          {"fr","IPEvUnVumJg","Solution crazy 3x3x3 Terre 3/6","Laurent Boss"},
1159
                                          {"fr","0awyEJmfuMM","Solution crazy 3x3x3 Terre 4/6","Laurent Boss"},
1160
                                          {"fr","xLKGyRXuaGs","Solution crazy 3x3x3 Terre 5/6","Laurent Boss"},
1161
                                          {"fr","CcunFHHhQ7g","Solution crazy 3x3x3 Terre 6/6","Laurent Boss"},
1162
                                          {"kr","4YBV9TnAzlg","크레이지(Crazy) 333 지구 1/5","듀나메스 큐브 해법연구소"},
1163
                                          {"kr","uWbAgUq-IqU","크레이지(Crazy) 333 지구 2/5","듀나메스 큐브 해법연구소"},
1164
                                          {"kr","glZqE9hQXK8","크레이지(Crazy) 333 지구 3/5","듀나메스 큐브 해법연구소"},
1165
                                          {"kr","WF2RGp8E97k","크레이지(Crazy) 333 지구 4/5","듀나메스 큐브 해법연구소"},
1166
                                          {"kr","RC-w26wLtQg","크레이지(Crazy) 333 지구 5/5","듀나메스 큐브 해법연구소"},
1167
                                          {"vn","MsFqHGuWspE","Crazy Earth 3x3 Tutorial","VĂN CÔNG TÙNG"},
1168
                                         };
1169
      case MARS   : return new String[][]{
1170
                                          {"gb","AJC0dZx2T-M","Crazy 3x3 Plus Mars 1/4","SuperAntoniovivaldi"},
1171
                                          {"gb","BcrYXklwEow","Crazy 3x3 Plus Mars 2/4","SuperAntoniovivaldi"},
1172
                                          {"gb","L_Y0qRG8F-0","Crazy 3x3 Plus Mars 3/4","SuperAntoniovivaldi"},
1173
                                          {"gb","PRyeKOV0Pbg","Crazy 3x3 Plus Mars 4/4","SuperAntoniovivaldi"},
1174
                                          {"es","P5NsxqMx9Bo","Crazy 3x3 Plus Marte","QBAndo"},
1175
                                          {"ru","syzb9hOojEs","Как собрать Crazy Mars","Илья Топор-Гилка"},
1176
                                          {"fr","tSqak16XJjw","Solution crazy 3x3x3 Mars 1/6","Laurent Boss"},
1177
                                          {"fr","Dm47WsF8OZg","Solution crazy 3x3x3 Mars 2/6","Laurent Boss"},
1178
                                          {"fr","gl-VL1NAslY","Solution crazy 3x3x3 Mars 3/6","Laurent Boss"},
1179
                                          {"fr","TlgsnVdkNh4","Solution crazy 3x3x3 Mars 4/6","Laurent Boss"},
1180
                                          {"fr","XxVeGY1IYIc","Solution crazy 3x3x3 Mars 5/6","Laurent Boss"},
1181
                                          {"fr","aK9YYEYMsyA","Solution crazy 3x3x3 Mars 6/6","Laurent Boss"},
1182
                                          {"kr","QKu2p9nNxFk","크레이지 333 화성 1/4","듀나메스 큐브 해법연구소"},
1183
                                          {"kr","f5YYqm6PPms","크레이지 333 화성 2a/4","듀나메스 큐브 해법연구소"},
1184
                                          {"kr","nmNxrpvucIg","크레이지 333 화성 2b/4","듀나메스 큐브 해법연구소"},
1185
                                          {"kr","rJLpMPCEc_s","크레이지 333 화성 3/4","듀나메스 큐브 해법연구소"},
1186
                                          {"kr","bBRAfOvUu8M","크레이지 333 화성 4/4","듀나메스 큐브 해법연구소"},
1187
                                          {"vn","lzw0Gfi-dM8","Crazy Mars 3x3 Tutorial","VĂN CÔNG TÙNG"},
1188
                                         };
1189
      case JUPITER: return new String[][]{
1190
                                          {"gb","HMnbVoOPk5E","Crazy 3x3 Plus Jupiter 1/2","SuperAntoniovivaldi"},
1191
                                          {"gb","Nw-LBWVu7yM","Crazy 3x3 Plus Jupiter 2/2","SuperAntoniovivaldi"},
1192
                                          {"es","p2HTOQZNfx4","Crazy 3x3 Plus Jupiter","QBAndo"},
1193
                                          {"ru","PGiYCgJYPAY","Как собрать Crazy Jupiter","RBcuber"},
1194
                                          {"fr","sKi_cXmywVs","Solution crazy 3x3x3 Jupiter 1/3","Laurent Boss"},
1195
                                          {"fr","HYnQCifSzFY","Solution crazy 3x3x3 Jupiter 2/3","Laurent Boss"},
1196
                                          {"fr","DNfV8gnaRXw","Solution crazy 3x3x3 Jupiter 3/3","Laurent Boss"},
1197
                                          {"pl","eJmQ50vcQcU","Crazy 3x3 Jupiter TUTORIAL PL","MrUK"},
1198
                                          {"br","pwYhThiSKLQ","Resolver Crazy Jupiter 1/2","Rafael Cinoto"},
1199
                                          {"br","VhuBtUU866U","Resolver Crazy Jupiter 2/2","Rafael Cinoto"},
1200
                                          {"kr","WQ3ad3DrBwY","크레이지 333 목성 1/2","듀나메스 큐브 해법연구소"},
1201
                                          {"kr","3LLL34HsqUs","크레이지 333 목성 2/2","듀나메스 큐브 해법연구소"},
1202
                                          {"vn","QH4ywmKNGVo","Jupiter Crazy Plus Tutorial","VĂN CÔNG TÙNG"},
1203
                                         };
1204
      case SATURN : return new String[][]{
1205
                                          {"gb","7fPXML8hZ-I","Crazy 3x3 Plus Saturn 1/3","SuperAntoniovivaldi"},
1206
                                          {"gb","ixVVVoxsg4A","Crazy 3x3 Plus Saturn 2/3","SuperAntoniovivaldi"},
1207
                                          {"gb","Dd8ZaGzbvjE","Crazy 3x3 Plus Saturn 3/3","SuperAntoniovivaldi"},
1208
                                          {"es","EyQXl0llt2M","Crazy 3x3 Plus Saturno","QBAndo"},
1209
                                          {"ru","T2uYDHyQZnE","Как собрать Crazy Saturn","Илья Топор-Гилка"},
1210
                                          {"fr","kuSYpTXoXUM","Solution crazy 3x3x3 Saturn 1/6","Laurent Boss"},
1211
                                          {"fr","u1OsRGuBcHA","Solution crazy 3x3x3 Saturn 2/6","Laurent Boss"},
1212
                                          {"fr","ra0MspIkctU","Solution crazy 3x3x3 Saturn 3/6","Laurent Boss"},
1213
                                          {"fr","dm3WBtGdxYA","Solution crazy 3x3x3 Saturn 4/6","Laurent Boss"},
1214
                                          {"fr","jVwPmbYot_U","Solution crazy 3x3x3 Saturn 5/6","Laurent Boss"},
1215
                                          {"fr","raYIoRIZPmc","Solution crazy 3x3x3 Saturn 6/6","Laurent Boss"},
1216
                                          {"br","0oKu1NXiQcY","Resolver Crazy Saturn 1/4","Rafael Cinoto"},
1217
                                          {"br","bRD73Lb1NTw","Resolver Crazy Saturn 2/4","Rafael Cinoto"},
1218
                                          {"br","v9nZrwCyNLs","Resolver Crazy Saturn 3/4","Rafael Cinoto"},
1219
                                          {"br","aipwvc2udbM","Resolver Crazy Saturn 4/4","Rafael Cinoto"},
1220
                                          {"kr","hfogu6lCLvs","크레이지 (Crazy) 333 토성 1/5","듀나메스 큐브 해법연구소"},
1221
                                          {"kr","rKjRzKxXHyA","크레이지 (Crazy) 333 토성 2/5","듀나메스 큐브 해법연구소"},
1222
                                          {"kr","7tKfu5RJCVc","크레이지 (Crazy) 333 토성 3/5","듀나메스 큐브 해법연구소"},
1223
                                          {"kr","L68nVvMhxVc","크레이지 (Crazy) 333 토성 4/5","듀나메스 큐브 해법연구소"},
1224
                                          {"kr","fvOcR9-TQpA","크레이지 (Crazy) 333 토성 5/5","듀나메스 큐브 해법연구소"},
1225
                                          {"vn","jiGMQ9Mn14w","Saturn Crazy Plus Tutorial","VĂN CÔNG TÙNG"},
1226
                                         };
1227
      case URANUS : return new String[][]{
1228
                                          {"gb","wOyVb2TMZlk","Crazy 3x3 Plus Uranus 1/3","SuperAntoniovivaldi"},
1229
                                          {"gb","UbTBBQ-gvk0","Crazy 3x3 Plus Uranus 2/3","SuperAntoniovivaldi"},
1230
                                          {"gb","_7k57cV81BM","Crazy 3x3 Plus Uranus 3/3","SuperAntoniovivaldi"},
1231
                                          {"es","vuPcyvE6EVE","Crazy 3x3 Plus Urano","QBAndo"},
1232
                                          {"ru","tm6sxFSeeBg","Как собрать Crazy Uranus","Илья Топор-Гилка"},
1233
                                          {"fr","i9lU26McP38","Solution crazy 3x3x3 Uranus 1/4","Laurent Boss"},
1234
                                          {"fr","Zr6fTayObJk","Solution crazy 3x3x3 Uranus 2/4","Laurent Boss"},
1235
                                          {"fr","nCmCxrY_QMU","Solution crazy 3x3x3 Uranus 3/4","Laurent Boss"},
1236
                                          {"fr","YNs8IohERKs","Solution crazy 3x3x3 Uranus 4/4","Laurent Boss"},
1237
                                          {"pl","pKPQJoGJtno","Crazy 3x3 Uranus TUTORIAL PL","MrUK"},
1238
                                          {"br","jjcqHXOD9eo","Resolver Crazy Urano 1/2","Rafael Cinoto"},
1239
                                          {"br","1B73Z2XE2ss","Resolver Crazy Urano 2/2","Rafael Cinoto"},
1240
                                          {"kr","_m3S5DiVRMw","크레이지 333 천왕성 1/2","듀나메스 큐브 해법연구소"},
1241
                                          {"kr","z9Wh6FXr0og","크레이지 333 천왕성 2/2","듀나메스 큐브 해법연구소"},
1242
                                          {"vn","bHiQ3YSEb2I","Uranus Crazy Plus Tutorial","VĂN CÔNG TÙNG"},
1243
                                         };
1244
      case NEPTUNE: return new String[][]{
1245
                                          {"gb","1gFmuFpU5-Y","Crazy 3x3 Plus Neptune 1a/4","SuperAntoniovivaldi"},
1246
                                          {"gb","UPRIH0MtmPM","Crazy 3x3 Plus Neptune 1b/4","SuperAntoniovivaldi"},
1247
                                          {"gb","Trqruz1NZ5E","Crazy 3x3 Plus Neptune 2/4","SuperAntoniovivaldi"},
1248
                                          {"gb","1gFmuFpU5-Y","Crazy 3x3 Plus Neptune 3/4","SuperAntoniovivaldi"},
1249
                                          {"gb","Rfa5y8NGqdY","Crazy 3x3 Plus Neptune 4/4","SuperAntoniovivaldi"},
1250
                                          {"es","LOR1cNs4NWM","Crazy 3x3 Plus Neptuno","QBAndo"},
1251
                                          {"ru","qvaRxJJrdi8","Как собрать Crazy Neptune","Илья Топор-Гилка"},
1252
                                          {"kr","6Avdw2zX5XI","크레이지 333 해왕성 1/2","듀나메스 큐브 해법연구소"},
1253
                                          {"kr","YbfWfDDBN9k","크레이지 333 해왕성 2/2","듀나메스 큐브 해법연구소"},
1254
                                          {"vn","hmf1YShJuZg","Neptune Crazy Plus Tutorial","VĂN CÔNG TÙNG"},
1255
                                         };
1256
      }
1257

    
1258
    return null;
1259
    }
1260
}
(7-7/41)