Project

General

Profile

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

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

1
///////////////////////////////////////////////////////////////////////////////////////////////////
2
// Copyright 2022 Leszek Koltunski                                                               //
3
//                                                                                               //
4
// This file is part of Magic Cube.                                                              //
5
//                                                                                               //
6
// Magic Cube is free software: you can redistribute it and/or modify                            //
7
// it under the terms of the GNU General Public License as published by                          //
8
// the Free Software Foundation, either version 2 of the License, or                             //
9
// (at your option) any later version.                                                           //
10
//                                                                                               //
11
// Magic Cube is distributed in the hope that it will be useful,                                 //
12
// but WITHOUT ANY WARRANTY; without even the implied warranty of                                //
13
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the                                 //
14
// GNU General Public License for more details.                                                  //
15
//                                                                                               //
16
// You should have received a copy of the GNU General Public License                             //
17
// along with Magic Cube.  If not, see <http://www.gnu.org/licenses/>.                           //
18
///////////////////////////////////////////////////////////////////////////////////////////////////
19

    
20
package org.distorted.objectlib.objects;
21

    
22
import java.io.InputStream;
23

    
24
import org.distorted.library.type.Static3D;
25
import org.distorted.library.type.Static4D;
26
import org.distorted.objectlib.helpers.ObjectFaceShape;
27
import org.distorted.objectlib.helpers.ObjectShape;
28
import org.distorted.objectlib.helpers.ObjectSignature;
29
import org.distorted.objectlib.helpers.ObjectStickerOverride;
30
import org.distorted.objectlib.main.Cubit;
31
import org.distorted.objectlib.main.InitData;
32
import org.distorted.objectlib.main.ObjectType;
33
import org.distorted.objectlib.main.ShapeHexahedron;
34
import org.distorted.objectlib.scrambling.ScrambleState;
35
import org.distorted.objectlib.touchcontrol.TouchControlHexahedron;
36

    
37
import static org.distorted.objectlib.touchcontrol.TouchControl.TC_HEXAHEDRON;
38
import static org.distorted.objectlib.touchcontrol.TouchControl.TYPE_NOT_SPLIT;
39

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

    
42
public class TwistyCrazy3x3 extends ShapeHexahedron
43
{
44
  public static final int CRAZY   = 0x3f;
45
  public static final int MERCURY = 0x2f;
46
  public static final int VENUS   = 0x0f;
47
  public static final int EARTH   = 0x2b;
48
  public static final int MARS    = 0x0b;
49
  public static final int JUPITER = 0x10;
50
  public static final int SATURN  = 0x30;
51
  public static final int URANUS  = 0x14;
52
  public static final int NEPTUNE = 0x16;
53

    
54
  private static final float DIAMETER_RATIO = 0.75f;
55
  private static final float DIFF = 0.6f;
56
  private static final int NUMBER_CORNER_SEGMENTS = 4;
57
  private static final int NUMBER_EDGE_SEGMENTS = 4;
58

    
59
  static final Static3D[] ROT_AXIS = new Static3D[]
60
         {
61
           new Static3D(1,0,0),
62
           new Static3D(0,1,0),
63
           new Static3D(0,0,1)
64
         };
65

    
66
  private ScrambleState[] mStates;
67
  private int[][] mBasicAngle;
68
  private float[][] mCuts;
69
  private float[][] mPositions;
70
  private int[] mQuatIndex;
71
  private float[][] mOffsets;
72

    
73
///////////////////////////////////////////////////////////////////////////////////////////////////
74

    
75
  public TwistyCrazy3x3(InitData data, int meshState, int iconMode, Static4D quat, Static3D move, float scale, InputStream stream)
76
    {
77
    super(data, meshState, iconMode, data.getNumLayers()[0], quat, move, scale, stream);
78
    }
79

    
80
///////////////////////////////////////////////////////////////////////////////////////////////////
81

    
82
  @Override
83
  public void adjustStickerCoords()
84
    {
85
    final float A = 0.3645522f;
86
    final float B = 0.0744520f;
87
    final float C = 0.1823852f;
88
    final float D = 0.3098326f;
89
    final float E = 0.1033291f;
90
    final float F = 0.4044531f;
91
    final float G = 0.4103489f;
92

    
93
    mStickerCoords = new float[][]
94
      {
95
         { A, 0.5f, -0.5f, 0.5f, -0.5f, -A, -B, -A, A, B },
96
         { 0.5f, -C, 0.5f, D, -0.5f, D, -0.5f, -C },
97
         { -0.5f, -0.5f, 0.5f, -0.5f, 0.5f, 0.5f, -0.5f, 0.5f },
98
         { -0.5f, E, -0.5f, -F, 0.5f, -F, 0.5f, E },
99
         { -G, 0.5f, -G, -G, 0.5f, -G }
100
      };
101
    }
102

    
103

    
104
///////////////////////////////////////////////////////////////////////////////////////////////////
105

    
106
  @Override
107
  public ObjectStickerOverride[] getStickerOverrides()
108
    {
109
    ObjectStickerOverride[] overrides = new ObjectStickerOverride[6];
110

    
111
    for(int i=0; i<6; i++)
112
      {
113
      int cubit = 20+i;
114
      float[] offset = getCubitRowOffset(cubit);
115
      float isX = offset[0]*offset[0]+offset[1]*offset[1]+offset[2]*offset[2];
116
      overrides[i] = new ObjectStickerOverride(cubit,6,isX==0 ? 0xff0f0000 : 0xff000000 );
117
      }
118

    
119
    return overrides;
120
    }
121

    
122
///////////////////////////////////////////////////////////////////////////////////////////////////
123

    
124
  @Override
125
  public int getCubitRotationType(int cubit)
126
    {
127
    int[] numLayers = getNumLayers();
128
    int variant = getCubitVariant(cubit,numLayers);
129

    
130
    switch(variant)
131
      {
132
      case  2: return Cubit.TYPE_DECIDER;
133
      case  3:
134
      case  4: return Cubit.TYPE_FOLLOWER;
135
      default: return Cubit.TYPE_NORMAL;
136
      }
137
    }
138

    
139
///////////////////////////////////////////////////////////////////////////////////////////////////
140

    
141
  @Override
142
  public float[] getCubitRowOffset(int cubitIndex)
143
    {
144
    if( mOffsets==null )
145
      {
146
      float[] tmp = new float[] {0,0,0};
147
      int numCubits = mPositions.length;
148
      mOffsets = new float[numCubits][];
149

    
150
      int param = getInitData().getParam();
151

    
152
      int R = (param>>5)&0x1;
153
      int L = (param>>4)&0x1;
154
      int U = (param>>3)&0x1;
155
      int D = (param>>2)&0x1;
156
      int F = (param>>1)&0x1;
157
      int B = (param   )&0x1;
158

    
159
      for(int i=0; i<numCubits; i++)
160
        {
161
        switch(i)
162
          {
163
          case 20: mOffsets[i] = new float[] {0,0,-DIFF*F}; break;
164
          case 21: mOffsets[i] = new float[] {0,0,+DIFF*B}; break;
165
          case 22: mOffsets[i] = new float[] {0,-DIFF*U,0}; break;
166
          case 23: mOffsets[i] = new float[] {0,+DIFF*D,0}; break;
167
          case 24: mOffsets[i] = new float[] {-DIFF*R,0,0}; break;
168
          case 25: mOffsets[i] = new float[] {+DIFF*L,0,0}; break;
169
          default: mOffsets[i] = tmp;
170
          }
171
        }
172
      }
173

    
174
    return mOffsets[cubitIndex];
175
    }
176

    
177
///////////////////////////////////////////////////////////////////////////////////////////////////
178
// Normal 3x3
179

    
180
  public ScrambleState[] getScrambleStates()
181
    {
182
    if( mStates==null )
183
      {
184
      int[][] m = new int[16][];
185

    
186
      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};
187

    
188
      mStates = new ScrambleState[]
189
          {
190
          new ScrambleState( new int[][] { m[ 1], m[ 2], m[ 3] } ),  //  0 0
191
          new ScrambleState( new int[][] {  null, m[ 4], m[ 5] } ),  //  1 x
192
          new ScrambleState( new int[][] { m[ 6],  null, m[ 7] } ),  //  2 y
193
          new ScrambleState( new int[][] { m[ 8], m[ 9],  null } ),  //  3 z
194
          new ScrambleState( new int[][] { m[10],  null, m[ 7] } ),  //  4 xy
195
          new ScrambleState( new int[][] { m[11], m[ 9],  null } ),  //  5 xz
196
          new ScrambleState( new int[][] {  null, m[12], m[ 5] } ),  //  6 yx
197
          new ScrambleState( new int[][] { m[ 8], m[13],  null } ),  //  7 yz
198
          new ScrambleState( new int[][] {  null, m[ 4], m[14] } ),  //  8 zx
199
          new ScrambleState( new int[][] { m[ 6],  null, m[15] } ),  //  9 zy
200
          new ScrambleState( new int[][] {  null,  null, m[ 5] } ),  // 10 xyx
201
          new ScrambleState( new int[][] {  null, m[ 4],  null } ),  // 11 xzx
202
          new ScrambleState( new int[][] {  null,  null, m[ 7] } ),  // 12 yxy
203
          new ScrambleState( new int[][] { m[ 6],  null,  null } ),  // 13 yzy
204
          new ScrambleState( new int[][] {  null, m[ 9],  null } ),  // 14 zxz
205
          new ScrambleState( new int[][] { m[ 8],  null,  null } ),  // 15 zyz
206
          };
207
      }
208

    
209
    return mStates;
210
    }
211

    
212
///////////////////////////////////////////////////////////////////////////////////////////////////
213

    
214
  public float[][] getCuts(int[] numLayers)
215
    {
216
    if( mCuts==null )
217
      {
218
      float C = 0.5f;
219
      float[] cut = new float[] {-C,+C};
220
      mCuts = new float[][] { cut,cut,cut };
221
      }
222

    
223
    return mCuts;
224
    }
225

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

    
228
  public boolean[][] getLayerRotatable(int[] numLayers)
229
    {
230
    boolean[] tmp = new boolean[] {true,true,true};
231
    return new boolean[][] { tmp,tmp,tmp };
232
    }
233

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

    
236
  public int getTouchControlType()
237
    {
238
    return TC_HEXAHEDRON;
239
    }
240

    
241
///////////////////////////////////////////////////////////////////////////////////////////////////
242

    
243
  public int getTouchControlSplit()
244
    {
245
    return TYPE_NOT_SPLIT;
246
    }
247

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

    
250
  public int[][][] getEnabled()
251
    {
252
    return new int[][][] { {{1,2}},{{1,2}},{{0,2}},{{0,2}},{{0,1}},{{0,1}} };
253
    }
254

    
255
///////////////////////////////////////////////////////////////////////////////////////////////////
256

    
257
  public float[] getDist3D(int[] numLayers)
258
    {
259
    return TouchControlHexahedron.D3D;
260
    }
261

    
262
///////////////////////////////////////////////////////////////////////////////////////////////////
263

    
264
  public Static3D[] getFaceAxis()
265
    {
266
    return TouchControlHexahedron.FACE_AXIS;
267
    }
268

    
269
///////////////////////////////////////////////////////////////////////////////////////////////////
270

    
271
  public float[][] getCubitPositions(int[] numLayers)
272
    {
273
    if( mPositions==null )
274
      {
275
      mPositions = new float[][]
276
         {
277
             { 1.0f, 1.0f, 1.0f},
278
             { 1.0f, 1.0f,-1.0f},
279
             { 1.0f,-1.0f, 1.0f},
280
             { 1.0f,-1.0f,-1.0f},
281
             {-1.0f, 1.0f, 1.0f},
282
             {-1.0f, 1.0f,-1.0f},
283
             {-1.0f,-1.0f, 1.0f},
284
             {-1.0f,-1.0f,-1.0f},
285

    
286
             { 1.0f, 1.0f, 0.0f},
287
             { 1.0f,-1.0f, 0.0f},
288
             { 1.0f, 0.0f, 1.0f},
289
             { 1.0f, 0.0f,-1.0f},
290
             {-1.0f, 1.0f, 0.0f},
291
             {-1.0f,-1.0f, 0.0f},
292
             {-1.0f, 0.0f, 1.0f},
293
             {-1.0f, 0.0f,-1.0f},
294
             { 0.0f, 1.0f, 1.0f},
295
             { 0.0f, 1.0f,-1.0f},
296
             { 0.0f,-1.0f, 1.0f},
297
             { 0.0f,-1.0f,-1.0f},
298

    
299
             { 0.0f, 0.0f, DIFF},
300
             { 0.0f, 0.0f,-DIFF},
301
             { 0.0f, DIFF, 0.0f},
302
             { 0.0f,-DIFF, 0.0f},
303
             { DIFF, 0.0f, 0.0f},
304
             {-DIFF, 0.0f, 0.0f},
305

    
306
             { 0.0f, 1.0f, DIFF},
307
             {-DIFF, 1.0f, 0.0f},
308
             { 0.0f, 1.0f,-DIFF},
309
             { DIFF, 1.0f, 0.0f},
310
             { 0.0f,-1.0f, DIFF},
311
             {-DIFF,-1.0f, 0.0f},
312
             { 0.0f,-1.0f,-DIFF},
313
             { DIFF,-1.0f, 0.0f},
314
             { DIFF, 0.0f, 1.0f},
315
             { 0.0f,-DIFF, 1.0f},
316
             {-DIFF, 0.0f, 1.0f},
317
             { 0.0f, DIFF, 1.0f},
318
             { DIFF, 0.0f,-1.0f},
319
             { 0.0f,-DIFF,-1.0f},
320
             {-DIFF, 0.0f,-1.0f},
321
             { 0.0f, DIFF,-1.0f},
322
             { 1.0f, DIFF, 0.0f},
323
             { 1.0f, 0.0f,-DIFF},
324
             { 1.0f,-DIFF, 0.0f},
325
             { 1.0f, 0.0f, DIFF},
326
             {-1.0f, DIFF, 0.0f},
327
             {-1.0f, 0.0f,-DIFF},
328
             {-1.0f,-DIFF, 0.0f},
329
             {-1.0f, 0.0f, DIFF},
330

    
331
             { 1.0f, 1.0f, DIFF},
332
             { 1.0f, 1.0f,-DIFF},
333
             { 1.0f,-1.0f, DIFF},
334
             { 1.0f,-1.0f,-DIFF},
335
             {-1.0f, 1.0f, DIFF},
336
             {-1.0f, 1.0f,-DIFF},
337
             {-1.0f,-1.0f, DIFF},
338
             {-1.0f,-1.0f,-DIFF},
339
             { 1.0f, DIFF, 1.0f},
340
             { 1.0f,-DIFF, 1.0f},
341
             { 1.0f, DIFF,-1.0f},
342
             { 1.0f,-DIFF,-1.0f},
343
             {-1.0f, DIFF, 1.0f},
344
             {-1.0f,-DIFF, 1.0f},
345
             {-1.0f, DIFF,-1.0f},
346
             {-1.0f,-DIFF,-1.0f},
347
             { DIFF, 1.0f, 1.0f},
348
             {-DIFF, 1.0f, 1.0f},
349
             { DIFF, 1.0f,-1.0f},
350
             {-DIFF, 1.0f,-1.0f},
351
             { DIFF,-1.0f, 1.0f},
352
             {-DIFF,-1.0f, 1.0f},
353
             { DIFF,-1.0f,-1.0f},
354
             {-DIFF,-1.0f,-1.0f},
355
         };
356
      }
357

    
358
    return mPositions;
359
    }
360

    
361
///////////////////////////////////////////////////////////////////////////////////////////////////
362

    
363
  public Static4D getCubitQuats(int cubit, int[] numLayers)
364
    {
365
    if( mQuatIndex==null ) mQuatIndex = new int[] { 0,1,17,22,4,5,8,19,
366
                                                    6,17,7,12,4,16,9,10,0,5,3,2,
367
                                                    0,2,1,3,6,4,
368
                                                    0,4,5,6, 8,16,2,17, 21,3,20,14, 12,11,10,1, 13,18,22,7, 15,19,23,9,
369
                                                    0,18,7,2, 9,5,8,19, 13,3,1,22, 14,23,15,11, 21,4,6,10, 17,20,12,16 };
370
    return mObjectQuats[mQuatIndex[cubit]];
371
    }
372

    
373
///////////////////////////////////////////////////////////////////////////////////////////////////
374

    
375
  private ObjectShape getCornerShape()
376
    {
377
    final float INIT_ALPHA = (float)Math.asin(1/(3*DIAMETER_RATIO));
378
    final float STEP_CORNER= (float)((Math.PI/2-2*INIT_ALPHA)/NUMBER_CORNER_SEGMENTS);
379
    final int SINGLE_ARC = NUMBER_CORNER_SEGMENTS+1;
380
    final int SINGLE_INNER_ARC = (NUMBER_CORNER_SEGMENTS+1)/2;
381
    final int NUM_VERTICES = 4 + 3*SINGLE_ARC + 1 + 3*SINGLE_INNER_ARC;
382
    float[][] tmp = new float[SINGLE_ARC][2];
383

    
384
    for(int i=0; i<SINGLE_ARC; i++)
385
      {
386
      float alpha = INIT_ALPHA + i*STEP_CORNER;
387
      tmp[i][0] = (float)(1.5f*DIAMETER_RATIO*Math.sin(alpha) - 1.0f);
388
      tmp[i][1] = (float)(1.5f*DIAMETER_RATIO*Math.cos(alpha) - 1.0f);
389
      }
390

    
391
    float[][] vertices = new float[NUM_VERTICES][];
392

    
393
    vertices[0] = new float[] { +0.5f, +0.5f, +0.5f };
394
    vertices[1] = new float[] { -0.5f, +0.5f, +0.5f };
395
    vertices[2] = new float[] { +0.5f, -0.5f, +0.5f };
396
    vertices[3] = new float[] { +0.5f, +0.5f, -0.5f };
397

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

    
403
      vertices[4             +i] = new float[] {0.5f,+s,+c};
404
      vertices[4+  SINGLE_ARC+i] = new float[] {+c,0.5f,+s};
405
      vertices[4+2*SINGLE_ARC+i] = new float[] {+s,+c,0.5f};
406
      }
407

    
408
    final float EXTRA = (NUMBER_CORNER_SEGMENTS%2)==0 ? 1.0f : (float)Math.cos((Math.PI/2-2*INIT_ALPHA)/(2*NUMBER_CORNER_SEGMENTS));
409
    final float LEN = 1.5f*DIAMETER_RATIO*EXTRA;
410
    final float M = (float)(LEN*Math.sin(Math.PI/4) - 1.0f);
411
    vertices[4+3*SINGLE_ARC] = new float[] {M,M,M};
412

    
413
    for(int i=0; i<SINGLE_INNER_ARC; i++)
414
      {
415
      float s = tmp[i][0];
416
      float c = tmp[i][1];
417

    
418
      vertices[4+3*SINGLE_ARC+1                   +i] = new float[] {s,c,c};
419
      vertices[4+3*SINGLE_ARC+1+  SINGLE_INNER_ARC+i] = new float[] {c,s,c};
420
      vertices[4+3*SINGLE_ARC+1+2*SINGLE_INNER_ARC+i] = new float[] {c,c,s};
421
      }
422

    
423
    final int NUM_FACES = 6 + 3*NUMBER_CORNER_SEGMENTS;
424
    final int NUM_VERTS = 4 +   NUMBER_CORNER_SEGMENTS;
425

    
426
    int[][] indices = new int[NUM_FACES][];
427

    
428
    indices[0] = new int[NUM_VERTS];
429
    indices[1] = new int[NUM_VERTS];
430
    indices[2] = new int[NUM_VERTS];
431

    
432
    indices[0][0] = 3;
433
    indices[0][1] = 0;
434
    indices[0][2] = 2;
435
    indices[1][0] = 1;
436
    indices[1][1] = 0;
437
    indices[1][2] = 3;
438
    indices[2][0] = 2;
439
    indices[2][1] = 0;
440
    indices[2][2] = 1;
441

    
442
    for(int i=0; i<SINGLE_ARC; i++)
443
      {
444
      indices[0][3+i] = 4+i;
445
      indices[1][3+i] = 4+i+  SINGLE_ARC;
446
      indices[2][3+i] = 4+i+2*SINGLE_ARC;
447
      }
448

    
449
    indices[3] = new int[] { 1, 4+2*SINGLE_ARC-1, 4+3*SINGLE_ARC+1                   , 4+2*SINGLE_ARC};
450
    indices[4] = new int[] { 2, 4+3*SINGLE_ARC-1, 4+3*SINGLE_ARC+1+  SINGLE_INNER_ARC, 4             };
451
    indices[5] = new int[] { 3, 4+  SINGLE_ARC-1, 4+3*SINGLE_ARC+1+2*SINGLE_INNER_ARC, 4+  SINGLE_ARC};
452

    
453
    int start,i0,i1,i2,i3;
454
    int MID = (NUMBER_CORNER_SEGMENTS)/2;
455
    int MID2= (NUMBER_CORNER_SEGMENTS+1)/2;
456

    
457
    if( (NUMBER_CORNER_SEGMENTS%2) == 0 )
458
      {
459
      start = 12;
460
      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};
461
      indices[ 7] = new int[] { 4+3*SINGLE_ARC, 4+3*SINGLE_ARC+1+MID-1,  4+SINGLE_ARC+MID+1, 4+SINGLE_ARC+MID};
462
      indices[ 8] = new int[] { 4+3*SINGLE_ARC, 4+3*SINGLE_ARC+1+2*SINGLE_INNER_ARC+MID-1, 4+MID+1, 4+MID };
463
      indices[ 9] = new int[] { 4+3*SINGLE_ARC, 4+MID, 4+MID-1, 4+3*SINGLE_ARC+1+SINGLE_INNER_ARC+MID-1 };
464
      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 };
465
      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 };
466
      }
467
    else
468
      {
469
      start = 9;
470
      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};
471
      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};
472
      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};
473
      }
474

    
475
    for(int j=0; j<MID2-1; j++)
476
      {
477
      i0 = 4+3*SINGLE_ARC+1+2*SINGLE_INNER_ARC+j;
478
      i1 = 4+3*SINGLE_ARC+1+2*SINGLE_INNER_ARC+j+1;
479
      i2 = 4+SINGLE_ARC+j+1;
480
      i3 = 4+SINGLE_ARC+j;
481

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

    
484
      i0 = 4+3*SINGLE_ARC+1+2*SINGLE_INNER_ARC+j+1;
485
      i1 = 4+3*SINGLE_ARC+1+2*SINGLE_INNER_ARC+j;
486
      i2 = 4+(SINGLE_ARC-1)-j;
487
      i3 = 4+(SINGLE_ARC-1)-(j+1);
488

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

    
491
      i0 = 4+3*SINGLE_ARC+1+j;
492
      i1 = 4+3*SINGLE_ARC+1+j+1;
493
      i2 = 4+2*SINGLE_ARC+j+1;
494
      i3 = 4+2*SINGLE_ARC+j;
495

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

    
498
      i0 = 4+3*SINGLE_ARC+1+j+1;
499
      i1 = 4+3*SINGLE_ARC+1+j;
500
      i2 = 4+(2*SINGLE_ARC-1)-j;
501
      i3 = 4+(2*SINGLE_ARC-1)-(j+1);
502

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

    
505
      i0 = 4+3*SINGLE_ARC+1+SINGLE_INNER_ARC+j;
506
      i1 = 4+3*SINGLE_ARC+1+SINGLE_INNER_ARC+j+1;
507
      i2 = 4+j+1;
508
      i3 = 4+j;
509

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

    
512
      i0 = 4+3*SINGLE_ARC+1+SINGLE_INNER_ARC+j+1;
513
      i1 = 4+3*SINGLE_ARC+1+SINGLE_INNER_ARC+j;
514
      i2 = 4+(3*SINGLE_ARC-1)-j;
515
      i3 = 4+(3*SINGLE_ARC-1)-(j+1);
516

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

    
520
    return new ObjectShape(vertices,indices);
521
    }
522

    
523
///////////////////////////////////////////////////////////////////////////////////////////////////
524

    
525
  private ObjectShape getEdgeShape()
526
    {
527
    final int NUM_VERTICES = 8 + 3*(NUMBER_EDGE_SEGMENTS-1);
528
    final float INIT_ALPHA = (float)Math.asin(1/(3*DIAMETER_RATIO));
529
    final float H = 0.5f*((float)Math.sqrt(9*DIAMETER_RATIO*DIAMETER_RATIO-1))-1.0f;
530
    float[][] vertices = new float[NUM_VERTICES][];
531

    
532
    vertices[0] = new float[] {-0.5f,+0.5f,+0.5f};
533
    vertices[1] = new float[] {+0.5f,+0.5f,+0.5f};
534
    vertices[2] = new float[] {-0.5f,    H,+0.5f};
535
    vertices[3] = new float[] {+0.5f,    H,+0.5f};
536
    vertices[4] = new float[] {-0.5f,+0.5f,    H};
537
    vertices[5] = new float[] {+0.5f,+0.5f,    H};
538
    vertices[6] = new float[] {-0.5f,    H,    H};
539
    vertices[7] = new float[] {+0.5f,    H,    H};
540

    
541
    final int NUM_VERTS = NUMBER_EDGE_SEGMENTS-1;
542
    for(int i=0; i<NUM_VERTS; i++)
543
      {
544
      float beta = INIT_ALPHA*((2.0f*(i+1))/NUMBER_EDGE_SEGMENTS -1 );
545
      float A = (float)(1.5f*DIAMETER_RATIO*Math.sin(beta));
546
      float B = (float)(1.5f*DIAMETER_RATIO*Math.cos(beta)-1.0f);
547
      vertices[8            +i] = new float[] {A,B,0.5f};
548
      vertices[8+  NUM_VERTS+i] = new float[] {A,0.5f,B};
549
      vertices[8+2*NUM_VERTS+i] = new float[] {A,B,B};
550
      }
551

    
552
    final int NUM_FACES = 4 + 2*NUMBER_EDGE_SEGMENTS;
553
    int[][] indices = new int[NUM_FACES][];
554

    
555
    int NUMV = 3+NUMBER_EDGE_SEGMENTS;
556

    
557
    indices[0] = new int[NUMV];
558
    indices[0][0] = 3;
559
    indices[0][1] = 1;
560
    indices[0][2] = 0;
561
    indices[0][3] = 2;
562
    for(int i=0; i<NUM_VERTS; i++) indices[0][4+i] = 8+i;
563

    
564
    indices[1] = new int[NUMV];
565
    indices[1][0] = 4;
566
    indices[1][1] = 0;
567
    indices[1][2] = 1;
568
    indices[1][3] = 5;
569
    for(int i=0; i<NUM_VERTS; i++) indices[1][4+i] = 7+2*NUM_VERTS-i;
570

    
571
    indices[2] = new int[] {5,1,3,7};
572
    indices[3] = new int[] {0,4,6,2};
573
    indices[4] = new int[] {8,2,6,8+2*NUM_VERTS};
574
    indices[5] = new int[] {3,7+NUM_VERTS,7+3*NUM_VERTS,7};
575
    indices[6] = new int[] {6,4,8+NUM_VERTS,8+2*NUM_VERTS};
576
    indices[7] = new int[] {5,7,7+3*NUM_VERTS,7+2*NUM_VERTS};
577

    
578
    int i0,i1,i2,i3;
579

    
580
    for(int i=0; i<NUMBER_EDGE_SEGMENTS-2; i++)
581
      {
582
      i0 = 9+i;
583
      i1 = 8+i;
584
      i2 = 8+2*NUM_VERTS+i;
585
      i3 = 9+2*NUM_VERTS+i;
586

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

    
589
      i0 = 9+2*NUM_VERTS+i;
590
      i1 = 8+2*NUM_VERTS+i;
591
      i2 = 8+NUM_VERTS+i;
592
      i3 = 9+NUM_VERTS+i;
593

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

    
597
    return new ObjectShape(vertices,indices);
598
    }
599

    
600
///////////////////////////////////////////////////////////////////////////////////////////////////
601

    
602
  private ObjectShape getCenterShape(float D)
603
    {
604
    final float A = 0.1f;
605
    final float B = 0.2f;
606
    final float C = 0.55f+D;
607

    
608
    float[][] vertices = new float[][]
609
        {
610
            {-0.5f,-0.5f,-0.5f+D},
611
            {-0.5f,-0.5f,+0.5f+D},
612
            {-0.5f,+0.5f,-0.5f+D},
613
            {-0.5f,+0.5f,+0.5f+D},
614
            {+0.5f,-0.5f,-0.5f+D},
615
            {+0.5f,-0.5f,+0.5f+D},
616
            {+0.5f,+0.5f,-0.5f+D},
617
            {+0.5f,+0.5f,+0.5f+D},
618

    
619
            {   0,-A  , C},
620
            {   B,-A-B, C},
621
            { A+B,  -B, C},
622
            { A  ,   0, C},
623
            { A+B,   B, C},
624
            {   B, A+B, C},
625
            {   0, A  , C},
626
            {  -B, A+B, C},
627
            {-A-B,   B, C},
628
            {-A  ,   0, C},
629
            {-A-B,  -B, C},
630
            {  -B,-A-B, C},
631
        };
632

    
633
    int[][] indices = new int[][]
634
        {
635
            {1,5,7,3},
636
            {5,4,6,7},
637
            {0,1,3,2},
638
            {3,7,6,2},
639
            {0,4,5,1},
640
            {4,0,2,6},
641

    
642
            {8,9,10,11,12,13,14,15,16,17,18,19}
643
        };
644

    
645
    return new ObjectShape(vertices,indices);
646
    }
647

    
648
///////////////////////////////////////////////////////////////////////////////////////////////////
649

    
650
  private ObjectShape getBigCircleShape(float D)
651
    {
652
    final float INIT_ALPHA = (float)Math.asin(1/(3*DIAMETER_RATIO));
653
    final float H = 0.5f*((float)Math.sqrt(9*DIAMETER_RATIO*DIAMETER_RATIO-1))-1.0f;
654
    final int NUM_VERTICES = 8 + 2*(NUMBER_EDGE_SEGMENTS-1);
655
    float[][] vertices = new float[NUM_VERTICES][];
656

    
657
    vertices[0] = new float[] {-0.5f,-0.5f,+0.5f+D};
658
    vertices[1] = new float[] {-0.5f,-0.5f,-0.5f+D};
659
    vertices[2] = new float[] {+0.5f,-0.5f,+0.5f+D};
660
    vertices[3] = new float[] {+0.5f,-0.5f,-0.5f+D};
661
    vertices[4] = new float[] {-0.5f,    H,+0.5f+D};
662
    vertices[5] = new float[] {-0.5f,    H,-0.5f+D};
663
    vertices[6] = new float[] {+0.5f,    H,+0.5f+D};
664
    vertices[7] = new float[] {+0.5f,    H,-0.5f+D};
665

    
666
    final int NUM_VERTS = NUMBER_EDGE_SEGMENTS-1;
667
    for(int i=0; i<NUM_VERTS; i++)
668
      {
669
      float beta = INIT_ALPHA*((2.0f*(i+1))/NUMBER_EDGE_SEGMENTS -1 );
670
      float A = (float)(1.5f*DIAMETER_RATIO*Math.sin(beta));
671
      float B = (float)(1.5f*DIAMETER_RATIO*Math.cos(beta)-1.0f);
672
      vertices[8          +i] = new float[] {A,B,+0.5f+D};
673
      vertices[8+NUM_VERTS+i] = new float[] {A,B,-0.5f+D};
674
      }
675

    
676
    final int NUM_FACES = 5 + NUMBER_EDGE_SEGMENTS;
677
    int[][] indices = new int[NUM_FACES][];
678

    
679
    int NUMV = 4+NUM_VERTS;
680
    indices[0] = new int[NUMV];
681
    indices[0][0] = 4;
682
    indices[0][1] = 0;
683
    indices[0][2] = 2;
684
    indices[0][3] = 6;
685
    for(int i=0; i<NUM_VERTS; i++) indices[0][4+i] = 7+NUM_VERTS-i;
686

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

    
694
    indices[2] = new int[] {7,3,2,6};
695
    indices[3] = new int[] {4,0,1,5};
696
    indices[4] = new int[] {1,3,2,0};
697

    
698
    indices[5] = new int[] {5,4,8,8+NUM_VERTS};
699
    indices[6] = new int[] {7+NUM_VERTS,6,7,7+2*NUM_VERTS};
700

    
701
    for(int i=0; i<NUMBER_EDGE_SEGMENTS-2; i++)
702
      {
703
      int i0 = 8+i;
704
      int i1 = 9+i;
705
      int i2 = 9+NUM_VERTS+i;
706
      int i3 = 8+NUM_VERTS+i;
707

    
708
      indices[7+i] = new int[] {i0,i1,i2,i3};
709
      }
710

    
711
    return new ObjectShape(vertices,indices);
712
    }
713

    
714
///////////////////////////////////////////////////////////////////////////////////////////////////
715

    
716
  private ObjectShape getSmallCircleShape(float D)
717
    {
718
    final float H = 0.5f*((float)Math.sqrt(9*DIAMETER_RATIO*DIAMETER_RATIO-1))-1.0f;
719
    final float INIT_ALPHA = (float)Math.asin(1/(3*DIAMETER_RATIO));
720
    final float STEP_CORNER= (float)((Math.PI/2-2*INIT_ALPHA)/NUMBER_CORNER_SEGMENTS);
721
    final int NUM_VERTICES = 6 + 2*(NUMBER_CORNER_SEGMENTS-1);
722
    float[][] vertices = new float[NUM_VERTICES][];
723

    
724
    vertices[0] = new float[] {-0.5f,    H, 0.5f+D};
725
    vertices[1] = new float[] {    H,-0.5f, 0.5f+D};
726
    vertices[2] = new float[] {-0.5f,-0.5f, 0.5f+D};
727
    vertices[3] = new float[] {-0.5f,    H,-0.5f+D};
728
    vertices[4] = new float[] {    H,-0.5f,-0.5f+D};
729
    vertices[5] = new float[] {-0.5f,-0.5f,-0.5f+D};
730

    
731
    for(int i=0; i<NUMBER_CORNER_SEGMENTS-1; i++)
732
      {
733
      float alpha = INIT_ALPHA + (i+1)*STEP_CORNER;
734
      float A = (float)(1.5f*DIAMETER_RATIO*Math.sin(alpha) - 1.0f);
735
      float B = (float)(1.5f*DIAMETER_RATIO*Math.cos(alpha) - 1.0f);
736

    
737
      vertices[6                       +i] = new float[] {A,B, 0.5f+D};
738
      vertices[5+NUMBER_CORNER_SEGMENTS+i] = new float[] {A,B,-0.5f+D};
739
      }
740

    
741
    final int NUM_FACES = 4 + NUMBER_CORNER_SEGMENTS;
742
    int[][] indices = new int[NUM_FACES][];
743

    
744
    int NUMV = 2+NUMBER_CORNER_SEGMENTS;
745
    indices[0] = new int[NUMV];
746
    indices[0][0] = 0;
747
    indices[0][1] = 2;
748
    indices[0][2] = 1;
749
    for(int i=3; i<NUMV; i++) indices[0][i] = 5+(NUMBER_CORNER_SEGMENTS-1)-(i-3);
750

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

    
757
    indices[2] = new int[] {0,3,5,2};
758
    indices[3] = new int[] {1,2,5,4};
759

    
760
    indices[4] = new int[] {5+NUMBER_CORNER_SEGMENTS,3,0,6};
761
    indices[5] = new int[] {1,4,5+2*(NUMBER_CORNER_SEGMENTS-1),5+(NUMBER_CORNER_SEGMENTS-1)};
762

    
763
    for(int i=0; i<NUMBER_CORNER_SEGMENTS-2; i++)
764
      {
765
      int i0 = 6+i;
766
      int i1 = 7+i;
767
      int i2 = 6+NUMBER_CORNER_SEGMENTS+i;
768
      int i3 = 5+NUMBER_CORNER_SEGMENTS+i;
769

    
770
      indices[6+i] = new int[] {i0,i1,i2,i3};
771
      }
772

    
773
    return new ObjectShape(vertices,indices);
774
    }
775

    
776
///////////////////////////////////////////////////////////////////////////////////////////////////
777

    
778
  public ObjectShape getObjectShape(int variant)
779
    {
780
    switch(variant)
781
      {
782
      case 0: return getCornerShape();
783
      case 1: return getEdgeShape();
784
      case 2: return getCenterShape(1.0f-DIFF);
785
      case 3: return getBigCircleShape(1.0f-DIFF);
786
      case 4: return getSmallCircleShape(1.02f-DIFF);
787
      }
788

    
789
    return null;
790
    }
791

    
792
///////////////////////////////////////////////////////////////////////////////////////////////////
793

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

    
881
///////////////////////////////////////////////////////////////////////////////////////////////////
882

    
883
  public int getNumCubitVariants(int[] numLayers)
884
    {
885
    return 5;
886
    }
887

    
888
///////////////////////////////////////////////////////////////////////////////////////////////////
889

    
890
  public int getCubitVariant(int cubit, int[] numLayers)
891
    {
892
    if( cubit< 8 ) return 0;
893
    if( cubit<20 ) return 1;
894
    if( cubit<26 ) return 2;
895
    if( cubit<50 ) return 3;
896

    
897
    return 4;
898
    }
899

    
900
///////////////////////////////////////////////////////////////////////////////////////////////////
901

    
902
  public float getStickerRadius()
903
    {
904
    return 0.07f;
905
    }
906

    
907
///////////////////////////////////////////////////////////////////////////////////////////////////
908

    
909
  public float getStickerStroke()
910
    {
911
    return isInIconMode() ? 0.22f : 0.12f;
912
    }
913

    
914
///////////////////////////////////////////////////////////////////////////////////////////////////
915

    
916
  public float[][] getStickerAngles()
917
    {
918
    float D1 = (float)(Math.PI/8);
919
    float D2 = (float)(Math.PI/6);
920
    return new float[][] { { 0,0,0,-D1,0 },{ 0,0,0,-D2 },{0,0,0,0},{ 0,0,0,D2 },{ 0,0,D1 } };
921
    }
922

    
923
///////////////////////////////////////////////////////////////////////////////////////////////////
924
// PUBLIC API
925

    
926
  public Static3D[] getRotationAxis()
927
    {
928
    return ROT_AXIS;
929
    }
930

    
931
///////////////////////////////////////////////////////////////////////////////////////////////////
932

    
933
  public int[][] getBasicAngles()
934
    {
935
    if( mBasicAngle==null )
936
      {
937
      int[] tmp = new int[] {4,4,4};
938
      mBasicAngle = new int[][] { tmp,tmp,tmp };
939
      }
940

    
941
    return mBasicAngle;
942
    }
943

    
944
///////////////////////////////////////////////////////////////////////////////////////////////////
945

    
946
  public String getShortName()
947
    {
948
    int param = getInitData().getParam();
949

    
950
    switch(param)
951
      {
952
      case CRAZY  : return ObjectType.CRA1_3.name();
953
      case MERCURY: return ObjectType.CRA2_3.name();
954
      case VENUS  : return ObjectType.CRA3_3.name();
955
      case EARTH  : return ObjectType.CRA4_3.name();
956
      case MARS   : return ObjectType.CRA5_3.name();
957
      case JUPITER: return ObjectType.CRA6_3.name();
958
      case SATURN : return ObjectType.CRA7_3.name();
959
      case URANUS : return ObjectType.CRA8_3.name();
960
      case NEPTUNE: return ObjectType.CRA9_3.name();
961
      }
962

    
963
    return null;
964
    }
965

    
966
///////////////////////////////////////////////////////////////////////////////////////////////////
967

    
968
  public ObjectSignature getSignature()
969
    {
970
    int param = getInitData().getParam();
971

    
972
    switch(param)
973
      {
974
      case CRAZY  : return new ObjectSignature(ObjectType.CRA1_3);
975
      case MERCURY: return new ObjectSignature(ObjectType.CRA2_3);
976
      case VENUS  : return new ObjectSignature(ObjectType.CRA3_3);
977
      case EARTH  : return new ObjectSignature(ObjectType.CRA4_3);
978
      case MARS   : return new ObjectSignature(ObjectType.CRA5_3);
979
      case JUPITER: return new ObjectSignature(ObjectType.CRA6_3);
980
      case SATURN : return new ObjectSignature(ObjectType.CRA7_3);
981
      case URANUS : return new ObjectSignature(ObjectType.CRA8_3);
982
      case NEPTUNE: return new ObjectSignature(ObjectType.CRA9_3);
983
      }
984

    
985
    return null;
986
    }
987

    
988
///////////////////////////////////////////////////////////////////////////////////////////////////
989

    
990
  public String getObjectName()
991
    {
992
    int param = getInitData().getParam();
993

    
994
    switch(param)
995
      {
996
      case CRAZY  : return "Crazy 3x3";
997
      case MERCURY: return "Crazy Plus Mercury";
998
      case VENUS  : return "Crazy Plus Venus";
999
      case EARTH  : return "Crazy Plus Earth";
1000
      case MARS   : return "Crazy Plus Mars";
1001
      case JUPITER: return "Crazy Plus Jupiter";
1002
      case SATURN : return "Crazy Plus Saturn";
1003
      case URANUS : return "Crazy Plus Uranus";
1004
      case NEPTUNE: return "Crazy Plus Neptune";
1005
      }
1006

    
1007
    return null;
1008
    }
1009

    
1010
///////////////////////////////////////////////////////////////////////////////////////////////////
1011

    
1012
  public String getInventor()
1013
    {
1014

    
1015
    return getInitData().getParam()==CRAZY ? "Aleh Hladzilin" : "Daqing Bao";
1016
    }
1017

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

    
1020
  public int getYearOfInvention()
1021
    {
1022
    return getInitData().getParam()==CRAZY ? 2008 : 2010;
1023
    }
1024

    
1025
///////////////////////////////////////////////////////////////////////////////////////////////////
1026

    
1027
  public int getComplexity()
1028
    {
1029
    int param = getInitData().getParam();
1030

    
1031
    switch(param)
1032
      {
1033
      case CRAZY  : return 2;
1034
      case MERCURY: return 4;
1035
      case VENUS  : return 4;
1036
      case EARTH  : return 4;
1037
      case MARS   : return 4;
1038
      case JUPITER: return 3;
1039
      case SATURN : return 4;
1040
      case URANUS : return 3;
1041
      case NEPTUNE: return 4;
1042
      }
1043

    
1044
    return 2;
1045
    }
1046

    
1047
///////////////////////////////////////////////////////////////////////////////////////////////////
1048

    
1049
  public String[][] getTutorials()
1050
    {
1051
    int param = getInitData().getParam();
1052

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

    
1213
    return null;
1214
    }
1215
}
(5-5/36)