Project

General

Profile

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

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

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

    
20
package org.distorted.objectlib.objects;
21

    
22
import java.io.InputStream;
23

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

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

    
39
///////////////////////////////////////////////////////////////////////////////////////////////////
40

    
41
public class TwistyCrazy2x2 extends ShapeHexahedron
42
{
43
  private static final float DIAMETER_RATIO = 0.60f;
44
  private static final float DIFF = 1.0f;
45
  private static final int NUMBER_CORNER_SEGMENTS = 4;
46

    
47
  static final Static3D[] ROT_AXIS = new Static3D[]
48
         {
49
           new Static3D(1,0,0),
50
           new Static3D(0,1,0),
51
           new Static3D(0,0,1)
52
         };
53

    
54
  private ScrambleState[] mStates;
55
  private int[][] mBasicAngle;
56
  private float[][] mCuts;
57
  private float[][] mPositions;
58
  private int[] mQuatIndex;
59
  private float[][] mOffsets;
60

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

    
63
  public TwistyCrazy2x2(InitData data, int meshState, int iconMode, Static4D quat, Static3D move, float scale, InputStream stream)
64
    {
65
    super(data, meshState, iconMode, data.getNumLayers()[0], quat, move, scale, stream);
66
    }
67

    
68
///////////////////////////////////////////////////////////////////////////////////////////////////
69

    
70
  @Override
71
  public void adjustStickerCoords()
72
    {
73
    final float A = 0.50000f;
74
    final float B = 0.45424f;
75
    final float C = 0.11830f;
76

    
77
    mStickerCoords = new float[][]
78
      {
79
        {  B, A,-A, A,-A,-B,-C,-B, B, C },
80
        { -A, A,-A,-A, A,-A }
81
      };
82
    }
83

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

    
86
  @Override
87
  public int getCubitRotationType(int cubit)
88
    {
89
    return cubit<8 ? Cubit.TYPE_NORMAL : ( cubit<11 ? Cubit.TYPE_DECIDER : Cubit.TYPE_FOLLOWER);
90
    }
91

    
92
///////////////////////////////////////////////////////////////////////////////////////////////////
93

    
94
  @Override
95
  public float[] getCubitRowOffset(int cubitIndex)
96
    {
97
    if( mOffsets==null )
98
      {
99
      float[] tmp = new float[] {0,0,0};
100
      int numCubits = mPositions.length;
101
      mOffsets = new float[numCubits][];
102

    
103
      for(int i=0; i<numCubits; i++)
104
        {
105
        switch(i)
106
          {
107
          case  8: mOffsets[i] = new float[] { 1,0,0}; break;
108
          case  9: mOffsets[i] = new float[] {0, 1,0}; break;
109
          case 10: mOffsets[i] = new float[] {0,0,-1}; break;
110
          default: mOffsets[i] = tmp;
111
          }
112
        }
113
      }
114

    
115
    return mOffsets[cubitIndex];
116
    }
117

    
118
///////////////////////////////////////////////////////////////////////////////////////////////////
119
// Normal 2x2
120

    
121
  public ScrambleState[] getScrambleStates()
122
    {
123
    if( mStates==null )
124
      {
125
      int[] m = new int[] { 0,-1,0,0,1,0,0,2,0, 1,-1,0,1,1,0,1,2,0 };
126

    
127
      mStates = new ScrambleState[]
128
          {
129
          new ScrambleState( new int[][] { m,m,m } )
130
          };
131
      }
132

    
133
    return mStates;
134
    }
135

    
136
///////////////////////////////////////////////////////////////////////////////////////////////////
137

    
138
  public float[][] getCuts(int[] numLayers)
139
    {
140
    if( mCuts==null )
141
      {
142
      float[] cut = new float[] {0};
143
      mCuts = new float[][] { cut,cut,cut };
144
      }
145

    
146
    return mCuts;
147
    }
148

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

    
151
  public boolean[][] getLayerRotatable(int[] numLayers)
152
    {
153
    boolean[] tmp = new boolean[] {true,true};
154
    return new boolean[][] { tmp,tmp,tmp };
155
    }
156

    
157
///////////////////////////////////////////////////////////////////////////////////////////////////
158

    
159
  public int getTouchControlType()
160
    {
161
    return TC_HEXAHEDRON;
162
    }
163

    
164
///////////////////////////////////////////////////////////////////////////////////////////////////
165

    
166
  public int getTouchControlSplit()
167
    {
168
    return TYPE_NOT_SPLIT;
169
    }
170

    
171
///////////////////////////////////////////////////////////////////////////////////////////////////
172

    
173
  public int[][][] getEnabled()
174
    {
175
    return new int[][][] { {{1,2}},{{1,2}},{{0,2}},{{0,2}},{{0,1}},{{0,1}} };
176
    }
177

    
178
///////////////////////////////////////////////////////////////////////////////////////////////////
179

    
180
  public float[] getDist3D(int[] numLayers)
181
    {
182
    return TouchControlHexahedron.D3D;
183
    }
184

    
185
///////////////////////////////////////////////////////////////////////////////////////////////////
186

    
187
  public Static3D[] getFaceAxis()
188
    {
189
    return TouchControlHexahedron.FACE_AXIS;
190
    }
191

    
192
///////////////////////////////////////////////////////////////////////////////////////////////////
193

    
194
  public float[][] getCubitPositions(int[] numLayers)
195
    {
196
    if( mPositions==null )
197
      {
198
      final float E = -DIFF+0.5f;
199

    
200
      mPositions = new float[][]
201
         {
202
             { 0.5f, 0.5f, 0.5f},
203
             { 0.5f, 0.5f,-0.5f},
204
             { 0.5f,-0.5f, 0.5f},
205
             { 0.5f,-0.5f,-0.5f},
206
             {-0.5f, 0.5f, 0.5f},
207
             {-0.5f, 0.5f,-0.5f},
208
             {-0.5f,-0.5f, 0.5f},
209
             {-0.5f,-0.5f,-0.5f},
210

    
211
             { E, 0.5f,-0.5f}, //
212
             { 0.5f, E,-0.5f}, // Deciders first
213
             { 0.5f, 0.5f,-E}, //
214

    
215
             { 0.5f, 0.5f, E},
216

    
217
             { 0.5f,-0.5f, E},
218
             { 0.5f,-0.5f,-E},
219
             {-0.5f, 0.5f, E},
220
             {-0.5f, 0.5f,-E},
221
             {-0.5f,-0.5f, E},
222
             {-0.5f,-0.5f,-E},
223
             { 0.5f, E, 0.5f},
224
             { 0.5f,-E, 0.5f},
225

    
226
             { 0.5f,-E,-0.5f},
227
             {-0.5f, E, 0.5f},
228
             {-0.5f,-E, 0.5f},
229
             {-0.5f, E,-0.5f},
230
             {-0.5f,-E,-0.5f},
231
             { E, 0.5f, 0.5f},
232
             {-E, 0.5f, 0.5f},
233

    
234
             {-E, 0.5f,-0.5f},
235
             { E,-0.5f, 0.5f},
236
             {-E,-0.5f, 0.5f},
237
             { E,-0.5f,-0.5f},
238
             {-E,-0.5f,-0.5f},
239
         };
240
      }
241

    
242
    return mPositions;
243
    }
244

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

    
247
  public Static4D getCubitQuats(int cubit, int[] numLayers)
248
    {
249
    if( mQuatIndex==null ) mQuatIndex = new int[] { 0,1,17,22,4,5,8,19,
250
                                                    6,1,18,
251
                                                    0,7,2, 9,5,8,19, 13,3,22, 14,23,15,11, 21,4,10, 17,20,12,16 };
252
    return mObjectQuats[mQuatIndex[cubit]];
253
    }
254

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

    
257
  private ObjectShape getCornerShape()
258
    {
259
    final float INIT_ALPHA = 0.0f;
260
    final float STEP_CORNER= (float)((Math.PI/2)/NUMBER_CORNER_SEGMENTS);
261
    final int SINGLE_ARC = NUMBER_CORNER_SEGMENTS+1;
262
    final int SINGLE_INNER_ARC = (NUMBER_CORNER_SEGMENTS+1)/2;
263
    final int NUM_VERTICES = 4 + 3*SINGLE_ARC + 1 + 3*SINGLE_INNER_ARC;
264
    float[][] tmp = new float[SINGLE_ARC][2];
265

    
266
    for(int i=0; i<SINGLE_ARC; i++)
267
      {
268
      float alpha = INIT_ALPHA + i*STEP_CORNER;
269
      tmp[i][0] = (float)(DIAMETER_RATIO*Math.sin(alpha) - 0.5f);
270
      tmp[i][1] = (float)(DIAMETER_RATIO*Math.cos(alpha) - 0.5f);
271
      }
272

    
273
    float[][] vertices = new float[NUM_VERTICES][];
274

    
275
    vertices[0] = new float[] { +0.5f, +0.5f, +0.5f };
276
    vertices[1] = new float[] { -0.5f, +0.5f, +0.5f };
277
    vertices[2] = new float[] { +0.5f, -0.5f, +0.5f };
278
    vertices[3] = new float[] { +0.5f, +0.5f, -0.5f };
279

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

    
285
      vertices[4             +i] = new float[] {0.5f,+s,+c};
286
      vertices[4+  SINGLE_ARC+i] = new float[] {+c,0.5f,+s};
287
      vertices[4+2*SINGLE_ARC+i] = new float[] {+s,+c,0.5f};
288
      }
289

    
290
    final float EXTRA = (NUMBER_CORNER_SEGMENTS%2)==0 ? 1.0f : (float)Math.cos((Math.PI/2)/(2*NUMBER_CORNER_SEGMENTS));
291
    final float LEN   = DIAMETER_RATIO*EXTRA;
292
    final float M     = (float)(LEN*Math.sin(Math.PI/4) - 0.5f);
293
    vertices[4+3*SINGLE_ARC] = new float[] {M,M,M};
294

    
295
    for(int i=0; i<SINGLE_INNER_ARC; i++)
296
      {
297
      float s = tmp[i][0];
298
      float c = tmp[i][1];
299

    
300
      vertices[4+3*SINGLE_ARC+1                   +i] = new float[] {s,c,c};
301
      vertices[4+3*SINGLE_ARC+1+  SINGLE_INNER_ARC+i] = new float[] {c,s,c};
302
      vertices[4+3*SINGLE_ARC+1+2*SINGLE_INNER_ARC+i] = new float[] {c,c,s};
303
      }
304

    
305
    final int NUM_FACES = 6 + 3*NUMBER_CORNER_SEGMENTS;
306
    final int NUM_VERTS = 4 +   NUMBER_CORNER_SEGMENTS;
307

    
308
    int[][] indices = new int[NUM_FACES][];
309

    
310
    indices[0] = new int[NUM_VERTS];
311
    indices[1] = new int[NUM_VERTS];
312
    indices[2] = new int[NUM_VERTS];
313

    
314
    indices[0][0] = 3;
315
    indices[0][1] = 0;
316
    indices[0][2] = 2;
317
    indices[1][0] = 1;
318
    indices[1][1] = 0;
319
    indices[1][2] = 3;
320
    indices[2][0] = 2;
321
    indices[2][1] = 0;
322
    indices[2][2] = 1;
323

    
324
    for(int i=0; i<SINGLE_ARC; i++)
325
      {
326
      indices[0][3+i] = 4+i;
327
      indices[1][3+i] = 4+i+  SINGLE_ARC;
328
      indices[2][3+i] = 4+i+2*SINGLE_ARC;
329
      }
330

    
331
    indices[3] = new int[] { 1, 4+2*SINGLE_ARC-1, 4+3*SINGLE_ARC+1                   , 4+2*SINGLE_ARC};
332
    indices[4] = new int[] { 2, 4+3*SINGLE_ARC-1, 4+3*SINGLE_ARC+1+  SINGLE_INNER_ARC, 4             };
333
    indices[5] = new int[] { 3, 4+  SINGLE_ARC-1, 4+3*SINGLE_ARC+1+2*SINGLE_INNER_ARC, 4+  SINGLE_ARC};
334

    
335
    int start,i0,i1,i2,i3;
336
    int MID = (NUMBER_CORNER_SEGMENTS)/2;
337
    int MID2= (NUMBER_CORNER_SEGMENTS+1)/2;
338

    
339
    if( (NUMBER_CORNER_SEGMENTS%2) == 0 )
340
      {
341
      start = 12;
342
      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};
343
      indices[ 7] = new int[] { 4+3*SINGLE_ARC, 4+3*SINGLE_ARC+1+MID-1,  4+SINGLE_ARC+MID+1, 4+SINGLE_ARC+MID};
344
      indices[ 8] = new int[] { 4+3*SINGLE_ARC, 4+3*SINGLE_ARC+1+2*SINGLE_INNER_ARC+MID-1, 4+MID+1, 4+MID };
345
      indices[ 9] = new int[] { 4+3*SINGLE_ARC, 4+MID, 4+MID-1, 4+3*SINGLE_ARC+1+SINGLE_INNER_ARC+MID-1 };
346
      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 };
347
      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 };
348
      }
349
    else
350
      {
351
      start = 9;
352
      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};
353
      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};
354
      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};
355
      }
356

    
357
    for(int j=0; j<MID2-1; j++)
358
      {
359
      i0 = 4+3*SINGLE_ARC+1+2*SINGLE_INNER_ARC+j;
360
      i1 = 4+3*SINGLE_ARC+1+2*SINGLE_INNER_ARC+j+1;
361
      i2 = 4+SINGLE_ARC+j+1;
362
      i3 = 4+SINGLE_ARC+j;
363

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

    
366
      i0 = 4+3*SINGLE_ARC+1+2*SINGLE_INNER_ARC+j+1;
367
      i1 = 4+3*SINGLE_ARC+1+2*SINGLE_INNER_ARC+j;
368
      i2 = 4+(SINGLE_ARC-1)-j;
369
      i3 = 4+(SINGLE_ARC-1)-(j+1);
370

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

    
373
      i0 = 4+3*SINGLE_ARC+1+j;
374
      i1 = 4+3*SINGLE_ARC+1+j+1;
375
      i2 = 4+2*SINGLE_ARC+j+1;
376
      i3 = 4+2*SINGLE_ARC+j;
377

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

    
380
      i0 = 4+3*SINGLE_ARC+1+j+1;
381
      i1 = 4+3*SINGLE_ARC+1+j;
382
      i2 = 4+(2*SINGLE_ARC-1)-j;
383
      i3 = 4+(2*SINGLE_ARC-1)-(j+1);
384

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

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

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

    
394
      i0 = 4+3*SINGLE_ARC+1+SINGLE_INNER_ARC+j+1;
395
      i1 = 4+3*SINGLE_ARC+1+SINGLE_INNER_ARC+j;
396
      i2 = 4+(3*SINGLE_ARC-1)-j;
397
      i3 = 4+(3*SINGLE_ARC-1)-(j+1);
398

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

    
402
    return new ObjectShape(vertices,indices);
403
    }
404

    
405
///////////////////////////////////////////////////////////////////////////////////////////////////
406

    
407
  private ObjectShape getSmallCircleShape()
408
    {
409
    final float D = DIFF+0.02f;
410
    final float H = DIAMETER_RATIO-0.5f;
411
    final float INIT_ALPHA = 0;
412
    final float STEP_CORNER= (float)((Math.PI/2)/NUMBER_CORNER_SEGMENTS);
413
    final int NUM_VERTICES = 6 + 2*(NUMBER_CORNER_SEGMENTS-1);
414
    float[][] vertices = new float[NUM_VERTICES][];
415

    
416
    vertices[0] = new float[] {-0.5f,    H, 0.5f+D};
417
    vertices[1] = new float[] {    H,-0.5f, 0.5f+D};
418
    vertices[2] = new float[] {-0.5f,-0.5f, 0.5f+D};
419
    vertices[3] = new float[] {-0.5f,    H,-0.5f+D};
420
    vertices[4] = new float[] {    H,-0.5f,-0.5f+D};
421
    vertices[5] = new float[] {-0.5f,-0.5f,-0.5f+D};
422

    
423
    for(int i=0; i<NUMBER_CORNER_SEGMENTS-1; i++)
424
      {
425
      float alpha = INIT_ALPHA + (i+1)*STEP_CORNER;
426
      float A = (float)(DIAMETER_RATIO*Math.sin(alpha) - 0.5f);
427
      float B = (float)(DIAMETER_RATIO*Math.cos(alpha) - 0.5f);
428

    
429
      vertices[6                       +i] = new float[] {A,B, 0.5f+D};
430
      vertices[5+NUMBER_CORNER_SEGMENTS+i] = new float[] {A,B,-0.5f+D};
431
      }
432

    
433
    final int NUM_FACES = 4 + NUMBER_CORNER_SEGMENTS;
434
    int[][] indices = new int[NUM_FACES][];
435

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

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

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

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

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

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

    
465
    return new ObjectShape(vertices,indices);
466
    }
467

    
468
///////////////////////////////////////////////////////////////////////////////////////////////////
469

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

    
478
    return null;
479
    }
480

    
481
///////////////////////////////////////////////////////////////////////////////////////////////////
482

    
483
  public ObjectFaceShape getObjectFaceShape(int variant)
484
    {
485
    if( variant==0 )
486
      {
487
      float h1 = isInIconMode() ? 0.001f : 0.04f;
488
      float h2 = 0.001f;
489
      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} };
490
      final int NUM_BANDS = 6+3*NUMBER_CORNER_SEGMENTS;
491
      int[] bandIndices = new int[NUM_BANDS];
492
      bandIndices[0] = bandIndices[1] = bandIndices[2] = 0;
493
      bandIndices[3] = bandIndices[4] = bandIndices[5] = 0;
494
      for(int i=6; i<NUM_BANDS; i++) bandIndices[i] = 2;
495
      float[][] corners = { {0.02f,0.09f} };
496
      float[][] centers = { { 0.0f, 0.0f, 0.0f } };
497
      final int SINGLE_ARC = NUMBER_CORNER_SEGMENTS+1;
498
      final int SINGLE_INNER_ARC = (NUMBER_CORNER_SEGMENTS+1)/2;
499
      final int NUM_VERTICES = 4 + 3*SINGLE_ARC + 1 + 3*SINGLE_INNER_ARC;
500
      int[] indices = new int[NUM_VERTICES];
501
      indices[0] = indices[1] = indices[2] = indices[3] = 0;
502
      for(int i=4; i<NUM_VERTICES; i++) indices[i] = -1;
503
      return new ObjectFaceShape(bands,bandIndices,corners,indices,centers,indices,null);
504
      }
505
    else
506
      {
507
      float h1 = isInIconMode() ? 0.001f : 0.03f;
508
      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} };
509
      final int NUM_BANDS = 4 + NUMBER_CORNER_SEGMENTS;
510
      int[] bandIndices = new int[NUM_BANDS];
511
      bandIndices[0] = 0;
512
      bandIndices[1] = 2;
513
      bandIndices[2] = bandIndices[3] = 1;
514
      for(int i=4; i<NUM_BANDS; i++) bandIndices[i] = 2;
515
      float[][] corners = { {0.02f,0.09f} };
516
      float[][] centers = { { 0.0f, 0.0f, 1.0f } };
517
      final int NUM_VERTICES = 6 + 2*(NUMBER_CORNER_SEGMENTS-1);
518
      int[] indices = new int[NUM_VERTICES];
519
      for(int i=0; i<NUM_VERTICES; i++) indices[i] = -1;
520
      indices[0] = indices[1] = indices[2] = 0;
521
      return new ObjectFaceShape(bands,bandIndices,corners,indices,centers,indices,null);
522
      }
523
    }
524

    
525
///////////////////////////////////////////////////////////////////////////////////////////////////
526

    
527
  public int getNumCubitVariants(int[] numLayers)
528
    {
529
    return 2;
530
    }
531

    
532
///////////////////////////////////////////////////////////////////////////////////////////////////
533

    
534
  public int getCubitVariant(int cubit, int[] numLayers)
535
    {
536
    return cubit<8?0:1;
537
    }
538

    
539
///////////////////////////////////////////////////////////////////////////////////////////////////
540

    
541
  public float getStickerRadius()
542
    {
543
    return 0.07f;
544
    }
545

    
546
///////////////////////////////////////////////////////////////////////////////////////////////////
547

    
548
  public float getStickerStroke()
549
    {
550
    return isInIconMode() ? 0.22f : 0.12f;
551
    }
552

    
553
///////////////////////////////////////////////////////////////////////////////////////////////////
554

    
555
  public float[][] getStickerAngles()
556
    {
557
    float D = (float)(Math.PI/4);
558
    return new float[][] { { 0,0,0,-D,0 },{ 0,0,D } };
559
    }
560

    
561
///////////////////////////////////////////////////////////////////////////////////////////////////
562
// PUBLIC API
563

    
564
  public Static3D[] getRotationAxis()
565
    {
566
    return ROT_AXIS;
567
    }
568

    
569
///////////////////////////////////////////////////////////////////////////////////////////////////
570

    
571
  public int[][] getBasicAngles()
572
    {
573
    if( mBasicAngle==null )
574
      {
575
      int[] tmp = new int[] {4,4,4};
576
      mBasicAngle = new int[][] { tmp,tmp,tmp };
577
      }
578

    
579
    return mBasicAngle;
580
    }
581

    
582
///////////////////////////////////////////////////////////////////////////////////////////////////
583

    
584
  public String getShortName()
585
    {
586
    return ObjectType.CRA1_2.name();
587
    }
588

    
589
///////////////////////////////////////////////////////////////////////////////////////////////////
590

    
591
  public ObjectSignature getSignature()
592
    {
593
    return new ObjectSignature(ObjectType.CRA1_2);
594
    }
595

    
596
///////////////////////////////////////////////////////////////////////////////////////////////////
597

    
598
  public String getObjectName()
599
    {
600
    return "Circle 2x2";
601
    }
602

    
603
///////////////////////////////////////////////////////////////////////////////////////////////////
604

    
605
  public String getInventor()
606
    {
607
    return "Aleh Hladzilin";
608
    }
609

    
610
///////////////////////////////////////////////////////////////////////////////////////////////////
611

    
612
  public int getYearOfInvention()
613
    {
614
    return 2007;
615
    }
616

    
617
///////////////////////////////////////////////////////////////////////////////////////////////////
618

    
619
  public int getComplexity()
620
    {
621
    return 2;
622
    }
623

    
624
///////////////////////////////////////////////////////////////////////////////////////////////////
625

    
626
  public String[][] getTutorials()
627
    {
628
     return new String[][] {
629
                            {"gb","DKLIQghl66c","Circle 2x2 Demonstration","SuperAntoniovivaldi"},
630
                            {"es","Wq9lwfDfg4E","Resolucion Del 2X2 Crazy","RUBIKworld"},
631
                            {"br","K4bFs4BFdXc","Tutorial Crazy 2x2 de Sengso","Manzacuber"},
632
                           };
633
    }
634
}
(4-4/36)