Project

General

Profile

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

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

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.io.InputStream;
13
import java.util.ArrayList;
14

    
15
import org.distorted.library.type.Static3D;
16
import org.distorted.library.type.Static4D;
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.main.Cubit;
22
import org.distorted.objectlib.main.InitData;
23
import org.distorted.objectlib.main.ObjectType;
24
import org.distorted.objectlib.main.ShapeHexahedron;
25
import org.distorted.objectlib.scrambling.ScrambleState;
26
import org.distorted.objectlib.touchcontrol.TouchControlHexahedron;
27

    
28
import static org.distorted.objectlib.touchcontrol.TouchControl.TC_HEXAHEDRON;
29
import static org.distorted.objectlib.touchcontrol.TouchControl.TYPE_NOT_SPLIT;
30

    
31
///////////////////////////////////////////////////////////////////////////////////////////////////
32

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

    
45
  private static final float DIAMETER_RATIO = 0.75f;
46
  private static final float DIFF = 0.6f;
47
  private static final int NUMBER_CORNER_SEGMENTS = 4;
48
  private static final int NUMBER_EDGE_SEGMENTS = 4;
49

    
50
  static final Static3D[] ROT_AXIS = new Static3D[]
51
         {
52
           new Static3D(1,0,0),
53
           new Static3D(0,1,0),
54
           new Static3D(0,0,1)
55
         };
56

    
57
  private ScrambleState[] mStates;
58
  private int[][] mBasicAngle;
59
  private float[][] mCuts;
60
  private float[][] mPositions;
61
  private int[] mQuatIndex;
62
  private float[][] mOffsets;
63

    
64
///////////////////////////////////////////////////////////////////////////////////////////////////
65

    
66
  public TwistyCrazy3x3(InitData data, int meshState, int iconMode, Static4D quat, Static3D move, float scale, InputStream stream)
67
    {
68
    super(data, meshState, iconMode, data.getNumLayers()[0], quat, move, scale, stream);
69
    }
70

    
71
///////////////////////////////////////////////////////////////////////////////////////////////////
72

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

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

    
94
///////////////////////////////////////////////////////////////////////////////////////////////////
95

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

    
102
///////////////////////////////////////////////////////////////////////////////////////////////////
103

    
104
  @Override
105
  public ObjectStickerOverride[] getStickerOverrides()
106
    {
107
    ArrayList<Integer> cubits = new ArrayList<>();
108

    
109
    for(int i=0; i<6; i++)
110
      if( cubitIsOverriden(20+i) ) cubits.add(20+i);
111

    
112
    int numOverrides = cubits.size();
113

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

    
127
    return null;
128
    }
129

    
130
///////////////////////////////////////////////////////////////////////////////////////////////////
131

    
132
  @Override
133
  public int getCubitRotationType(int cubit)
134
    {
135
    int[] numLayers = getNumLayers();
136
    int variant = getCubitVariant(cubit,numLayers);
137

    
138
    switch(variant)
139
      {
140
      case  2: return Cubit.TYPE_DECIDER;
141
      case  3:
142
      case  4: return Cubit.TYPE_FOLLOWER;
143
      default: return Cubit.TYPE_NORMAL;
144
      }
145
    }
146

    
147
///////////////////////////////////////////////////////////////////////////////////////////////////
148

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

    
158
      int param = getInitData().getParam();
159

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

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

    
182
    return mOffsets[cubitIndex];
183
    }
184

    
185
///////////////////////////////////////////////////////////////////////////////////////////////////
186
// Normal 3x3
187

    
188
  public ScrambleState[] getScrambleStates()
189
    {
190
    if( mStates==null )
191
      {
192
      int[][] m = new int[16][];
193

    
194
      for(int i=0; i<16; i++) m[i] = new int[] { 0,-1,i,0,1,i,0,2,i, 1,-1,i,1,1,i,1,2,i, 2,-1,i,2,1,i,2,2,i};
195

    
196
      mStates = new ScrambleState[]
197
          {
198
          new ScrambleState( new int[][] { m[ 1], m[ 2], m[ 3] } ),  //  0 0
199
          new ScrambleState( new int[][] {  null, m[ 4], m[ 5] } ),  //  1 x
200
          new ScrambleState( new int[][] { m[ 6],  null, m[ 7] } ),  //  2 y
201
          new ScrambleState( new int[][] { m[ 8], m[ 9],  null } ),  //  3 z
202
          new ScrambleState( new int[][] { m[10],  null, m[ 7] } ),  //  4 xy
203
          new ScrambleState( new int[][] { m[11], m[ 9],  null } ),  //  5 xz
204
          new ScrambleState( new int[][] {  null, m[12], m[ 5] } ),  //  6 yx
205
          new ScrambleState( new int[][] { m[ 8], m[13],  null } ),  //  7 yz
206
          new ScrambleState( new int[][] {  null, m[ 4], m[14] } ),  //  8 zx
207
          new ScrambleState( new int[][] { m[ 6],  null, m[15] } ),  //  9 zy
208
          new ScrambleState( new int[][] {  null,  null, m[ 5] } ),  // 10 xyx
209
          new ScrambleState( new int[][] {  null, m[ 4],  null } ),  // 11 xzx
210
          new ScrambleState( new int[][] {  null,  null, m[ 7] } ),  // 12 yxy
211
          new ScrambleState( new int[][] { m[ 6],  null,  null } ),  // 13 yzy
212
          new ScrambleState( new int[][] {  null, m[ 9],  null } ),  // 14 zxz
213
          new ScrambleState( new int[][] { m[ 8],  null,  null } ),  // 15 zyz
214
          };
215
      }
216

    
217
    return mStates;
218
    }
219

    
220
///////////////////////////////////////////////////////////////////////////////////////////////////
221

    
222
  public float[][] getCuts(int[] numLayers)
223
    {
224
    if( mCuts==null )
225
      {
226
      float C = 0.5f;
227
      float[] cut = new float[] {-C,+C};
228
      mCuts = new float[][] { cut,cut,cut };
229
      }
230

    
231
    return mCuts;
232
    }
233

    
234
///////////////////////////////////////////////////////////////////////////////////////////////////
235

    
236
  public boolean[][] getLayerRotatable(int[] numLayers)
237
    {
238
    boolean[] tmp = new boolean[] {true,true,true};
239
    return new boolean[][] { tmp,tmp,tmp };
240
    }
241

    
242
///////////////////////////////////////////////////////////////////////////////////////////////////
243

    
244
  public int getTouchControlType()
245
    {
246
    return TC_HEXAHEDRON;
247
    }
248

    
249
///////////////////////////////////////////////////////////////////////////////////////////////////
250

    
251
  public int getTouchControlSplit()
252
    {
253
    return TYPE_NOT_SPLIT;
254
    }
255

    
256
///////////////////////////////////////////////////////////////////////////////////////////////////
257

    
258
  public int[][][] getEnabled()
259
    {
260
    return new int[][][] { {{1,2}},{{1,2}},{{0,2}},{{0,2}},{{0,1}},{{0,1}} };
261
    }
262

    
263
///////////////////////////////////////////////////////////////////////////////////////////////////
264

    
265
  public float[] getDist3D(int[] numLayers)
266
    {
267
    return TouchControlHexahedron.D3D;
268
    }
269

    
270
///////////////////////////////////////////////////////////////////////////////////////////////////
271

    
272
  public Static3D[] getFaceAxis()
273
    {
274
    return TouchControlHexahedron.FACE_AXIS;
275
    }
276

    
277
///////////////////////////////////////////////////////////////////////////////////////////////////
278

    
279
  public float[][] getCubitPositions(int[] numLayers)
280
    {
281
    if( mPositions==null )
282
      {
283
      mPositions = new float[][]
284
         {
285
             { 1.0f, 1.0f, 1.0f},
286
             { 1.0f, 1.0f,-1.0f},
287
             { 1.0f,-1.0f, 1.0f},
288
             { 1.0f,-1.0f,-1.0f},
289
             {-1.0f, 1.0f, 1.0f},
290
             {-1.0f, 1.0f,-1.0f},
291
             {-1.0f,-1.0f, 1.0f},
292
             {-1.0f,-1.0f,-1.0f},
293

    
294
             { 1.0f, 1.0f, 0.0f},
295
             { 1.0f,-1.0f, 0.0f},
296
             { 1.0f, 0.0f, 1.0f},
297
             { 1.0f, 0.0f,-1.0f},
298
             {-1.0f, 1.0f, 0.0f},
299
             {-1.0f,-1.0f, 0.0f},
300
             {-1.0f, 0.0f, 1.0f},
301
             {-1.0f, 0.0f,-1.0f},
302
             { 0.0f, 1.0f, 1.0f},
303
             { 0.0f, 1.0f,-1.0f},
304
             { 0.0f,-1.0f, 1.0f},
305
             { 0.0f,-1.0f,-1.0f},
306

    
307
             { 0.0f, 0.0f, DIFF},
308
             { 0.0f, 0.0f,-DIFF},
309
             { 0.0f, DIFF, 0.0f},
310
             { 0.0f,-DIFF, 0.0f},
311
             { DIFF, 0.0f, 0.0f},
312
             {-DIFF, 0.0f, 0.0f},
313

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

    
339
             { 1.0f, 1.0f, DIFF},
340
             { 1.0f, 1.0f,-DIFF},
341
             { 1.0f,-1.0f, DIFF},
342
             { 1.0f,-1.0f,-DIFF},
343
             {-1.0f, 1.0f, DIFF},
344
             {-1.0f, 1.0f,-DIFF},
345
             {-1.0f,-1.0f, DIFF},
346
             {-1.0f,-1.0f,-DIFF},
347
             { 1.0f, DIFF, 1.0f},
348
             { 1.0f,-DIFF, 1.0f},
349
             { 1.0f, DIFF,-1.0f},
350
             { 1.0f,-DIFF,-1.0f},
351
             {-1.0f, DIFF, 1.0f},
352
             {-1.0f,-DIFF, 1.0f},
353
             {-1.0f, DIFF,-1.0f},
354
             {-1.0f,-DIFF,-1.0f},
355
             { DIFF, 1.0f, 1.0f},
356
             {-DIFF, 1.0f, 1.0f},
357
             { DIFF, 1.0f,-1.0f},
358
             {-DIFF, 1.0f,-1.0f},
359
             { DIFF,-1.0f, 1.0f},
360
             {-DIFF,-1.0f, 1.0f},
361
             { DIFF,-1.0f,-1.0f},
362
             {-DIFF,-1.0f,-1.0f},
363
         };
364
      }
365

    
366
    return mPositions;
367
    }
368

    
369
///////////////////////////////////////////////////////////////////////////////////////////////////
370

    
371
  public Static4D getCubitQuats(int cubit, int[] numLayers)
372
    {
373
    if( mQuatIndex==null ) mQuatIndex = new int[] { 0,1,17,22,4,5,8,19,
374
                                                    6,17,7,12,4,16,9,10,0,5,3,2,
375
                                                    0,2,1,3,6,4,
376
                                                    0,4,5,6, 8,16,2,17, 21,3,20,14, 12,11,10,1, 13,18,22,7, 15,19,23,9,
377
                                                    0,18,7,2, 9,5,8,19, 13,3,1,22, 14,23,15,11, 21,4,6,10, 17,20,12,16 };
378
    return mObjectQuats[mQuatIndex[cubit]];
379
    }
380

    
381
///////////////////////////////////////////////////////////////////////////////////////////////////
382

    
383
  private ObjectShape getCornerShape()
384
    {
385
    final float INIT_ALPHA = (float)Math.asin(1/(3*DIAMETER_RATIO));
386
    final float STEP_CORNER= (float)((Math.PI/2-2*INIT_ALPHA)/NUMBER_CORNER_SEGMENTS);
387
    final int SINGLE_ARC = NUMBER_CORNER_SEGMENTS+1;
388
    final int SINGLE_INNER_ARC = (NUMBER_CORNER_SEGMENTS+1)/2;
389
    final int NUM_VERTICES = 4 + 3*SINGLE_ARC + 1 + 3*SINGLE_INNER_ARC;
390
    float[][] tmp = new float[SINGLE_ARC][2];
391

    
392
    for(int i=0; i<SINGLE_ARC; i++)
393
      {
394
      float alpha = INIT_ALPHA + i*STEP_CORNER;
395
      tmp[i][0] = (float)(1.5f*DIAMETER_RATIO*Math.sin(alpha) - 1.0f);
396
      tmp[i][1] = (float)(1.5f*DIAMETER_RATIO*Math.cos(alpha) - 1.0f);
397
      }
398

    
399
    float[][] vertices = new float[NUM_VERTICES][];
400

    
401
    vertices[0] = new float[] { +0.5f, +0.5f, +0.5f };
402
    vertices[1] = new float[] { -0.5f, +0.5f, +0.5f };
403
    vertices[2] = new float[] { +0.5f, -0.5f, +0.5f };
404
    vertices[3] = new float[] { +0.5f, +0.5f, -0.5f };
405

    
406
    for(int i=0; i<SINGLE_ARC; i++)
407
      {
408
      float s = tmp[i][0];
409
      float c = tmp[i][1];
410

    
411
      vertices[4             +i] = new float[] {0.5f,+s,+c};
412
      vertices[4+  SINGLE_ARC+i] = new float[] {+c,0.5f,+s};
413
      vertices[4+2*SINGLE_ARC+i] = new float[] {+s,+c,0.5f};
414
      }
415

    
416
    final float EXTRA = (NUMBER_CORNER_SEGMENTS%2)==0 ? 1.0f : (float)Math.cos((Math.PI/2-2*INIT_ALPHA)/(2*NUMBER_CORNER_SEGMENTS));
417
    final float LEN = 1.5f*DIAMETER_RATIO*EXTRA;
418
    final float M = (float)(LEN*Math.sin(Math.PI/4) - 1.0f);
419
    vertices[4+3*SINGLE_ARC] = new float[] {M,M,M};
420

    
421
    for(int i=0; i<SINGLE_INNER_ARC; i++)
422
      {
423
      float s = tmp[i][0];
424
      float c = tmp[i][1];
425

    
426
      vertices[4+3*SINGLE_ARC+1                   +i] = new float[] {s,c,c};
427
      vertices[4+3*SINGLE_ARC+1+  SINGLE_INNER_ARC+i] = new float[] {c,s,c};
428
      vertices[4+3*SINGLE_ARC+1+2*SINGLE_INNER_ARC+i] = new float[] {c,c,s};
429
      }
430

    
431
    final int NUM_FACES = 6 + 3*NUMBER_CORNER_SEGMENTS;
432
    final int NUM_VERTS = 4 +   NUMBER_CORNER_SEGMENTS;
433

    
434
    int[][] indices = new int[NUM_FACES][];
435

    
436
    indices[0] = new int[NUM_VERTS];
437
    indices[1] = new int[NUM_VERTS];
438
    indices[2] = new int[NUM_VERTS];
439

    
440
    indices[0][0] = 3;
441
    indices[0][1] = 0;
442
    indices[0][2] = 2;
443
    indices[1][0] = 1;
444
    indices[1][1] = 0;
445
    indices[1][2] = 3;
446
    indices[2][0] = 2;
447
    indices[2][1] = 0;
448
    indices[2][2] = 1;
449

    
450
    for(int i=0; i<SINGLE_ARC; i++)
451
      {
452
      indices[0][3+i] = 4+i;
453
      indices[1][3+i] = 4+i+  SINGLE_ARC;
454
      indices[2][3+i] = 4+i+2*SINGLE_ARC;
455
      }
456

    
457
    indices[3] = new int[] { 1, 4+2*SINGLE_ARC-1, 4+3*SINGLE_ARC+1                   , 4+2*SINGLE_ARC};
458
    indices[4] = new int[] { 2, 4+3*SINGLE_ARC-1, 4+3*SINGLE_ARC+1+  SINGLE_INNER_ARC, 4             };
459
    indices[5] = new int[] { 3, 4+  SINGLE_ARC-1, 4+3*SINGLE_ARC+1+2*SINGLE_INNER_ARC, 4+  SINGLE_ARC};
460

    
461
    int start,i0,i1,i2,i3;
462
    int MID = (NUMBER_CORNER_SEGMENTS)/2;
463
    int MID2= (NUMBER_CORNER_SEGMENTS+1)/2;
464

    
465
    if( (NUMBER_CORNER_SEGMENTS%2) == 0 )
466
      {
467
      start = 12;
468
      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};
469
      indices[ 7] = new int[] { 4+3*SINGLE_ARC, 4+3*SINGLE_ARC+1+MID-1,  4+SINGLE_ARC+MID+1, 4+SINGLE_ARC+MID};
470
      indices[ 8] = new int[] { 4+3*SINGLE_ARC, 4+3*SINGLE_ARC+1+2*SINGLE_INNER_ARC+MID-1, 4+MID+1, 4+MID };
471
      indices[ 9] = new int[] { 4+3*SINGLE_ARC, 4+MID, 4+MID-1, 4+3*SINGLE_ARC+1+SINGLE_INNER_ARC+MID-1 };
472
      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 };
473
      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 };
474
      }
475
    else
476
      {
477
      start = 9;
478
      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};
479
      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};
480
      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};
481
      }
482

    
483
    for(int j=0; j<MID2-1; j++)
484
      {
485
      i0 = 4+3*SINGLE_ARC+1+2*SINGLE_INNER_ARC+j;
486
      i1 = 4+3*SINGLE_ARC+1+2*SINGLE_INNER_ARC+j+1;
487
      i2 = 4+SINGLE_ARC+j+1;
488
      i3 = 4+SINGLE_ARC+j;
489

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

    
492
      i0 = 4+3*SINGLE_ARC+1+2*SINGLE_INNER_ARC+j+1;
493
      i1 = 4+3*SINGLE_ARC+1+2*SINGLE_INNER_ARC+j;
494
      i2 = 4+(SINGLE_ARC-1)-j;
495
      i3 = 4+(SINGLE_ARC-1)-(j+1);
496

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

    
499
      i0 = 4+3*SINGLE_ARC+1+j;
500
      i1 = 4+3*SINGLE_ARC+1+j+1;
501
      i2 = 4+2*SINGLE_ARC+j+1;
502
      i3 = 4+2*SINGLE_ARC+j;
503

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

    
506
      i0 = 4+3*SINGLE_ARC+1+j+1;
507
      i1 = 4+3*SINGLE_ARC+1+j;
508
      i2 = 4+(2*SINGLE_ARC-1)-j;
509
      i3 = 4+(2*SINGLE_ARC-1)-(j+1);
510

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

    
513
      i0 = 4+3*SINGLE_ARC+1+SINGLE_INNER_ARC+j;
514
      i1 = 4+3*SINGLE_ARC+1+SINGLE_INNER_ARC+j+1;
515
      i2 = 4+j+1;
516
      i3 = 4+j;
517

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

    
520
      i0 = 4+3*SINGLE_ARC+1+SINGLE_INNER_ARC+j+1;
521
      i1 = 4+3*SINGLE_ARC+1+SINGLE_INNER_ARC+j;
522
      i2 = 4+(3*SINGLE_ARC-1)-j;
523
      i3 = 4+(3*SINGLE_ARC-1)-(j+1);
524

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

    
528
    return new ObjectShape(vertices,indices);
529
    }
530

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

    
533
  private ObjectShape getEdgeShape()
534
    {
535
    final int NUM_VERTICES = 8 + 3*(NUMBER_EDGE_SEGMENTS-1);
536
    final float INIT_ALPHA = (float)Math.asin(1/(3*DIAMETER_RATIO));
537
    final float H = 0.5f*((float)Math.sqrt(9*DIAMETER_RATIO*DIAMETER_RATIO-1))-1.0f;
538
    float[][] vertices = new float[NUM_VERTICES][];
539

    
540
    vertices[0] = new float[] {-0.5f,+0.5f,+0.5f};
541
    vertices[1] = new float[] {+0.5f,+0.5f,+0.5f};
542
    vertices[2] = new float[] {-0.5f,    H,+0.5f};
543
    vertices[3] = new float[] {+0.5f,    H,+0.5f};
544
    vertices[4] = new float[] {-0.5f,+0.5f,    H};
545
    vertices[5] = new float[] {+0.5f,+0.5f,    H};
546
    vertices[6] = new float[] {-0.5f,    H,    H};
547
    vertices[7] = new float[] {+0.5f,    H,    H};
548

    
549
    final int NUM_VERTS = NUMBER_EDGE_SEGMENTS-1;
550
    for(int i=0; i<NUM_VERTS; i++)
551
      {
552
      float beta = INIT_ALPHA*((2.0f*(i+1))/NUMBER_EDGE_SEGMENTS -1 );
553
      float A = (float)(1.5f*DIAMETER_RATIO*Math.sin(beta));
554
      float B = (float)(1.5f*DIAMETER_RATIO*Math.cos(beta)-1.0f);
555
      vertices[8            +i] = new float[] {A,B,0.5f};
556
      vertices[8+  NUM_VERTS+i] = new float[] {A,0.5f,B};
557
      vertices[8+2*NUM_VERTS+i] = new float[] {A,B,B};
558
      }
559

    
560
    final int NUM_FACES = 4 + 2*NUMBER_EDGE_SEGMENTS;
561
    int[][] indices = new int[NUM_FACES][];
562

    
563
    int NUMV = 3+NUMBER_EDGE_SEGMENTS;
564

    
565
    indices[0] = new int[NUMV];
566
    indices[0][0] = 3;
567
    indices[0][1] = 1;
568
    indices[0][2] = 0;
569
    indices[0][3] = 2;
570
    for(int i=0; i<NUM_VERTS; i++) indices[0][4+i] = 8+i;
571

    
572
    indices[1] = new int[NUMV];
573
    indices[1][0] = 4;
574
    indices[1][1] = 0;
575
    indices[1][2] = 1;
576
    indices[1][3] = 5;
577
    for(int i=0; i<NUM_VERTS; i++) indices[1][4+i] = 7+2*NUM_VERTS-i;
578

    
579
    indices[2] = new int[] {5,1,3,7};
580
    indices[3] = new int[] {0,4,6,2};
581
    indices[4] = new int[] {8,2,6,8+2*NUM_VERTS};
582
    indices[5] = new int[] {3,7+NUM_VERTS,7+3*NUM_VERTS,7};
583
    indices[6] = new int[] {6,4,8+NUM_VERTS,8+2*NUM_VERTS};
584
    indices[7] = new int[] {5,7,7+3*NUM_VERTS,7+2*NUM_VERTS};
585

    
586
    int i0,i1,i2,i3;
587

    
588
    for(int i=0; i<NUMBER_EDGE_SEGMENTS-2; i++)
589
      {
590
      i0 = 9+i;
591
      i1 = 8+i;
592
      i2 = 8+2*NUM_VERTS+i;
593
      i3 = 9+2*NUM_VERTS+i;
594

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

    
597
      i0 = 9+2*NUM_VERTS+i;
598
      i1 = 8+2*NUM_VERTS+i;
599
      i2 = 8+NUM_VERTS+i;
600
      i3 = 9+NUM_VERTS+i;
601

    
602
      indices[8+NUMBER_EDGE_SEGMENTS-2+i] = new int[] {i0,i1,i2,i3};
603
      }
604

    
605
    return new ObjectShape(vertices,indices);
606
    }
607

    
608
///////////////////////////////////////////////////////////////////////////////////////////////////
609

    
610
  private ObjectShape getCenterShape(float D)
611
    {
612
    final float A = 0.1f;
613
    final float B = 0.2f;
614
    final float C = 0.55f+D;
615

    
616
    float[][] vertices = new float[][]
617
        {
618
            {-0.5f,-0.5f,-0.5f+D},
619
            {-0.5f,-0.5f,+0.5f+D},
620
            {-0.5f,+0.5f,-0.5f+D},
621
            {-0.5f,+0.5f,+0.5f+D},
622
            {+0.5f,-0.5f,-0.5f+D},
623
            {+0.5f,-0.5f,+0.5f+D},
624
            {+0.5f,+0.5f,-0.5f+D},
625
            {+0.5f,+0.5f,+0.5f+D},
626

    
627
            {   0,-A  , C},
628
            {   B,-A-B, C},
629
            { A+B,  -B, C},
630
            { A  ,   0, C},
631
            { A+B,   B, C},
632
            {   B, A+B, C},
633
            {   0, A  , C},
634
            {  -B, A+B, C},
635
            {-A-B,   B, C},
636
            {-A  ,   0, C},
637
            {-A-B,  -B, C},
638
            {  -B,-A-B, C},
639
        };
640

    
641
    int[][] indices = new int[][]
642
        {
643
            {1,5,7,3},
644
            {5,4,6,7},
645
            {0,1,3,2},
646
            {3,7,6,2},
647
            {0,4,5,1},
648
            {4,0,2,6},
649

    
650
            {8,9,10,11,12,13,14,15,16,17,18,19}
651
        };
652

    
653
    return new ObjectShape(vertices,indices);
654
    }
655

    
656
///////////////////////////////////////////////////////////////////////////////////////////////////
657

    
658
  private ObjectShape getBigCircleShape(float D)
659
    {
660
    final float INIT_ALPHA = (float)Math.asin(1/(3*DIAMETER_RATIO));
661
    final float H = 0.5f*((float)Math.sqrt(9*DIAMETER_RATIO*DIAMETER_RATIO-1))-1.0f;
662
    final int NUM_VERTICES = 8 + 2*(NUMBER_EDGE_SEGMENTS-1);
663
    float[][] vertices = new float[NUM_VERTICES][];
664

    
665
    vertices[0] = new float[] {-0.5f,-0.5f,+0.5f+D};
666
    vertices[1] = new float[] {-0.5f,-0.5f,-0.5f+D};
667
    vertices[2] = new float[] {+0.5f,-0.5f,+0.5f+D};
668
    vertices[3] = new float[] {+0.5f,-0.5f,-0.5f+D};
669
    vertices[4] = new float[] {-0.5f,    H,+0.5f+D};
670
    vertices[5] = new float[] {-0.5f,    H,-0.5f+D};
671
    vertices[6] = new float[] {+0.5f,    H,+0.5f+D};
672
    vertices[7] = new float[] {+0.5f,    H,-0.5f+D};
673

    
674
    final int NUM_VERTS = NUMBER_EDGE_SEGMENTS-1;
675
    for(int i=0; i<NUM_VERTS; i++)
676
      {
677
      float beta = INIT_ALPHA*((2.0f*(i+1))/NUMBER_EDGE_SEGMENTS -1 );
678
      float A = (float)(1.5f*DIAMETER_RATIO*Math.sin(beta));
679
      float B = (float)(1.5f*DIAMETER_RATIO*Math.cos(beta)-1.0f);
680
      vertices[8          +i] = new float[] {A,B,+0.5f+D};
681
      vertices[8+NUM_VERTS+i] = new float[] {A,B,-0.5f+D};
682
      }
683

    
684
    final int NUM_FACES = 5 + NUMBER_EDGE_SEGMENTS;
685
    int[][] indices = new int[NUM_FACES][];
686

    
687
    int NUMV = 4+NUM_VERTS;
688
    indices[0] = new int[NUMV];
689
    indices[0][0] = 4;
690
    indices[0][1] = 0;
691
    indices[0][2] = 2;
692
    indices[0][3] = 6;
693
    for(int i=0; i<NUM_VERTS; i++) indices[0][4+i] = 7+NUM_VERTS-i;
694

    
695
    indices[1] = new int[NUMV];
696
    indices[1][0] = 7;
697
    indices[1][1] = 3;
698
    indices[1][2] = 1;
699
    indices[1][3] = 5;
700
    for(int i=0; i<NUM_VERTS; i++) indices[1][4+i] = 8+NUM_VERTS+i;
701

    
702
    indices[2] = new int[] {7,3,2,6};
703
    indices[3] = new int[] {4,0,1,5};
704
    indices[4] = new int[] {1,3,2,0};
705

    
706
    indices[5] = new int[] {5,4,8,8+NUM_VERTS};
707
    indices[6] = new int[] {7+NUM_VERTS,6,7,7+2*NUM_VERTS};
708

    
709
    for(int i=0; i<NUMBER_EDGE_SEGMENTS-2; i++)
710
      {
711
      int i0 = 8+i;
712
      int i1 = 9+i;
713
      int i2 = 9+NUM_VERTS+i;
714
      int i3 = 8+NUM_VERTS+i;
715

    
716
      indices[7+i] = new int[] {i0,i1,i2,i3};
717
      }
718

    
719
    return new ObjectShape(vertices,indices);
720
    }
721

    
722
///////////////////////////////////////////////////////////////////////////////////////////////////
723

    
724
  private ObjectShape getSmallCircleShape(float D)
725
    {
726
    final float H = 0.5f*((float)Math.sqrt(9*DIAMETER_RATIO*DIAMETER_RATIO-1))-1.0f;
727
    final float INIT_ALPHA = (float)Math.asin(1/(3*DIAMETER_RATIO));
728
    final float STEP_CORNER= (float)((Math.PI/2-2*INIT_ALPHA)/NUMBER_CORNER_SEGMENTS);
729
    final int NUM_VERTICES = 6 + 2*(NUMBER_CORNER_SEGMENTS-1);
730
    float[][] vertices = new float[NUM_VERTICES][];
731

    
732
    vertices[0] = new float[] {-0.5f,    H, 0.5f+D};
733
    vertices[1] = new float[] {    H,-0.5f, 0.5f+D};
734
    vertices[2] = new float[] {-0.5f,-0.5f, 0.5f+D};
735
    vertices[3] = new float[] {-0.5f,    H,-0.5f+D};
736
    vertices[4] = new float[] {    H,-0.5f,-0.5f+D};
737
    vertices[5] = new float[] {-0.5f,-0.5f,-0.5f+D};
738

    
739
    for(int i=0; i<NUMBER_CORNER_SEGMENTS-1; i++)
740
      {
741
      float alpha = INIT_ALPHA + (i+1)*STEP_CORNER;
742
      float A = (float)(1.5f*DIAMETER_RATIO*Math.sin(alpha) - 1.0f);
743
      float B = (float)(1.5f*DIAMETER_RATIO*Math.cos(alpha) - 1.0f);
744

    
745
      vertices[6                       +i] = new float[] {A,B, 0.5f+D};
746
      vertices[5+NUMBER_CORNER_SEGMENTS+i] = new float[] {A,B,-0.5f+D};
747
      }
748

    
749
    final int NUM_FACES = 4 + NUMBER_CORNER_SEGMENTS;
750
    int[][] indices = new int[NUM_FACES][];
751

    
752
    int NUMV = 2+NUMBER_CORNER_SEGMENTS;
753
    indices[0] = new int[NUMV];
754
    indices[0][0] = 0;
755
    indices[0][1] = 2;
756
    indices[0][2] = 1;
757
    for(int i=3; i<NUMV; i++) indices[0][i] = 5+(NUMBER_CORNER_SEGMENTS-1)-(i-3);
758

    
759
    indices[1] = new int[NUMV];
760
    indices[1][0] = 4;
761
    indices[1][1] = 5;
762
    indices[1][2] = 3;
763
    for(int i=3; i<NUMV; i++) indices[1][i] = 5+NUMBER_CORNER_SEGMENTS+(i-3);
764

    
765
    indices[2] = new int[] {0,3,5,2};
766
    indices[3] = new int[] {1,2,5,4};
767

    
768
    indices[4] = new int[] {5+NUMBER_CORNER_SEGMENTS,3,0,6};
769
    indices[5] = new int[] {1,4,5+2*(NUMBER_CORNER_SEGMENTS-1),5+(NUMBER_CORNER_SEGMENTS-1)};
770

    
771
    for(int i=0; i<NUMBER_CORNER_SEGMENTS-2; i++)
772
      {
773
      int i0 = 6+i;
774
      int i1 = 7+i;
775
      int i2 = 6+NUMBER_CORNER_SEGMENTS+i;
776
      int i3 = 5+NUMBER_CORNER_SEGMENTS+i;
777

    
778
      indices[6+i] = new int[] {i0,i1,i2,i3};
779
      }
780

    
781
    return new ObjectShape(vertices,indices);
782
    }
783

    
784
///////////////////////////////////////////////////////////////////////////////////////////////////
785

    
786
  public ObjectShape getObjectShape(int variant)
787
    {
788
    switch(variant)
789
      {
790
      case 0: return getCornerShape();
791
      case 1: return getEdgeShape();
792
      case 2: return getCenterShape(1.0f-DIFF);
793
      case 3: return getBigCircleShape(1.0f-DIFF);
794
      case 4: return getSmallCircleShape(1.02f-DIFF);
795
      }
796

    
797
    return null;
798
    }
799

    
800
///////////////////////////////////////////////////////////////////////////////////////////////////
801

    
802
  public ObjectFaceShape getObjectFaceShape(int variant)
803
    {
804
    if( variant==0 )
805
      {
806
      float h1 = isInIconMode() ? 0.001f : 0.04f;
807
      float h2 = 0.001f;
808
      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} };
809
      final int NUM_BANDS = 6+3*NUMBER_CORNER_SEGMENTS;
810
      int[] bandIndices = new int[NUM_BANDS];
811
      bandIndices[0] = bandIndices[1] = bandIndices[2] = 0;
812
      bandIndices[3] = bandIndices[4] = bandIndices[5] = 1;
813
      for(int i=6; i<NUM_BANDS; i++) bandIndices[i] = 2;
814
      float[][] corners = { {0.02f,0.09f} };
815
      float[][] centers = { { 0.0f, 0.0f, 0.0f } };
816
      final int SINGLE_ARC = NUMBER_CORNER_SEGMENTS+1;
817
      final int SINGLE_INNER_ARC = (NUMBER_CORNER_SEGMENTS+1)/2;
818
      final int NUM_VERTICES = 4 + 3*SINGLE_ARC + 1 + 3*SINGLE_INNER_ARC;
819
      int[] indices = new int[NUM_VERTICES];
820
      indices[0] = indices[1] = indices[2] = indices[3] = 0;
821
      for(int i=4; i<NUM_VERTICES; i++) indices[i] = -1;
822
      return new ObjectFaceShape(bands,bandIndices,corners,indices,centers,indices,null);
823
      }
824
    if( variant==1 )
825
      {
826
      float h1 = isInIconMode() ? 0.001f : 0.03f;
827
      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} };
828
      final int NUM_BANDS = 4 + 2*NUMBER_EDGE_SEGMENTS;
829
      int[] bandIndices = new int[NUM_BANDS];
830
      bandIndices[0] = bandIndices[1] = 0;
831
      bandIndices[2] = bandIndices[3] = 1;
832
      for(int i=4; i<NUM_BANDS; i++) bandIndices[i] = 2;
833
      float[][] corners = { {0.02f,0.09f} };
834
      float[][] centers = { { 0.0f, 0.0f, 0.0f } };
835
      final int NUM_VERTICES = 8 + 3*(NUMBER_EDGE_SEGMENTS-1);
836
      int[] indices = new int[NUM_VERTICES];
837
      indices[0] = indices[1] = indices[2] = indices[3] = indices[4] = indices[5] = 0;
838
      for(int i=6; i<NUM_VERTICES; i++) indices[i] = -1;
839
      return new ObjectFaceShape(bands,bandIndices,corners,indices,centers,indices,null);
840
      }
841
    if( variant==2 )
842
      {
843
      float h1 = isInIconMode() ? 0.001f : 0.05f;
844
      float[][] bands   = { {h1,45,0.2f,0.4f,5,0,0}, {0.001f,1,0.3f,0.5f,2,0,0} };
845
      int[] bandIndices = new int[] {0,1,1,1,1,1,1};
846
      float[][] corners = { {0.02f,0.09f} };
847
      float[][] centers = { { 0.0f, 0.0f, 1.0f } };
848
      int[] indices = new int[] {0,0,0,0,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1};
849
      return new ObjectFaceShape(bands,bandIndices,corners,indices,centers,indices,null);
850
      }
851
    if( variant==3 )
852
      {
853
      float h1 = isInIconMode() ? 0.001f : 0.03f;
854
      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} };
855
      final int NUM_BANDS = 5 + NUMBER_EDGE_SEGMENTS;
856
      int[] bandIndices = new int[NUM_BANDS];
857
      bandIndices[0] = 0;
858
      bandIndices[1] = 2;
859
      bandIndices[2] = bandIndices[3] = bandIndices[4] = 1;
860
      for(int i=5; i<NUM_BANDS; i++) bandIndices[i] = 2;
861
      float[][] corners = { {0.02f,0.09f} };
862
      float[][] centers = { { 0.0f, 0.0f, 1.0f } };
863
      final int NUM_VERTICES = 8 + 2*(NUMBER_EDGE_SEGMENTS-1);
864
      int[] indices = new int[NUM_VERTICES];
865
      for(int i=0; i<NUM_VERTICES; i++) indices[i] = -1;
866
      indices[0] = indices[2] = indices[4] = indices[6] = 0;
867
      return new ObjectFaceShape(bands,bandIndices,corners,indices,centers,indices,null);
868
      }
869
    else
870
      {
871
      float h1 = isInIconMode() ? 0.001f : 0.02f;
872
      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} };
873
      final int NUM_BANDS = 4 + NUMBER_CORNER_SEGMENTS;
874
      int[] bandIndices = new int[NUM_BANDS];
875
      bandIndices[0] = 0;
876
      bandIndices[1] = 2;
877
      bandIndices[2] = bandIndices[3] = 1;
878
      for(int i=4; i<NUM_BANDS; i++) bandIndices[i] = 2;
879
      float[][] corners = { {0.02f,0.09f} };
880
      float[][] centers = { { 0.0f, 0.0f, 1.0f } };
881
      final int NUM_VERTICES = 6 + 2*(NUMBER_CORNER_SEGMENTS-1);
882
      int[] indices = new int[NUM_VERTICES];
883
      for(int i=0; i<NUM_VERTICES; i++) indices[i] = -1;
884
      indices[0] = indices[1] = indices[2] = 0;
885
      return new ObjectFaceShape(bands,bandIndices,corners,indices,centers,indices,null);
886
      }
887
    }
888

    
889
///////////////////////////////////////////////////////////////////////////////////////////////////
890

    
891
  public int getNumCubitVariants(int[] numLayers)
892
    {
893
    return 5;
894
    }
895

    
896
///////////////////////////////////////////////////////////////////////////////////////////////////
897

    
898
  public int getCubitVariant(int cubit, int[] numLayers)
899
    {
900
    if( cubit< 8 ) return 0;
901
    if( cubit<20 ) return 1;
902
    if( cubit<26 ) return 2;
903
    if( cubit<50 ) return 3;
904

    
905
    return 4;
906
    }
907

    
908
///////////////////////////////////////////////////////////////////////////////////////////////////
909

    
910
  public float getStickerRadius()
911
    {
912
    return 0.07f;
913
    }
914

    
915
///////////////////////////////////////////////////////////////////////////////////////////////////
916

    
917
  public float getStickerStroke()
918
    {
919
    return isInIconMode() ? 0.22f : 0.12f;
920
    }
921

    
922
///////////////////////////////////////////////////////////////////////////////////////////////////
923

    
924
  public float[][] getStickerAngles()
925
    {
926
    float D1 = (float)(Math.PI/8);
927
    float D2 = (float)(Math.PI/6);
928
    return new float[][] { { 0,0,0,-D1,0 },{ 0,0,0,-D2 },{0,0,0,0},{ 0,0,0,D2 },{ 0,0,D1 } };
929
    }
930

    
931
///////////////////////////////////////////////////////////////////////////////////////////////////
932
// PUBLIC API
933

    
934
  public Static3D[] getRotationAxis()
935
    {
936
    return ROT_AXIS;
937
    }
938

    
939
///////////////////////////////////////////////////////////////////////////////////////////////////
940

    
941
  public int[][] getBasicAngles()
942
    {
943
    if( mBasicAngle==null )
944
      {
945
      int[] tmp = new int[] {4,4,4};
946
      mBasicAngle = new int[][] { tmp,tmp,tmp };
947
      }
948

    
949
    return mBasicAngle;
950
    }
951

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

    
954
  public String getShortName()
955
    {
956
    int param = getInitData().getParam();
957

    
958
    switch(param)
959
      {
960
      case CRAZY  : return ObjectType.CRA1_3.name();
961
      case MERCURY: return ObjectType.CRA2_3.name();
962
      case VENUS  : return ObjectType.CRA3_3.name();
963
      case EARTH  : return ObjectType.CRA4_3.name();
964
      case MARS   : return ObjectType.CRA5_3.name();
965
      case JUPITER: return ObjectType.CRA6_3.name();
966
      case SATURN : return ObjectType.CRA7_3.name();
967
      case URANUS : return ObjectType.CRA8_3.name();
968
      case NEPTUNE: return ObjectType.CRA9_3.name();
969
      }
970

    
971
    return null;
972
    }
973

    
974
///////////////////////////////////////////////////////////////////////////////////////////////////
975

    
976
  public ObjectSignature getSignature()
977
    {
978
    int param = getInitData().getParam();
979

    
980
    switch(param)
981
      {
982
      case CRAZY  : return new ObjectSignature(ObjectType.CRA1_3);
983
      case MERCURY: return new ObjectSignature(ObjectType.CRA2_3);
984
      case VENUS  : return new ObjectSignature(ObjectType.CRA3_3);
985
      case EARTH  : return new ObjectSignature(ObjectType.CRA4_3);
986
      case MARS   : return new ObjectSignature(ObjectType.CRA5_3);
987
      case JUPITER: return new ObjectSignature(ObjectType.CRA6_3);
988
      case SATURN : return new ObjectSignature(ObjectType.CRA7_3);
989
      case URANUS : return new ObjectSignature(ObjectType.CRA8_3);
990
      case NEPTUNE: return new ObjectSignature(ObjectType.CRA9_3);
991
      }
992

    
993
    return null;
994
    }
995

    
996
///////////////////////////////////////////////////////////////////////////////////////////////////
997

    
998
  public String getObjectName()
999
    {
1000
    int param = getInitData().getParam();
1001

    
1002
    switch(param)
1003
      {
1004
      case CRAZY  : return "Circle 3x3";
1005
      case MERCURY: return "Crazy Plus Mercury";
1006
      case VENUS  : return "Crazy Plus Venus";
1007
      case EARTH  : return "Crazy Plus Earth";
1008
      case MARS   : return "Crazy Plus Mars";
1009
      case JUPITER: return "Crazy Plus Jupiter";
1010
      case SATURN : return "Crazy Plus Saturn";
1011
      case URANUS : return "Crazy Plus Uranus";
1012
      case NEPTUNE: return "Crazy Plus Neptune";
1013
      }
1014

    
1015
    return null;
1016
    }
1017

    
1018
///////////////////////////////////////////////////////////////////////////////////////////////////
1019

    
1020
  public String getInventor()
1021
    {
1022

    
1023
    return getInitData().getParam()==CRAZY ? "Aleh Hladzilin" : "Daqing Bao";
1024
    }
1025

    
1026
///////////////////////////////////////////////////////////////////////////////////////////////////
1027

    
1028
  public int getYearOfInvention()
1029
    {
1030
    return getInitData().getParam()==CRAZY ? 2008 : 2010;
1031
    }
1032

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

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

    
1039
    switch(param)
1040
      {
1041
      case CRAZY  : return 2;
1042
      case MERCURY: return 4;
1043
      case VENUS  : return 4;
1044
      case EARTH  : return 4;
1045
      case MARS   : return 4;
1046
      case JUPITER: return 3;
1047
      case SATURN : return 4;
1048
      case URANUS : return 3;
1049
      case NEPTUNE: return 4;
1050
      }
1051

    
1052
    return 2;
1053
    }
1054

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

    
1057
  public String[][] getTutorials()
1058
    {
1059
    int param = getInitData().getParam();
1060

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

    
1221
    return null;
1222
    }
1223
}
(5-5/36)