Project

General

Profile

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

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

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.signature.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.signature.ObjectConstants;
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 iconMode, Static4D quat, Static3D move, float scale, InitData data, InitAssets asset)
70
    {
71
    super(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
    final float H = 0.5f;
87

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

    
98
///////////////////////////////////////////////////////////////////////////////////////////////////
99

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

    
106
///////////////////////////////////////////////////////////////////////////////////////////////////
107

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

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

    
116
    int numOverrides = cubits.size();
117

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

    
131
    return null;
132
    }
133

    
134
///////////////////////////////////////////////////////////////////////////////////////////////////
135

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

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

    
151
///////////////////////////////////////////////////////////////////////////////////////////////////
152

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

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

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

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

    
186
    return mOffsets[cubitIndex];
187
    }
188

    
189
///////////////////////////////////////////////////////////////////////////////////////////////////
190

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

    
197
///////////////////////////////////////////////////////////////////////////////////////////////////
198

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

    
208
    return mCuts;
209
    }
210

    
211
///////////////////////////////////////////////////////////////////////////////////////////////////
212

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

    
219
///////////////////////////////////////////////////////////////////////////////////////////////////
220

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

    
226
///////////////////////////////////////////////////////////////////////////////////////////////////
227

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

    
233
///////////////////////////////////////////////////////////////////////////////////////////////////
234

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

    
240
///////////////////////////////////////////////////////////////////////////////////////////////////
241

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

    
247
///////////////////////////////////////////////////////////////////////////////////////////////////
248

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

    
254
///////////////////////////////////////////////////////////////////////////////////////////////////
255

    
256
  public float[][] getCubitPositions(int[] numLayers)
257
    {
258
    if( mPositions==null )
259
      {
260
      mPositions = new float[][]
261
         {
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
             {-1.0f,-1.0f,-1.0f},
270

    
271
             { 1.0f, 1.0f, 0.0f},
272
             { 1.0f,-1.0f, 0.0f},
273
             { 1.0f, 0.0f, 1.0f},
274
             { 1.0f, 0.0f,-1.0f},
275
             {-1.0f, 1.0f, 0.0f},
276
             {-1.0f,-1.0f, 0.0f},
277
             {-1.0f, 0.0f, 1.0f},
278
             {-1.0f, 0.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
             { 0.0f,-1.0f,-1.0f},
283

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

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

    
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,-1.0f,-DIFF},
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
             {-1.0f,-DIFF,-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
             {-DIFF,-1.0f,-1.0f},
340
         };
341
      }
342

    
343
    return mPositions;
344
    }
345

    
346
///////////////////////////////////////////////////////////////////////////////////////////////////
347

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

    
358
///////////////////////////////////////////////////////////////////////////////////////////////////
359

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

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

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

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

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

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

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

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

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

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

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

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

    
447
      return new float[][]
448
        {
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
            {+0.5f,+0.5f, 0.5f+D},
457

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

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

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

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

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

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

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

    
527
      return vertices;
528
      }
529
    }
530

    
531
///////////////////////////////////////////////////////////////////////////////////////////////////
532

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    
638
///////////////////////////////////////////////////////////////////////////////////////////////////
639

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

    
646
    int NUMV = 3+NUMBER_EDGE_SEGMENTS;
647

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

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

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

    
669
    int i0,i1,i2,i3;
670

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

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

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

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

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

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

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

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

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

    
712
///////////////////////////////////////////////////////////////////////////////////////////////////
713

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

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

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

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

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

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

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

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

    
756
///////////////////////////////////////////////////////////////////////////////////////////////////
757

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

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

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

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

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

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

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

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

    
796
///////////////////////////////////////////////////////////////////////////////////////////////////
797

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

    
809
    return null;
810
    }
811

    
812
///////////////////////////////////////////////////////////////////////////////////////////////////
813

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

    
872
///////////////////////////////////////////////////////////////////////////////////////////////////
873

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

    
927
///////////////////////////////////////////////////////////////////////////////////////////////////
928

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

    
934
///////////////////////////////////////////////////////////////////////////////////////////////////
935

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

    
943
    return 4;
944
    }
945

    
946
///////////////////////////////////////////////////////////////////////////////////////////////////
947

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

    
953
///////////////////////////////////////////////////////////////////////////////////////////////////
954

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

    
960
///////////////////////////////////////////////////////////////////////////////////////////////////
961

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

    
969
///////////////////////////////////////////////////////////////////////////////////////////////////
970
// PUBLIC API
971

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

    
977
///////////////////////////////////////////////////////////////////////////////////////////////////
978

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

    
987
    return mBasicAngle;
988
    }
989

    
990
///////////////////////////////////////////////////////////////////////////////////////////////////
991

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

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

    
1009
    return null;
1010
    }
1011

    
1012
///////////////////////////////////////////////////////////////////////////////////////////////////
1013

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

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

    
1031
    return null;
1032
    }
1033

    
1034
///////////////////////////////////////////////////////////////////////////////////////////////////
1035

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

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

    
1053
    return null;
1054
    }
1055

    
1056
///////////////////////////////////////////////////////////////////////////////////////////////////
1057

    
1058
  public String getInventor()
1059
    {
1060

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

    
1064
///////////////////////////////////////////////////////////////////////////////////////////////////
1065

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

    
1071
///////////////////////////////////////////////////////////////////////////////////////////////////
1072

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

    
1077
    switch(param)
1078
      {
1079
      case CRAZY  : return 2.88f;
1080
      case MERCURY: return 4.61f;
1081
      case VENUS  : return 4.62f;
1082
      case EARTH  : return 4.63f;
1083
      case MARS   : return 4.64f;
1084
      case JUPITER: return 3.81f;
1085
      case SATURN : return 4.65f;
1086
      case URANUS : return 3.82f;
1087
      case NEPTUNE: return 4.66f;
1088
      }
1089

    
1090
    return 2;
1091
    }
1092

    
1093
///////////////////////////////////////////////////////////////////////////////////////////////////
1094

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

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

    
1263
    return null;
1264
    }
1265
}
(13-13/57)