Project

General

Profile

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

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

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
  public static final int CIRCLE = 0x29;
44

    
45
  private static final float DIAMETER_RATIO = 0.60f;
46
  private static final float DIFF = 1.0f;
47
  private static final int NUMBER_CORNER_SEGMENTS = 4;
48

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

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

    
63
///////////////////////////////////////////////////////////////////////////////////////////////////
64

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

    
70
///////////////////////////////////////////////////////////////////////////////////////////////////
71

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

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

    
86
///////////////////////////////////////////////////////////////////////////////////////////////////
87

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

    
94
///////////////////////////////////////////////////////////////////////////////////////////////////
95

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

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

    
117
    return mOffsets[cubitIndex];
118
    }
119

    
120
///////////////////////////////////////////////////////////////////////////////////////////////////
121
// Normal 2x2
122

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

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

    
135
    return mStates;
136
    }
137

    
138
///////////////////////////////////////////////////////////////////////////////////////////////////
139

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

    
148
    return mCuts;
149
    }
150

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

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

    
159
///////////////////////////////////////////////////////////////////////////////////////////////////
160

    
161
  public int getTouchControlType()
162
    {
163
    return TC_HEXAHEDRON;
164
    }
165

    
166
///////////////////////////////////////////////////////////////////////////////////////////////////
167

    
168
  public int getTouchControlSplit()
169
    {
170
    return TYPE_NOT_SPLIT;
171
    }
172

    
173
///////////////////////////////////////////////////////////////////////////////////////////////////
174

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

    
180
///////////////////////////////////////////////////////////////////////////////////////////////////
181

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

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

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

    
194
///////////////////////////////////////////////////////////////////////////////////////////////////
195

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

    
202
      mPositions = new float[][]
203
         {
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
             {-0.5f,-0.5f, 0.5f},
211
             {-0.5f,-0.5f,-0.5f},
212

    
213
             { E, 0.5f,-0.5f}, //
214
             { 0.5f, E,-0.5f}, // Deciders first
215
             { 0.5f, 0.5f,-E}, //
216

    
217
             { 0.5f, 0.5f, E},
218

    
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,-0.5f, E},
224
             {-0.5f,-0.5f,-E},
225
             { 0.5f, E, 0.5f},
226
             { 0.5f,-E, 0.5f},
227

    
228
             { 0.5f,-E,-0.5f},
229
             {-0.5f, E, 0.5f},
230
             {-0.5f,-E, 0.5f},
231
             {-0.5f, E,-0.5f},
232
             {-0.5f,-E,-0.5f},
233
             { E, 0.5f, 0.5f},
234
             {-E, 0.5f, 0.5f},
235

    
236
             {-E, 0.5f,-0.5f},
237
             { E,-0.5f, 0.5f},
238
             {-E,-0.5f, 0.5f},
239
             { E,-0.5f,-0.5f},
240
             {-E,-0.5f,-0.5f},
241
         };
242
      }
243

    
244
    return mPositions;
245
    }
246

    
247
///////////////////////////////////////////////////////////////////////////////////////////////////
248

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

    
257
///////////////////////////////////////////////////////////////////////////////////////////////////
258

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

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

    
275
    float[][] vertices = new float[NUM_VERTICES][];
276

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

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

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

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

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

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

    
307
    final int NUM_FACES = 6 + 3*NUMBER_CORNER_SEGMENTS;
308
    final int NUM_VERTS = 4 +   NUMBER_CORNER_SEGMENTS;
309

    
310
    int[][] indices = new int[NUM_FACES][];
311

    
312
    indices[0] = new int[NUM_VERTS];
313
    indices[1] = new int[NUM_VERTS];
314
    indices[2] = new int[NUM_VERTS];
315

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    
404
    return new ObjectShape(vertices,indices);
405
    }
406

    
407
///////////////////////////////////////////////////////////////////////////////////////////////////
408

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

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

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

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

    
435
    final int NUM_FACES = 4 + NUMBER_CORNER_SEGMENTS;
436
    int[][] indices = new int[NUM_FACES][];
437

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

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

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

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

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

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

    
467
    return new ObjectShape(vertices,indices);
468
    }
469

    
470
///////////////////////////////////////////////////////////////////////////////////////////////////
471

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

    
480
    return null;
481
    }
482

    
483
///////////////////////////////////////////////////////////////////////////////////////////////////
484

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

    
527
///////////////////////////////////////////////////////////////////////////////////////////////////
528

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

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

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

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

    
543
  public float getStickerRadius()
544
    {
545
    return 0.07f;
546
    }
547

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

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

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

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

    
563
///////////////////////////////////////////////////////////////////////////////////////////////////
564
// PUBLIC API
565

    
566
  public Static3D[] getRotationAxis()
567
    {
568
    return ROT_AXIS;
569
    }
570

    
571
///////////////////////////////////////////////////////////////////////////////////////////////////
572

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

    
581
    return mBasicAngle;
582
    }
583

    
584
///////////////////////////////////////////////////////////////////////////////////////////////////
585

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

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

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

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

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

    
605
///////////////////////////////////////////////////////////////////////////////////////////////////
606

    
607
  public String getInventor()
608
    {
609
    return "Aleh Hladzilin";
610
    }
611

    
612
///////////////////////////////////////////////////////////////////////////////////////////////////
613

    
614
  public int getYearOfInvention()
615
    {
616
    return 2007;
617
    }
618

    
619
///////////////////////////////////////////////////////////////////////////////////////////////////
620

    
621
  public int getComplexity()
622
    {
623
    return 2;
624
    }
625

    
626
///////////////////////////////////////////////////////////////////////////////////////////////////
627

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