Project

General

Profile

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

distorted-objectlib / src / main / java / org / distorted / objectlib / objects / TwistyCrazy2x2.java @ cf93ea4e

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.helpers.ObjectSignature;
18
import org.distorted.objectlib.helpers.ObjectVertexEffects;
19
import org.distorted.objectlib.main.InitAssets;
20
import org.distorted.objectlib.main.ObjectSignatures;
21
import org.distorted.objectlib.scrambling.ScrambleEdgeGenerator;
22
import org.distorted.objectlib.main.TwistyObjectCubit;
23
import org.distorted.objectlib.main.InitData;
24
import org.distorted.objectlib.main.ObjectType;
25
import org.distorted.objectlib.shape.ShapeHexahedron;
26
import org.distorted.objectlib.touchcontrol.TouchControlHexahedron;
27

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

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

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

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

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

    
53
///////////////////////////////////////////////////////////////////////////////////////////////////
54

    
55
  public TwistyCrazy2x2(int meshState, int iconMode, Static4D quat, Static3D move, float scale, InitData data, InitAssets asset)
56
    {
57
    super(meshState, iconMode, data.getNumLayers()[0], quat, move, scale, data, asset);
58
    }
59

    
60
///////////////////////////////////////////////////////////////////////////////////////////////////
61

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

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

    
76
///////////////////////////////////////////////////////////////////////////////////////////////////
77

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

    
84
///////////////////////////////////////////////////////////////////////////////////////////////////
85

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

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

    
107
    return mOffsets[cubitIndex];
108
    }
109

    
110
///////////////////////////////////////////////////////////////////////////////////////////////////
111

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

    
118
///////////////////////////////////////////////////////////////////////////////////////////////////
119

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

    
128
    return mCuts;
129
    }
130

    
131
///////////////////////////////////////////////////////////////////////////////////////////////////
132

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

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

    
141
  public int getTouchControlType()
142
    {
143
    return TC_HEXAHEDRON;
144
    }
145

    
146
///////////////////////////////////////////////////////////////////////////////////////////////////
147

    
148
  public int getTouchControlSplit()
149
    {
150
    return TYPE_NOT_SPLIT;
151
    }
152

    
153
///////////////////////////////////////////////////////////////////////////////////////////////////
154

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

    
160
///////////////////////////////////////////////////////////////////////////////////////////////////
161

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

    
167
///////////////////////////////////////////////////////////////////////////////////////////////////
168

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

    
174
///////////////////////////////////////////////////////////////////////////////////////////////////
175

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

    
182
      mPositions = new float[][]
183
         {
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
             {-0.5f,-0.5f, 0.5f},
191
             {-0.5f,-0.5f,-0.5f},
192

    
193
             { E, 0.5f,-0.5f}, //
194
             { 0.5f, E,-0.5f}, // Deciders first
195
             { 0.5f, 0.5f,-E}, //
196

    
197
             { 0.5f, 0.5f, E},
198

    
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,-0.5f, E},
204
             {-0.5f,-0.5f,-E},
205
             { 0.5f, E, 0.5f},
206
             { 0.5f,-E, 0.5f},
207

    
208
             { 0.5f,-E,-0.5f},
209
             {-0.5f, E, 0.5f},
210
             {-0.5f,-E, 0.5f},
211
             {-0.5f, E,-0.5f},
212
             {-0.5f,-E,-0.5f},
213
             { E, 0.5f, 0.5f},
214
             {-E, 0.5f, 0.5f},
215

    
216
             {-E, 0.5f,-0.5f},
217
             { E,-0.5f, 0.5f},
218
             {-E,-0.5f, 0.5f},
219
             { E,-0.5f,-0.5f},
220
             {-E,-0.5f,-0.5f},
221
         };
222
      }
223

    
224
    return mPositions;
225
    }
226

    
227
///////////////////////////////////////////////////////////////////////////////////////////////////
228

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

    
237
///////////////////////////////////////////////////////////////////////////////////////////////////
238

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

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

    
257
      float[][] vertices = new float[NUM_VERTICES][];
258

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

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

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

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

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

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

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

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

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

    
319
///////////////////////////////////////////////////////////////////////////////////////////////////
320

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

    
328
    int[][] indices = new int[NUM_FACES][];
329

    
330
    indices[0] = new int[NUM_VERTS];
331
    indices[1] = new int[NUM_VERTS];
332
    indices[2] = new int[NUM_VERTS];
333

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    
426
///////////////////////////////////////////////////////////////////////////////////////////////////
427

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

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

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

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

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

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

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

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

    
466
///////////////////////////////////////////////////////////////////////////////////////////////////
467

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

    
476
    return null;
477
    }
478

    
479
///////////////////////////////////////////////////////////////////////////////////////////////////
480

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

    
508
///////////////////////////////////////////////////////////////////////////////////////////////////
509

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

    
536
///////////////////////////////////////////////////////////////////////////////////////////////////
537

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

    
543
///////////////////////////////////////////////////////////////////////////////////////////////////
544

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

    
550
///////////////////////////////////////////////////////////////////////////////////////////////////
551

    
552
  public float getStickerRadius()
553
    {
554
    return 0.07f;
555
    }
556

    
557
///////////////////////////////////////////////////////////////////////////////////////////////////
558

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

    
564
///////////////////////////////////////////////////////////////////////////////////////////////////
565

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

    
572
///////////////////////////////////////////////////////////////////////////////////////////////////
573
// PUBLIC API
574

    
575
  public Static3D[] getRotationAxis()
576
    {
577
    return ROT_AXIS;
578
    }
579

    
580
///////////////////////////////////////////////////////////////////////////////////////////////////
581

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

    
590
    return mBasicAngle;
591
    }
592

    
593
///////////////////////////////////////////////////////////////////////////////////////////////////
594

    
595
  public String getShortName()
596
    {
597
    return ObjectType.CRA1_2.name();
598
    }
599

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

    
602
  public ObjectSignature getSignature()
603
    {
604
    return new ObjectSignature(ObjectSignatures.CRA1_2);
605
    }
606

    
607
///////////////////////////////////////////////////////////////////////////////////////////////////
608

    
609
  public String getObjectName()
610
    {
611
    return "Circle 2x2";
612
    }
613

    
614
///////////////////////////////////////////////////////////////////////////////////////////////////
615

    
616
  public String getInventor()
617
    {
618
    return "Aleh Hladzilin";
619
    }
620

    
621
///////////////////////////////////////////////////////////////////////////////////////////////////
622

    
623
  public int getYearOfInvention()
624
    {
625
    return 2007;
626
    }
627

    
628
///////////////////////////////////////////////////////////////////////////////////////////////////
629

    
630
  public int getComplexity()
631
    {
632
    return 2;
633
    }
634

    
635
///////////////////////////////////////////////////////////////////////////////////////////////////
636

    
637
  public String[][] getTutorials()
638
    {
639
     return new String[][] {
640
                            {"gb","DKLIQghl66c","Circle 2x2 Demonstration","SuperAntoniovivaldi"},
641
                            {"es","Wq9lwfDfg4E","Resolucion del 2x2 Crazy","RUBIKworld"},
642
                            {"es","K4bFs4BFdXc","Tutorial Crazy 2x2 de Sengso","Manzacuber"},
643
                            {"vn","TlT5MYiz4RY","Tutorial N.216 Circular 2x2","Duy Thích Rubik"},
644
                           };
645
    }
646
}
(6-6/41)