Project

General

Profile

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

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

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

    
10
package org.distorted.objectlib.objects;
11

    
12
import java.util.ArrayList;
13

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

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

    
32
///////////////////////////////////////////////////////////////////////////////////////////////////
33

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

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

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

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

    
65
///////////////////////////////////////////////////////////////////////////////////////////////////
66

    
67
  public TwistyCrazy3x3(int iconMode, Static4D quat, Static3D move, float scale, Metadata meta, InitAssets asset)
68
    {
69
    super(iconMode, meta.getNumLayers()[0], quat, move, scale, meta, asset);
70
    }
71

    
72
///////////////////////////////////////////////////////////////////////////////////////////////////
73

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

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

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

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

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

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

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

    
114
    int numOverrides = cubits.size();
115

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

    
129
    return null;
130
    }
131

    
132
///////////////////////////////////////////////////////////////////////////////////////////////////
133

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

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

    
149
///////////////////////////////////////////////////////////////////////////////////////////////////
150

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

    
160
      int param = getMetadata().getParam();
161

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

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

    
184
    return mOffsets[cubitIndex];
185
    }
186

    
187
///////////////////////////////////////////////////////////////////////////////////////////////////
188

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

    
195
///////////////////////////////////////////////////////////////////////////////////////////////////
196

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

    
206
    return mCuts;
207
    }
208

    
209
///////////////////////////////////////////////////////////////////////////////////////////////////
210

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

    
217
///////////////////////////////////////////////////////////////////////////////////////////////////
218

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

    
224
///////////////////////////////////////////////////////////////////////////////////////////////////
225

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

    
231
///////////////////////////////////////////////////////////////////////////////////////////////////
232

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

    
238
///////////////////////////////////////////////////////////////////////////////////////////////////
239

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

    
245
///////////////////////////////////////////////////////////////////////////////////////////////////
246

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

    
252
///////////////////////////////////////////////////////////////////////////////////////////////////
253

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

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

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

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

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

    
341
    return mPositions;
342
    }
343

    
344
///////////////////////////////////////////////////////////////////////////////////////////////////
345

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

    
356
///////////////////////////////////////////////////////////////////////////////////////////////////
357

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    
525
      return vertices;
526
      }
527
    }
528

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    
636
///////////////////////////////////////////////////////////////////////////////////////////////////
637

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

    
644
    int NUMV = 3+NUMBER_EDGE_SEGMENTS;
645

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

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

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

    
667
    int i0,i1,i2,i3;
668

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

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

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

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

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

    
690
///////////////////////////////////////////////////////////////////////////////////////////////////
691

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

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

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

    
710
///////////////////////////////////////////////////////////////////////////////////////////////////
711

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

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

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

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

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

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

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

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

    
754
///////////////////////////////////////////////////////////////////////////////////////////////////
755

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

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

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

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

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

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

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

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

    
794
///////////////////////////////////////////////////////////////////////////////////////////////////
795

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

    
807
    return null;
808
    }
809

    
810
///////////////////////////////////////////////////////////////////////////////////////////////////
811

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

    
870
///////////////////////////////////////////////////////////////////////////////////////////////////
871

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

    
925
///////////////////////////////////////////////////////////////////////////////////////////////////
926

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

    
932
///////////////////////////////////////////////////////////////////////////////////////////////////
933

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

    
941
    return 4;
942
    }
943

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

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

    
951
///////////////////////////////////////////////////////////////////////////////////////////////////
952

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

    
958
///////////////////////////////////////////////////////////////////////////////////////////////////
959

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

    
967
///////////////////////////////////////////////////////////////////////////////////////////////////
968
// PUBLIC API
969

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

    
975
///////////////////////////////////////////////////////////////////////////////////////////////////
976

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

    
985
    return mBasicAngle;
986
    }
987

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

    
990
  public String getShortName()
991
    {
992
    int param = getMetadata().getParam();
993

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

    
1007
    return null;
1008
    }
1009

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

    
1012
  public String[][] getTutorials()
1013
    {
1014
    int param = getMetadata().getParam();
1015

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

    
1180
    return null;
1181
    }
1182
}
(13-13/59)