Project

General

Profile

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

distorted-objectlib / src / main / java / org / distorted / objectlib / objects / TwistyCrazy2x2.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 org.distorted.library.type.Static3D;
13
import org.distorted.library.type.Static4D;
14
import org.distorted.objectlib.helpers.FactoryCubit;
15
import org.distorted.objectlib.helpers.ObjectFaceShape;
16
import org.distorted.objectlib.helpers.ObjectShape;
17
import org.distorted.objectlib.metadata.Metadata;
18
import org.distorted.objectlib.helpers.ObjectVertexEffects;
19
import org.distorted.objectlib.main.InitAssets;
20
import org.distorted.objectlib.scrambling.ScrambleEdgeGenerator;
21
import org.distorted.objectlib.main.TwistyObjectCubit;
22
import org.distorted.objectlib.metadata.ListObjects;
23
import org.distorted.objectlib.shape.ShapeHexahedron;
24
import org.distorted.objectlib.touchcontrol.TouchControlHexahedron;
25

    
26
import static org.distorted.objectlib.touchcontrol.TouchControl.TC_HEXAHEDRON;
27
import static org.distorted.objectlib.touchcontrol.TouchControl.TYPE_NOT_SPLIT;
28

    
29
///////////////////////////////////////////////////////////////////////////////////////////////////
30

    
31
public class TwistyCrazy2x2 extends ShapeHexahedron
32
{
33
  private static final float DIAMETER_RATIO = 0.60f;
34
  private static final float DIFF = 1.0f;
35
  private static final int NUMBER_CORNER_SEGMENTS = 4;
36

    
37
  static final Static3D[] ROT_AXIS = new Static3D[]
38
         {
39
           new Static3D(1,0,0),
40
           new Static3D(0,1,0),
41
           new Static3D(0,0,1)
42
         };
43

    
44
  private int[][] mEdges;
45
  private int[][] mBasicAngle;
46
  private float[][] mCuts;
47
  private float[][] mPositions;
48
  private int[] mQuatIndex;
49
  private float[][] mOffsets;
50

    
51
///////////////////////////////////////////////////////////////////////////////////////////////////
52

    
53
  public TwistyCrazy2x2(int iconMode, Static4D quat, Static3D move, float scale, Metadata meta, InitAssets asset)
54
    {
55
    super(iconMode, meta.getNumLayers()[0], quat, move, scale, meta, asset);
56
    }
57

    
58
///////////////////////////////////////////////////////////////////////////////////////////////////
59

    
60
  @Override
61
  public void adjustStickerCoords()
62
    {
63
    final float A = 0.50000f;
64
    final float B = 0.45424f;
65
    final float C = 0.11830f;
66

    
67
    mStickerCoords = new float[][][][]
68
      {
69
        { { { B, A},{-A, A},{-A,-B},{-C,-B},{ B, C} } },
70
        { { {-A, A},{-A,-A},{ A,-A} } }
71
      };
72
    }
73

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

    
76
  @Override
77
  public int getCubitRotationType(int cubit)
78
    {
79
    return cubit<8 ? TwistyObjectCubit.TYPE_NORMAL : ( cubit<11 ? TwistyObjectCubit.TYPE_DECIDER : TwistyObjectCubit.TYPE_FOLLOWER);
80
    }
81

    
82
///////////////////////////////////////////////////////////////////////////////////////////////////
83

    
84
  @Override
85
  public float[] getCubitRowOffset(int cubitIndex)
86
    {
87
    if( mOffsets==null )
88
      {
89
      float[] tmp = new float[] {0,0,0};
90
      int numCubits = mPositions.length;
91
      mOffsets = new float[numCubits][];
92

    
93
      for(int i=0; i<numCubits; i++)
94
        {
95
        switch(i)
96
          {
97
          case  8: mOffsets[i] = new float[] { 1,0,0}; break;
98
          case  9: mOffsets[i] = new float[] {0, 1,0}; break;
99
          case 10: mOffsets[i] = new float[] {0,0,-1}; break;
100
          default: mOffsets[i] = tmp;
101
          }
102
        }
103
      }
104

    
105
    return mOffsets[cubitIndex];
106
    }
107

    
108
///////////////////////////////////////////////////////////////////////////////////////////////////
109

    
110
  public int[][] getScrambleEdges()
111
    {
112
    if( mEdges==null ) mEdges = ScrambleEdgeGenerator.getScrambleEdgesSingle(mBasicAngle);
113
    return mEdges;
114
    }
115

    
116
///////////////////////////////////////////////////////////////////////////////////////////////////
117

    
118
  public float[][] getCuts(int[] numLayers)
119
    {
120
    if( mCuts==null )
121
      {
122
      float[] cut = new float[] {0};
123
      mCuts = new float[][] { cut,cut,cut };
124
      }
125

    
126
    return mCuts;
127
    }
128

    
129
///////////////////////////////////////////////////////////////////////////////////////////////////
130

    
131
  public boolean[][] getLayerRotatable(int[] numLayers)
132
    {
133
    boolean[] tmp = new boolean[] {true,true};
134
    return new boolean[][] { tmp,tmp,tmp };
135
    }
136

    
137
///////////////////////////////////////////////////////////////////////////////////////////////////
138

    
139
  public int getTouchControlType()
140
    {
141
    return TC_HEXAHEDRON;
142
    }
143

    
144
///////////////////////////////////////////////////////////////////////////////////////////////////
145

    
146
  public int getTouchControlSplit()
147
    {
148
    return TYPE_NOT_SPLIT;
149
    }
150

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

    
153
  public int[][][] getEnabled()
154
    {
155
    return new int[][][] { {{1,2}},{{1,2}},{{0,2}},{{0,2}},{{0,1}},{{0,1}} };
156
    }
157

    
158
///////////////////////////////////////////////////////////////////////////////////////////////////
159

    
160
  public float[] getDist3D(int[] numLayers)
161
    {
162
    return TouchControlHexahedron.D3D;
163
    }
164

    
165
///////////////////////////////////////////////////////////////////////////////////////////////////
166

    
167
  public Static3D[] getFaceAxis()
168
    {
169
    return TouchControlHexahedron.FACE_AXIS;
170
    }
171

    
172
///////////////////////////////////////////////////////////////////////////////////////////////////
173

    
174
  public float[][] getCubitPositions(int[] numLayers)
175
    {
176
    if( mPositions==null )
177
      {
178
      final float E = -DIFF+0.5f;
179

    
180
      mPositions = new float[][]
181
         {
182
             { 0.5f, 0.5f, 0.5f},
183
             { 0.5f, 0.5f,-0.5f},
184
             { 0.5f,-0.5f, 0.5f},
185
             { 0.5f,-0.5f,-0.5f},
186
             {-0.5f, 0.5f, 0.5f},
187
             {-0.5f, 0.5f,-0.5f},
188
             {-0.5f,-0.5f, 0.5f},
189
             {-0.5f,-0.5f,-0.5f},
190

    
191
             { E, 0.5f,-0.5f}, //
192
             { 0.5f, E,-0.5f}, // Deciders first
193
             { 0.5f, 0.5f,-E}, //
194

    
195
             { 0.5f, 0.5f, E},
196

    
197
             { 0.5f,-0.5f, E},
198
             { 0.5f,-0.5f,-E},
199
             {-0.5f, 0.5f, E},
200
             {-0.5f, 0.5f,-E},
201
             {-0.5f,-0.5f, E},
202
             {-0.5f,-0.5f,-E},
203
             { 0.5f, E, 0.5f},
204
             { 0.5f,-E, 0.5f},
205

    
206
             { 0.5f,-E,-0.5f},
207
             {-0.5f, E, 0.5f},
208
             {-0.5f,-E, 0.5f},
209
             {-0.5f, E,-0.5f},
210
             {-0.5f,-E,-0.5f},
211
             { E, 0.5f, 0.5f},
212
             {-E, 0.5f, 0.5f},
213

    
214
             {-E, 0.5f,-0.5f},
215
             { E,-0.5f, 0.5f},
216
             {-E,-0.5f, 0.5f},
217
             { E,-0.5f,-0.5f},
218
             {-E,-0.5f,-0.5f},
219
         };
220
      }
221

    
222
    return mPositions;
223
    }
224

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

    
227
  public Static4D getCubitQuats(int cubit, int[] numLayers)
228
    {
229
    if( mQuatIndex==null ) mQuatIndex = new int[] { 0,1,17,22,4,5,8,19,
230
                                                    6,1,18,
231
                                                    0,7,2, 9,5,8,19, 13,3,22, 14,23,15,11, 21,4,10, 17,20,12,16 };
232
    return mObjectQuats[mQuatIndex[cubit]];
233
    }
234

    
235
///////////////////////////////////////////////////////////////////////////////////////////////////
236

    
237
  private float[][] getVertices(int variant)
238
    {
239
    if( variant==0 )
240
      {
241
      final float INIT_ALPHA = 0.0f;
242
      final float STEP_CORNER= (float)((Math.PI/2)/NUMBER_CORNER_SEGMENTS);
243
      final int SINGLE_ARC = NUMBER_CORNER_SEGMENTS+1;
244
      final int SINGLE_INNER_ARC = (NUMBER_CORNER_SEGMENTS+1)/2;
245
      final int NUM_VERTICES = 4 + 3*SINGLE_ARC + 1 + 3*SINGLE_INNER_ARC;
246
      float[][] tmp = new float[SINGLE_ARC][2];
247

    
248
      for(int i=0; i<SINGLE_ARC; i++)
249
        {
250
        float alpha = INIT_ALPHA + i*STEP_CORNER;
251
        tmp[i][0] = (float)(DIAMETER_RATIO*Math.sin(alpha) - 0.5f);
252
        tmp[i][1] = (float)(DIAMETER_RATIO*Math.cos(alpha) - 0.5f);
253
        }
254

    
255
      float[][] vertices = new float[NUM_VERTICES][];
256

    
257
      vertices[0] = new float[] { +0.5f, +0.5f, +0.5f };
258
      vertices[1] = new float[] { -0.5f, +0.5f, +0.5f };
259
      vertices[2] = new float[] { +0.5f, -0.5f, +0.5f };
260
      vertices[3] = new float[] { +0.5f, +0.5f, -0.5f };
261

    
262
      for(int i=0; i<SINGLE_ARC; i++)
263
        {
264
        float s = tmp[i][0];
265
        float c = tmp[i][1];
266

    
267
        vertices[4             +i] = new float[] {0.5f,+s,+c};
268
        vertices[4+  SINGLE_ARC+i] = new float[] {+c,0.5f,+s};
269
        vertices[4+2*SINGLE_ARC+i] = new float[] {+s,+c,0.5f};
270
        }
271

    
272
      final float EXTRA = (NUMBER_CORNER_SEGMENTS%2)==0 ? 1.0f : (float)Math.cos((Math.PI/2)/(2*NUMBER_CORNER_SEGMENTS));
273
      final float LEN   = DIAMETER_RATIO*EXTRA;
274
      final float M     = (float)(LEN*Math.sin(Math.PI/4) - 0.5f);
275
      vertices[4+3*SINGLE_ARC] = new float[] {M,M,M};
276

    
277
      for(int i=0; i<SINGLE_INNER_ARC; i++)
278
        {
279
        float s = tmp[i][0];
280
        float c = tmp[i][1];
281

    
282
        vertices[4+3*SINGLE_ARC+1                   +i] = new float[] {s,c,c};
283
        vertices[4+3*SINGLE_ARC+1+  SINGLE_INNER_ARC+i] = new float[] {c,s,c};
284
        vertices[4+3*SINGLE_ARC+1+2*SINGLE_INNER_ARC+i] = new float[] {c,c,s};
285
        }
286
      return vertices;
287
      }
288
    else
289
      {
290
      final float D = DIFF+0.02f;
291
      final float H = DIAMETER_RATIO-0.5f;
292
      final float INIT_ALPHA = 0;
293
      final float STEP_CORNER= (float)((Math.PI/2)/NUMBER_CORNER_SEGMENTS);
294
      final int NUM_VERTICES = 6 + 2*(NUMBER_CORNER_SEGMENTS-1);
295
      float[][] vertices = new float[NUM_VERTICES][];
296

    
297
      vertices[0] = new float[] {-0.5f,    H, 0.5f+D};
298
      vertices[1] = new float[] {    H,-0.5f, 0.5f+D};
299
      vertices[2] = new float[] {-0.5f,-0.5f, 0.5f+D};
300
      vertices[3] = new float[] {-0.5f,    H,-0.5f+D};
301
      vertices[4] = new float[] {    H,-0.5f,-0.5f+D};
302
      vertices[5] = new float[] {-0.5f,-0.5f,-0.5f+D};
303

    
304
      for(int i=0; i<NUMBER_CORNER_SEGMENTS-1; i++)
305
        {
306
        float alpha = INIT_ALPHA + (i+1)*STEP_CORNER;
307
        float A = (float)(DIAMETER_RATIO*Math.sin(alpha) - 0.5f);
308
        float B = (float)(DIAMETER_RATIO*Math.cos(alpha) - 0.5f);
309

    
310
        vertices[6                       +i] = new float[] {A,B, 0.5f+D};
311
        vertices[5+NUMBER_CORNER_SEGMENTS+i] = new float[] {A,B,-0.5f+D};
312
        }
313
      return vertices;
314
      }
315
    }
316

    
317
///////////////////////////////////////////////////////////////////////////////////////////////////
318

    
319
  private ObjectShape getCornerShape()
320
    {
321
    final int SINGLE_ARC = NUMBER_CORNER_SEGMENTS+1;
322
    final int SINGLE_INNER_ARC = (NUMBER_CORNER_SEGMENTS+1)/2;
323
    final int NUM_FACES = 6 + 3*NUMBER_CORNER_SEGMENTS;
324
    final int NUM_VERTS = 4 +   NUMBER_CORNER_SEGMENTS;
325

    
326
    int[][] indices = new int[NUM_FACES][];
327

    
328
    indices[0] = new int[NUM_VERTS];
329
    indices[1] = new int[NUM_VERTS];
330
    indices[2] = new int[NUM_VERTS];
331

    
332
    indices[0][0] = 3;
333
    indices[0][1] = 0;
334
    indices[0][2] = 2;
335
    indices[1][0] = 1;
336
    indices[1][1] = 0;
337
    indices[1][2] = 3;
338
    indices[2][0] = 2;
339
    indices[2][1] = 0;
340
    indices[2][2] = 1;
341

    
342
    for(int i=0; i<SINGLE_ARC; i++)
343
      {
344
      indices[0][3+i] = 4+i;
345
      indices[1][3+i] = 4+i+  SINGLE_ARC;
346
      indices[2][3+i] = 4+i+2*SINGLE_ARC;
347
      }
348

    
349
    indices[3] = new int[] { 1, 4+2*SINGLE_ARC-1, 4+3*SINGLE_ARC+1                   , 4+2*SINGLE_ARC};
350
    indices[4] = new int[] { 2, 4+3*SINGLE_ARC-1, 4+3*SINGLE_ARC+1+  SINGLE_INNER_ARC, 4             };
351
    indices[5] = new int[] { 3, 4+  SINGLE_ARC-1, 4+3*SINGLE_ARC+1+2*SINGLE_INNER_ARC, 4+  SINGLE_ARC};
352

    
353
    int start,i0,i1,i2,i3;
354
    int MID = (NUMBER_CORNER_SEGMENTS)/2;
355
    int MID2= (NUMBER_CORNER_SEGMENTS+1)/2;
356

    
357
    if( (NUMBER_CORNER_SEGMENTS%2) == 0 )
358
      {
359
      start = 12;
360
      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};
361
      indices[ 7] = new int[] { 4+3*SINGLE_ARC, 4+3*SINGLE_ARC+1+MID-1,  4+SINGLE_ARC+MID+1, 4+SINGLE_ARC+MID};
362
      indices[ 8] = new int[] { 4+3*SINGLE_ARC, 4+3*SINGLE_ARC+1+2*SINGLE_INNER_ARC+MID-1, 4+MID+1, 4+MID };
363
      indices[ 9] = new int[] { 4+3*SINGLE_ARC, 4+MID, 4+MID-1, 4+3*SINGLE_ARC+1+SINGLE_INNER_ARC+MID-1 };
364
      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 };
365
      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 };
366
      }
367
    else
368
      {
369
      start = 9;
370
      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};
371
      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};
372
      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};
373
      }
374

    
375
    for(int j=0; j<MID2-1; j++)
376
      {
377
      i0 = 4+3*SINGLE_ARC+1+2*SINGLE_INNER_ARC+j;
378
      i1 = 4+3*SINGLE_ARC+1+2*SINGLE_INNER_ARC+j+1;
379
      i2 = 4+SINGLE_ARC+j+1;
380
      i3 = 4+SINGLE_ARC+j;
381

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

    
384
      i0 = 4+3*SINGLE_ARC+1+2*SINGLE_INNER_ARC+j+1;
385
      i1 = 4+3*SINGLE_ARC+1+2*SINGLE_INNER_ARC+j;
386
      i2 = 4+(SINGLE_ARC-1)-j;
387
      i3 = 4+(SINGLE_ARC-1)-(j+1);
388

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

    
391
      i0 = 4+3*SINGLE_ARC+1+j;
392
      i1 = 4+3*SINGLE_ARC+1+j+1;
393
      i2 = 4+2*SINGLE_ARC+j+1;
394
      i3 = 4+2*SINGLE_ARC+j;
395

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

    
398
      i0 = 4+3*SINGLE_ARC+1+j+1;
399
      i1 = 4+3*SINGLE_ARC+1+j;
400
      i2 = 4+(2*SINGLE_ARC-1)-j;
401
      i3 = 4+(2*SINGLE_ARC-1)-(j+1);
402

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

    
405
      i0 = 4+3*SINGLE_ARC+1+SINGLE_INNER_ARC+j;
406
      i1 = 4+3*SINGLE_ARC+1+SINGLE_INNER_ARC+j+1;
407
      i2 = 4+j+1;
408
      i3 = 4+j;
409

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

    
412
      i0 = 4+3*SINGLE_ARC+1+SINGLE_INNER_ARC+j+1;
413
      i1 = 4+3*SINGLE_ARC+1+SINGLE_INNER_ARC+j;
414
      i2 = 4+(3*SINGLE_ARC-1)-j;
415
      i3 = 4+(3*SINGLE_ARC-1)-(j+1);
416

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

    
420
    float[][] vertices = getVertices(0);
421
    return new ObjectShape(vertices,indices);
422
    }
423

    
424
///////////////////////////////////////////////////////////////////////////////////////////////////
425

    
426
  private ObjectShape getSmallCircleShape()
427
    {
428
    final int NUM_FACES = 4 + NUMBER_CORNER_SEGMENTS;
429
    int[][] indices = new int[NUM_FACES][];
430

    
431
    int NUMV = 2+NUMBER_CORNER_SEGMENTS;
432
    indices[0] = new int[NUMV];
433
    indices[0][0] = 0;
434
    indices[0][1] = 2;
435
    indices[0][2] = 1;
436
    for(int i=3; i<NUMV; i++) indices[0][i] = 5+(NUMBER_CORNER_SEGMENTS-1)-(i-3);
437

    
438
    indices[1] = new int[NUMV];
439
    indices[1][0] = 4;
440
    indices[1][1] = 5;
441
    indices[1][2] = 3;
442
    for(int i=3; i<NUMV; i++) indices[1][i] = 5+NUMBER_CORNER_SEGMENTS+(i-3);
443

    
444
    indices[2] = new int[] {0,3,5,2};
445
    indices[3] = new int[] {1,2,5,4};
446

    
447
    indices[4] = new int[] {5+NUMBER_CORNER_SEGMENTS,3,0,6};
448
    indices[5] = new int[] {1,4,5+2*(NUMBER_CORNER_SEGMENTS-1),5+(NUMBER_CORNER_SEGMENTS-1)};
449

    
450
    for(int i=0; i<NUMBER_CORNER_SEGMENTS-2; i++)
451
      {
452
      int i0 = 6+i;
453
      int i1 = 7+i;
454
      int i2 = 6+NUMBER_CORNER_SEGMENTS+i;
455
      int i3 = 5+NUMBER_CORNER_SEGMENTS+i;
456

    
457
      indices[6+i] = new int[] {i0,i1,i2,i3};
458
      }
459

    
460
    float[][] vertices = getVertices(1);
461
    return new ObjectShape(vertices,indices);
462
    }
463

    
464
///////////////////////////////////////////////////////////////////////////////////////////////////
465

    
466
  public ObjectShape getObjectShape(int variant)
467
    {
468
    switch(variant)
469
      {
470
      case 0: return getCornerShape();
471
      case 1: return getSmallCircleShape();
472
      }
473

    
474
    return null;
475
    }
476

    
477
///////////////////////////////////////////////////////////////////////////////////////////////////
478

    
479
  public ObjectFaceShape getObjectFaceShape(int variant)
480
    {
481
    if( variant==0 )
482
      {
483
      float h1 = isInIconMode() ? 0.001f : 0.04f;
484
      float h2 = 0.001f;
485
      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} };
486
      final int NUM_BANDS = 6+3*NUMBER_CORNER_SEGMENTS;
487
      int[] indices = new int[NUM_BANDS];
488
      indices[0] = indices[1] = indices[2] = indices[3] = indices[4] = indices[5] = 0;
489
      for(int i=6; i<NUM_BANDS; i++) indices[i] = 2;
490
      return new ObjectFaceShape(bands,indices,null);
491
      }
492
    else
493
      {
494
      float h1 = isInIconMode() ? 0.001f : 0.03f;
495
      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} };
496
      final int NUM_BANDS = 4 + NUMBER_CORNER_SEGMENTS;
497
      int[] indices = new int[NUM_BANDS];
498
      indices[0] = 0;
499
      indices[1] = 2;
500
      indices[2] = indices[3] = 1;
501
      for(int i=4; i<NUM_BANDS; i++) indices[i] = 2;
502
      return new ObjectFaceShape(bands,indices,null);
503
      }
504
    }
505

    
506
///////////////////////////////////////////////////////////////////////////////////////////////////
507

    
508
  public ObjectVertexEffects getVertexEffects(int variant)
509
    {
510
    if( variant==0 )
511
      {
512
      float[][] corners = { {0.02f,0.09f} };
513
      float[][] centers = { { 0.0f, 0.0f, 0.0f } };
514
      final int SINGLE_ARC = NUMBER_CORNER_SEGMENTS+1;
515
      final int SINGLE_INNER_ARC = (NUMBER_CORNER_SEGMENTS+1)/2;
516
      final int NUM_VERTICES = 4 + 3*SINGLE_ARC + 1 + 3*SINGLE_INNER_ARC;
517
      int[] indices = new int[NUM_VERTICES];
518
      indices[0] = indices[1] = indices[2] = indices[3] = 0;
519
      for(int i=4; i<NUM_VERTICES; i++) indices[i] = -1;
520
      return FactoryCubit.generateVertexEffect(getVertices(variant),corners,indices,centers,indices);
521
      }
522
    else
523
      {
524
      float[][] corners = { {0.02f,0.09f} };
525
      float[][] centers = { { 0.0f, 0.0f, 1.0f } };
526
      final int NUM_VERTICES = 6 + 2*(NUMBER_CORNER_SEGMENTS-1);
527
      int[] indices = new int[NUM_VERTICES];
528
      for(int i=0; i<NUM_VERTICES; i++) indices[i] = -1;
529
      indices[0] = indices[1] = indices[2] = 0;
530
      return FactoryCubit.generateVertexEffect(getVertices(variant),corners,indices,centers,indices);
531
      }
532
    }
533

    
534
///////////////////////////////////////////////////////////////////////////////////////////////////
535

    
536
  public int getNumCubitVariants(int[] numLayers)
537
    {
538
    return 2;
539
    }
540

    
541
///////////////////////////////////////////////////////////////////////////////////////////////////
542

    
543
  public int getCubitVariant(int cubit, int[] numLayers)
544
    {
545
    return cubit<8?0:1;
546
    }
547

    
548
///////////////////////////////////////////////////////////////////////////////////////////////////
549

    
550
  public float getStickerRadius()
551
    {
552
    return 0.07f;
553
    }
554

    
555
///////////////////////////////////////////////////////////////////////////////////////////////////
556

    
557
  public float getStickerStroke()
558
    {
559
    return isInIconMode() ? 0.17f : 0.12f;
560
    }
561

    
562
///////////////////////////////////////////////////////////////////////////////////////////////////
563

    
564
  public float[][][] getStickerAngles()
565
    {
566
    float D = (float)(Math.PI/2);
567
    return new float[][][] { {{ 0,0,0,-D,0 }} , {{ 0,0,D }} };
568
    }
569

    
570
///////////////////////////////////////////////////////////////////////////////////////////////////
571
// PUBLIC API
572

    
573
  public Static3D[] getRotationAxis()
574
    {
575
    return ROT_AXIS;
576
    }
577

    
578
///////////////////////////////////////////////////////////////////////////////////////////////////
579

    
580
  public int[][] getBasicAngles()
581
    {
582
    if( mBasicAngle==null )
583
      {
584
      int[] tmp = new int[] {4,4};
585
      mBasicAngle = new int[][] { tmp,tmp,tmp };
586
      }
587

    
588
    return mBasicAngle;
589
    }
590

    
591
///////////////////////////////////////////////////////////////////////////////////////////////////
592

    
593
  public String getShortName()
594
    {
595
    return ListObjects.CRA1_2.name();
596
    }
597

    
598
///////////////////////////////////////////////////////////////////////////////////////////////////
599

    
600
  public String[][] getTutorials()
601
    {
602
     return new String[][] {
603
                            {"gb","DKLIQghl66c","Circle 2x2 Demonstration","SuperAntoniovivaldi"},
604
                            {"es","Wq9lwfDfg4E","Resolucion del 2x2 Crazy","RUBIKworld"},
605
                            {"es","K4bFs4BFdXc","Tutorial Crazy 2x2 de Sengso","Manzacuber"},
606
                            {"vn","TlT5MYiz4RY","Tutorial N.216 Circular 2x2","Duy Thích Rubik"},
607
                            {"tw","LlwyltKnq88","聖手二階魔中魔教學-由外而內","不正常魔術方塊研究中心"},
608
                           };
609
    }
610
}
(12-12/59)