Project

General

Profile

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

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

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

    
10
package org.distorted.objectlib.objects;
11

    
12
import java.io.InputStream;
13

    
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.helpers.ObjectSignature;
20
import org.distorted.objectlib.helpers.ObjectVertexEffects;
21
import org.distorted.objectlib.main.ObjectSignatures;
22
import org.distorted.objectlib.scrambling.ScrambleEdgeGenerator;
23
import org.distorted.objectlib.main.TwistyObjectCubit;
24
import org.distorted.objectlib.main.InitData;
25
import org.distorted.objectlib.main.ObjectType;
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 TwistyCrazy2x2 extends ShapeHexahedron
35
{
36
  private static final float DIAMETER_RATIO = 0.60f;
37
  private static final float DIFF = 1.0f;
38
  private static final int NUMBER_CORNER_SEGMENTS = 4;
39

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

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

    
54
///////////////////////////////////////////////////////////////////////////////////////////////////
55

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

    
61
///////////////////////////////////////////////////////////////////////////////////////////////////
62

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

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

    
77
///////////////////////////////////////////////////////////////////////////////////////////////////
78

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

    
85
///////////////////////////////////////////////////////////////////////////////////////////////////
86

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

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

    
108
    return mOffsets[cubitIndex];
109
    }
110

    
111
///////////////////////////////////////////////////////////////////////////////////////////////////
112

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

    
119
///////////////////////////////////////////////////////////////////////////////////////////////////
120

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

    
129
    return mCuts;
130
    }
131

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

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

    
140
///////////////////////////////////////////////////////////////////////////////////////////////////
141

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

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

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

    
154
///////////////////////////////////////////////////////////////////////////////////////////////////
155

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

    
161
///////////////////////////////////////////////////////////////////////////////////////////////////
162

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

    
168
///////////////////////////////////////////////////////////////////////////////////////////////////
169

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

    
175
///////////////////////////////////////////////////////////////////////////////////////////////////
176

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

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

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

    
198
             { 0.5f, 0.5f, E},
199

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

    
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
             {-0.5f,-E,-0.5f},
214
             { E, 0.5f, 0.5f},
215
             {-E, 0.5f, 0.5f},
216

    
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
             {-E,-0.5f,-0.5f},
222
         };
223
      }
224

    
225
    return mPositions;
226
    }
227

    
228
///////////////////////////////////////////////////////////////////////////////////////////////////
229

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    
320
///////////////////////////////////////////////////////////////////////////////////////////////////
321

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    
427
///////////////////////////////////////////////////////////////////////////////////////////////////
428

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

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

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

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

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

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

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

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

    
467
///////////////////////////////////////////////////////////////////////////////////////////////////
468

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

    
477
    return null;
478
    }
479

    
480
///////////////////////////////////////////////////////////////////////////////////////////////////
481

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

    
509
///////////////////////////////////////////////////////////////////////////////////////////////////
510

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

    
537
///////////////////////////////////////////////////////////////////////////////////////////////////
538

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

    
544
///////////////////////////////////////////////////////////////////////////////////////////////////
545

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

    
551
///////////////////////////////////////////////////////////////////////////////////////////////////
552

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

    
558
///////////////////////////////////////////////////////////////////////////////////////////////////
559

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

    
565
///////////////////////////////////////////////////////////////////////////////////////////////////
566

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

    
573
///////////////////////////////////////////////////////////////////////////////////////////////////
574
// PUBLIC API
575

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

    
581
///////////////////////////////////////////////////////////////////////////////////////////////////
582

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

    
591
    return mBasicAngle;
592
    }
593

    
594
///////////////////////////////////////////////////////////////////////////////////////////////////
595

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

    
601
///////////////////////////////////////////////////////////////////////////////////////////////////
602

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

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

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

    
615
///////////////////////////////////////////////////////////////////////////////////////////////////
616

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

    
622
///////////////////////////////////////////////////////////////////////////////////////////////////
623

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

    
629
///////////////////////////////////////////////////////////////////////////////////////////////////
630

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

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

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