Project

General

Profile

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

distorted-objectlib / src / main / java / org / distorted / objectlib / objects / TwistyCoinHexahedron.java @ 8f5116ec

1
///////////////////////////////////////////////////////////////////////////////////////////////////
2
// Copyright 2023 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 static org.distorted.objectlib.touchcontrol.TouchControl.TC_HEXAHEDRON;
13
import static org.distorted.objectlib.touchcontrol.TouchControl.TYPE_SPLIT_EDGE_COIN;
14

    
15
import org.distorted.library.helpers.QuatHelper;
16
import org.distorted.library.type.Static3D;
17
import org.distorted.library.type.Static4D;
18
import org.distorted.objectlib.helpers.FactoryCubit;
19
import org.distorted.objectlib.helpers.ObjectFaceShape;
20
import org.distorted.objectlib.helpers.ObjectShape;
21
import org.distorted.objectlib.metadata.Metadata;
22
import org.distorted.objectlib.helpers.ObjectVertexEffects;
23
import org.distorted.objectlib.main.InitAssets;
24
import org.distorted.objectlib.metadata.ListObjects;
25
import org.distorted.objectlib.scrambling.ScrambleEdgeGenerator;
26
import org.distorted.objectlib.shape.ShapeHexahedron;
27
import org.distorted.objectlib.touchcontrol.TouchControlHexahedron;
28

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

    
31
public class TwistyCoinHexahedron extends ShapeHexahedron
32
{
33
  static final Static3D[] ROT_AXIS = new Static3D[]
34
         {
35
           new Static3D( SQ3/3, SQ3/3, SQ3/3),
36
           new Static3D( SQ3/3, SQ3/3,-SQ3/3),
37
           new Static3D( SQ3/3,-SQ3/3, SQ3/3),
38
           new Static3D( SQ3/3,-SQ3/3,-SQ3/3),
39
           new Static3D(     1,     0,     0),
40
           new Static3D(     0,     1,     0),
41
           new Static3D(     0,     0,     1),
42
         };
43

    
44
  private static final int N = 5;
45
  private static final float C = 0.2f;
46
  private static final float D = 0.85f;
47

    
48
  private int[][] mEdges;
49
  private int[][] mBasicAngle;
50
  private float[][] mCuts;
51
  private float[][] mPosition;
52
  private int[] mQuatIndex;
53
  private boolean[][] mRotatable;
54

    
55
///////////////////////////////////////////////////////////////////////////////////////////////////
56

    
57
  public TwistyCoinHexahedron(int iconMode, Static4D quat, Static3D move, float scale, Metadata meta, InitAssets asset)
58
    {
59
    super(iconMode, meta.getNumLayers()[0], quat, move, scale, meta, asset);
60
    }
61

    
62
///////////////////////////////////////////////////////////////////////////////////////////////////
63

    
64
  public int[][] getScrambleEdges()
65
    {
66
    if( mEdges==null )
67
      {
68
      mEdges = new int[][]
69
        {
70
          {0,1,1,1, 2,2,3,2, 4,3,5,3, 6,4,7,4, 8,5,9,5, 10,6,11,6, 12,7,13,7, 14,8,15,8},
71
          {16, 9,17, 9,18, 9, 22,11,23,11,24,11, 28,13,29,13,30,13},
72
          {19,10,20,10,21,10, 25,12,26,12,27,12, 31,14,32,14,33,14},
73
          {16, 9,17, 9,18, 9, 22,11,23,11,24,11, 31,14,32,14,33,14},
74
          {19,10,20,10,21,10, 25,12,26,12,27,12, 28,13,29,13,30,13},
75
          {16, 9,17, 9,18, 9, 25,12,26,12,27,12, 28,13,29,13,30,13},
76
          {19,10,20,10,21,10, 22,11,23,11,24,11, 31,14,32,14,33,14},
77
          {16, 9,17, 9,18, 9, 25,12,26,12,27,12, 31,14,32,14,33,14},
78
          {19,10,20,10,21,10, 22,11,23,11,24,11, 28,13,29,13,30,13},
79
          { 0, 1, 1, 1,  4, 3, 5, 3,   8, 5, 9, 5,  12, 7,13, 7},
80
          { 2, 2, 3, 2,  6, 4, 7, 4,  10, 6,11, 6,  14, 8,15, 8},
81
          { 0, 1, 1, 1,  4, 3, 5, 3,  10, 6,11, 6,  14, 8,15, 8},
82
          { 2, 2, 3, 2,  6, 4, 7, 4,   8, 5, 9, 5,  12, 7,13, 7},
83
          { 0, 1, 1, 1,  6, 4, 7, 4,   8, 5, 9, 5,  14, 8,15, 8},
84
          { 2, 2, 3, 2,  4, 3, 5, 3,  10, 6,11, 6,  12, 7,13, 7}
85
        };
86
      }
87

    
88
    return mEdges;
89
    }
90

    
91
///////////////////////////////////////////////////////////////////////////////////////////////////
92

    
93
  @Override
94
  protected float[][][] getStickerStrokes()
95
    {
96
    boolean icon = isInIconMode();
97

    
98
    float S1 = icon ? 0.21f : 0.12f;
99
    float S2 = icon ? 0.21f : 0.07f;
100
    float S3 = icon ? 0.21f : 0.12f;
101

    
102
    return new float[][][] { {{ S1,S1,S1,S1,S1 }} , {{S2,S2,S2,S2}} , {{S3,S3}} };
103
    }
104

    
105
///////////////////////////////////////////////////////////////////////////////////////////////////
106

    
107
  @Override
108
  protected float[][][] getStickerRadii()
109
    {
110
    float R = 0.15f;
111
    return new float[][][] { {{ 0,R,0,0,0 }} , {{0,0,0,0}} , {{0,0}} };
112
    }
113

    
114
///////////////////////////////////////////////////////////////////////////////////////////////////
115

    
116
  @Override
117
  public int[][] getScrambleAlgorithms()
118
    {
119
    setUpRotatable();
120
    return ScrambleEdgeGenerator.getScramblingAlgorithms(mBasicAngle, mRotatable);
121
    }
122

    
123
///////////////////////////////////////////////////////////////////////////////////////////////////
124

    
125
  @Override
126
  public float[][] returnRotationFactor()
127
    {
128
    float C1 = 2.5f;
129
    float C2 = 1.0f;
130
    float[] f1 = new float[] { C1,C1,C1 };
131
    float[] f2 = new float[] { C2,C2,C2 };
132

    
133
    return new float[][] { f1,f1,f1,f1, f2,f2,f2 };
134
    }
135

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

    
138
  public float[][] getCuts(int[] numLayers)
139
    {
140
    if( mCuts==null )
141
      {
142
      float C1 = 0.75f*SQ3;
143
      float C2 = 1.49f;
144
      float[] cut1 = new float[] { -C1,C1 };
145
      float[] cut2 = new float[] { -C2,C2 };
146
      mCuts = new float[][] { cut1,cut1,cut1,cut1,cut2,cut2,cut2 };
147
      }
148

    
149
    return mCuts;
150
    }
151

    
152
///////////////////////////////////////////////////////////////////////////////////////////////////
153

    
154
  private void setUpRotatable()
155
    {
156
    if( mRotatable==null )
157
      {
158
      boolean[] tmp = new boolean[] {true,false,true};
159
      mRotatable = new boolean[][] { tmp,tmp,tmp,tmp,tmp,tmp,tmp };
160
      }
161
    }
162

    
163
///////////////////////////////////////////////////////////////////////////////////////////////////
164

    
165
  public boolean[][] getLayerRotatable(int[] numLayers)
166
    {
167
    setUpRotatable();
168
    return mRotatable;
169
    }
170

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

    
173
  public int getTouchControlType()
174
    {
175
    return TC_HEXAHEDRON;
176
    }
177

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

    
180
  public int getTouchControlSplit()
181
    {
182
    return TYPE_SPLIT_EDGE_COIN;
183
    }
184

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

    
187
  public int[][][] getEnabled()
188
    {
189
    return new int[][][]
190
      {
191
         {{4},{4},{4},{4},{1},{3},{2},{0}},
192
         {{4},{4},{4},{4},{3},{1},{0},{2}},
193
         {{5},{5},{5},{5},{1},{0},{3},{2}},
194
         {{5},{5},{5},{5},{2},{3},{0},{1}},
195
         {{6},{6},{6},{6},{0},{2},{1},{3}},
196
         {{6},{6},{6},{6},{2},{0},{3},{1}},
197
      };
198
    }
199

    
200
///////////////////////////////////////////////////////////////////////////////////////////////////
201

    
202
  public float[] getDist3D(int[] numLayers)
203
    {
204
    return TouchControlHexahedron.D3D;
205
    }
206

    
207
///////////////////////////////////////////////////////////////////////////////////////////////////
208

    
209
  public Static3D[] getFaceAxis()
210
    {
211
    return TouchControlHexahedron.FACE_AXIS;
212
    }
213

    
214
///////////////////////////////////////////////////////////////////////////////////////////////////
215

    
216
  public float[][] getCubitPositions(int[] numLayers)
217
    {
218
    if( mPosition==null )
219
      {
220
      final float A = 1.48f-C;
221
      final float B = 1.52f;
222
      final float Z = 1.50f;
223
      final float E = 0.75f*D;
224

    
225
      mPosition = new float[][]
226
         {
227
             { A, A, A},
228
             { A, A,-A},
229
             { A,-A, A},
230
             { A,-A,-A},
231
             {-A, A, A},
232
             {-A, A,-A},
233
             {-A,-A, A},
234
             {-A,-A,-A},
235

    
236
             { 0, 0, B },
237
             { 0, 0,-B },
238
             { 0, B, 0 },
239
             { 0,-B, 0 },
240
             { B, 0, 0 },
241
             {-B, 0, 0 },
242

    
243
             { E, E, Z},
244
             { E,-E, Z},
245
             {-E, E, Z},
246
             {-E,-E, Z},
247
             { E, E,-Z},
248
             { E,-E,-Z},
249
             {-E, E,-Z},
250
             {-E,-E,-Z},
251
             { E, Z, E},
252
             { E, Z,-E},
253
             {-E, Z, E},
254
             {-E, Z,-E},
255
             { E,-Z, E},
256
             { E,-Z,-E},
257
             {-E,-Z, E},
258
             {-E,-Z,-E},
259
             { Z, E, E},
260
             { Z, E,-E},
261
             { Z,-E, E},
262
             { Z,-E,-E},
263
             {-Z, E, E},
264
             {-Z, E,-E},
265
             {-Z,-E, E},
266
             {-Z,-E,-E},
267
         };
268
      }
269

    
270
    return mPosition;
271
    }
272

    
273
///////////////////////////////////////////////////////////////////////////////////////////////////
274

    
275
  public Static4D getCubitQuats(int cubit, int[] numLayers)
276
    {
277
    if( mQuatIndex==null ) mQuatIndex = new int[] {0,9,11,4,12,3,6,21,
278
                                                   0,10,1,4,2,3,
279
                                                   0,15,17,16,19,10,13,23,1,9,20,7, 11,4,6,21,2,14,18,5,12,3,8,22 };
280
    return mObjectQuats[mQuatIndex[cubit]];
281
    }
282

    
283
///////////////////////////////////////////////////////////////////////////////////////////////////
284

    
285
  private float[] rotateVertices(float angle, float[] vector, float[] center, float[] rotAxis)
286
    {
287
    float[] ret = new float[4];
288
    float sin = (float)Math.sin(angle/2);
289
    float cos = (float)Math.cos(angle/2);
290
    float[] quat= new float[] { sin*rotAxis[0], sin*rotAxis[1], sin*rotAxis[2], cos};
291
    QuatHelper.rotateVectorByQuat(ret,vector,quat);
292

    
293
    ret[0] += center[0];
294
    ret[1] += center[1];
295
    ret[2] += center[2];
296

    
297
    return ret;
298
    }
299

    
300
///////////////////////////////////////////////////////////////////////////////////////////////////
301

    
302
  private float[][] produceCorner()
303
    {
304
    final float angle = (float)Math.PI/(2*N);
305
    final float A = 0.3f;
306
    final int N1 = 4;
307
    final int N2 = N1 + N + 1;
308
    final int N3 = N2 + N + 1;
309
    float[][] vertices= new float[3*N+8][3];
310

    
311
    vertices[3*N+7][0] = -A;
312
    vertices[3*N+7][1] = -A;
313
    vertices[3*N+7][2] = -A;
314

    
315
    vertices[0][0] = 0;
316
    vertices[0][1] = 0;
317
    vertices[0][2] = 0;
318
    vertices[1][0] =-2;
319
    vertices[1][1] = 0;
320
    vertices[1][2] = 0;
321
    vertices[2][0] = 0;
322
    vertices[2][1] =-2;
323
    vertices[2][2] = 0;
324
    vertices[3][0] = 0;
325
    vertices[3][1] = 0;
326
    vertices[3][2] =-2;
327

    
328
    for(int i=0; i<=N; i++)
329
      {
330
      float cos1 = (float)Math.cos((N-i)*angle);
331
      float sin1 = (float)Math.sin((N-i)*angle);
332
      float cos2 = (float)Math.cos((  i)*angle);
333
      float sin2 = (float)Math.sin((  i)*angle);
334

    
335
      vertices[N1+i][0] = 2*D*cos1-2;
336
      vertices[N1+i][1] = 2*D*sin1-2;
337
      vertices[N1+i][2] = 0;
338

    
339
      vertices[N2+i][0] = 0;
340
      vertices[N2+i][1] = 2*D*sin2-2;
341
      vertices[N2+i][2] = 2*D*cos2-2;
342

    
343
      vertices[N3+i][0] = 2*D*cos2-2;
344
      vertices[N3+i][1] = 0;
345
      vertices[N3+i][2] = 2*D*sin2-2;
346
      }
347

    
348
    for(int i=0; i<3*N+8; i++)
349
      {
350
      vertices[i][0] = 0.75f*vertices[i][0] + C;
351
      vertices[i][1] = 0.75f*vertices[i][1] + C;
352
      vertices[i][2] = 0.75f*vertices[i][2] + C;
353
      }
354

    
355
    return vertices;
356
    }
357

    
358
///////////////////////////////////////////////////////////////////////////////////////////////////
359

    
360
  private float[][] produceCenter()
361
    {
362
    float[][] ret = new float[4*N+1][];
363

    
364
    float[] rot = new float[] { 0,0,-1 };
365

    
366
    float[] center1 = { 1.5f*D, 1.5f*D, 0  };
367
    float[] center2 = { 1.5f*D,-1.5f*D, 0  };
368
    float[] center3 = {-1.5f*D,-1.5f*D, 0  };
369
    float[] center4 = {-1.5f*D, 1.5f*D, 0  };
370

    
371
    float[] vect1 = { -1.5f*D,0,0,0 };
372
    float[] vect2 = { 0, 1.5f*D,0,0 };
373
    float[] vect3 = {  1.5f*D,0,0,0 };
374
    float[] vect4 = { 0,-1.5f*D,0,0 };
375

    
376
    for(int i=0; i<N; i++)
377
      {
378
      float angle = (float)(Math.PI/2)*i/N;
379

    
380
      ret[i    ] = rotateVertices(angle, vect1, center1, rot);
381
      ret[i+  N] = rotateVertices(angle, vect2, center2, rot);
382
      ret[i+2*N] = rotateVertices(angle, vect3, center3, rot);
383
      ret[i+3*N] = rotateVertices(angle, vect4, center4, rot);
384
      }
385

    
386
    ret[4*N] = new float[] { 0, 0, -1.5f };
387

    
388
    return ret;
389
    }
390

    
391
///////////////////////////////////////////////////////////////////////////////////////////////////
392

    
393
  private float[][] produceLeaf()
394
    {
395
    float[][] ret = new float[2*N+1][];
396

    
397
    float[] rot = new float[] { 0,0,1 };
398

    
399
    float[] center1 = {-0.75f*D,-0.75f*D, 0 };
400
    float[] center2 = { 0.75f*D, 0.75f*D, 0 };
401

    
402
    float[] vect1 = {  0, 1.5f*D, 0, 0 };
403
    float[] vect2 = {  0,-1.5f*D, 0, 0 };
404

    
405
    for(int i=0; i<N; i++)
406
      {
407
      float angle = (float)(Math.PI/2)*i/N;
408

    
409
      ret[  N-1-i] = rotateVertices(angle, vect1, center1, rot);
410
      ret[2*N-1-i] = rotateVertices(angle, vect2, center2, rot);
411
      }
412

    
413
    ret[2*N] = new float[] { 0, 0, -1.5f/10 };
414

    
415
    return ret;
416
    }
417

    
418
///////////////////////////////////////////////////////////////////////////////////////////////////
419

    
420
  private float[][] getVertices(int variant)
421
    {
422
         if( variant==0 ) return produceCorner();
423
    else if( variant==1 ) return produceCenter();
424
    else                  return produceLeaf();
425
    }
426

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

    
429
  private int[][] produceCornerShape()
430
    {
431
    int[][] indices = new int[3*N+9][];
432

    
433
    indices[0] = new int[N+4];
434
    indices[1] = new int[N+4];
435
    indices[2] = new int[N+4];
436

    
437
    indices[0][0] = 2;
438
    indices[0][1] = 0;
439
    indices[0][2] = 1;
440
    indices[1][0] = 3;
441
    indices[1][1] = 0;
442
    indices[1][2] = 2;
443
    indices[2][0] = 1;
444
    indices[2][1] = 0;
445
    indices[2][2] = 3;
446

    
447
    int N1 = 4;
448
    int N2 = N1 + N + 1;
449
    int N3 = N2 + N + 1;
450

    
451
    for(int i=0; i<=N; i++)
452
      {
453
      indices[0][i+3] = N1 + i;
454
      indices[1][i+3] = N2 + i;
455
      indices[2][i+3] = N3 + i;
456
      }
457

    
458
    for(int i=0; i<N; i++)
459
      {
460
      indices[3*i+3] = new int[] { N1+i+1, N1+i, 3*N+7 };
461
      indices[3*i+4] = new int[] { N2+i+1, N2+i, 3*N+7 };
462
      indices[3*i+5] = new int[] { N3+i+1, N3+i, 3*N+7 };
463
      }
464

    
465
    indices[3*N+3] = new int[] { 2    , 4+  N, 3*N+7 };
466
    indices[3*N+4] = new int[] { 5  +N, 2    , 3*N+7 };
467
    indices[3*N+5] = new int[] { 5+2*N, 3    , 3*N+7 };
468
    indices[3*N+6] = new int[] { 3    , 6+2*N, 3*N+7 };
469
    indices[3*N+7] = new int[] { 1    , 6+3*N, 3*N+7 };
470
    indices[3*N+8] = new int[] { 4    , 1    , 3*N+7 };
471

    
472
    return indices;
473
    }
474

    
475
///////////////////////////////////////////////////////////////////////////////////////////////////
476

    
477
  private int[][] produceCenterShape()
478
    {
479
    int[][] ret = new int[1+4*N][];
480

    
481
    ret[0] = new int[4*N];
482
    for(int i=0; i<4*N; i++) ret[0][i] = 4*N-1-i;
483

    
484
    for(int i=0; i<N; i++)
485
      {
486
      ret[i+1] = new int[3];
487
      ret[i+1][0] = i;
488
      ret[i+1][1] = i+1;
489
      ret[i+1][2] = 4*N;
490

    
491
      ret[N+i+1] = new int[3];
492
      ret[N+i+1][0] = N+i;
493
      ret[N+i+1][1] = N+i+1;
494
      ret[N+i+1][2] = 4*N;
495

    
496
      ret[2*N+i+1] = new int[3];
497
      ret[2*N+i+1][0] = 2*N+i;
498
      ret[2*N+i+1][1] = 2*N+i+1;
499
      ret[2*N+i+1][2] = 4*N;
500

    
501
      ret[3*N+i+1] = new int[3];
502
      ret[3*N+i+1][0] = 3*N+i;
503
      ret[3*N+i+1][1] = i<N-1 ? 3*N+i+1 : 0;
504
      ret[3*N+i+1][2] = 4*N;
505
      }
506

    
507
    return ret;
508
    }
509

    
510
///////////////////////////////////////////////////////////////////////////////////////////////////
511

    
512
  private int[][] produceLeafShape()
513
    {
514
    int[][] ret = new int[2*N+1][];
515

    
516
    ret[0] = new int[2*N];
517
    for(int i=0; i<2*N; i++) ret[0][i] = i;
518

    
519
    for(int i=1; i<=N-1; i++)
520
      {
521
      ret[i] = new int[3];
522
      ret[i][0] = i;
523
      ret[i][1] = i-1;
524
      ret[i][2] = 2*N;
525

    
526
      ret[N-1+i] = new int[3];
527
      ret[N-1+i][0] = N+i;
528
      ret[N-1+i][1] = N+i-1;
529
      ret[N-1+i][2] = 2*N;
530
      }
531

    
532
    ret[2*N-1] = new int[] { N,  N-1, 2*N };
533
    ret[2*N  ] = new int[] { 0,2*N-1, 2*N };
534

    
535
    return ret;
536
    }
537

    
538
///////////////////////////////////////////////////////////////////////////////////////////////////
539

    
540
  public ObjectShape getObjectShape(int variant)
541
    {
542
    if( variant==0 )
543
      {
544
      int[][] indices = produceCornerShape();
545
      return new ObjectShape(getVertices(variant), indices);
546
      }
547
    else if( variant==1 )
548
      {
549
      int[][] indices = produceCenterShape();
550
      return new ObjectShape(getVertices(variant), indices);
551
      }
552
    else
553
      {
554
      int[][] indices = produceLeafShape();
555
      return new ObjectShape(getVertices(variant), indices);
556
      }
557
    }
558

    
559
///////////////////////////////////////////////////////////////////////////////////////////////////
560

    
561
  public ObjectFaceShape getObjectFaceShape(int variant)
562
    {
563
    if( variant==0 )
564
      {
565
      float h1 = isInIconMode() ? 0.0001f : 0.03f;
566
      float h2 = isInIconMode() ? 0.0001f : 0.01f;
567
      float[][] bands = { {h1,35,0.2f,0.4f,5,2,1}, {h2,35,0.2f,0.4f,2,0,0} };
568
      int num = 3*N+9;
569
      int[] indices = new int[num];
570
      for(int i=3; i<num; i++) indices[i] = 1;
571
      float S = 1-SQ2/2 - C;
572
      float[] convexCenter = {-S,-S,-S };
573
      return new ObjectFaceShape(bands,indices,convexCenter);
574
      }
575
    else if( variant==1 )
576
      {
577
      float h1 = isInIconMode() ? 0.0001f : 0.001f;
578
      float h2 = 0.0001f;
579
      float[][] bands = { {h1,5,0.2f,0.4f,5,0,0}, {h2,5,0.05f,0.1f,2,0,0} };
580
      int num = 1+4*N;
581
      int[] indices   = new int[num];
582
      for(int i=1; i<num; i++) indices[i] = 1;
583
      return new ObjectFaceShape(bands,indices,null);
584
      }
585
    else
586
      {
587
      float h1 = isInIconMode() ? 0.0001f : 0.015f;
588
      float h2 = isInIconMode() ? 0.0001f : 0.001f;
589
      float[][] bands = { {h1,25,0.250f,0.7f,5,0,0}, {h2,25,0.125f,0.2f,2,0,0} };
590
      int num = 1+2*N;
591
      int[] indices   = new int[num];
592
      for(int i=1; i<num; i++) indices[i] = 1;
593
      return new ObjectFaceShape(bands,indices,null);
594
      }
595
    }
596

    
597
///////////////////////////////////////////////////////////////////////////////////////////////////
598

    
599
  public ObjectVertexEffects getVertexEffects(int variant)
600
    {
601
    if( variant==0 )
602
      {
603
      float[][] corners = { {0.05f,0.15f} };
604
      int num = 8+3*N;
605
      int[] indices = new int[num];
606
      for(int i=1; i<num; i++) indices[i] = -1;
607
      float[][] centers = {{ 0,0,0 }};
608
      return FactoryCubit.generateVertexEffect(getVertices(variant),corners,indices,centers,indices);
609
      }
610
    else if( variant==1 )
611
      {
612
      float[][] corners = { {0.05f,0.20f} };
613
      int num = 1+4*N;
614
      int[] indices = new int[num];
615
      for(int i=0; i<num; i++) indices[i] = -1;
616
      float[][] centers = { { 0,0,0 } };
617
      return FactoryCubit.generateVertexEffect(getVertices(variant),corners,indices,centers,indices);
618
      }
619
    else
620
      {
621
      float[][] corners = { {0.05f,0.20f} };
622
      int num = 1+2*N;
623
      int[] indices = new int[num];
624
      for(int i=0; i<num; i++) indices[i] = -1;
625
      float[][] centers = { { 0,0,0 } };
626
      return FactoryCubit.generateVertexEffect(getVertices(variant),corners,indices,centers,indices);
627
      }
628
    }
629

    
630
///////////////////////////////////////////////////////////////////////////////////////////////////
631

    
632
  public int getNumCubitVariants(int[] numLayers)
633
    {
634
    return 3;
635
    }
636

    
637
///////////////////////////////////////////////////////////////////////////////////////////////////
638

    
639
  public int getCubitVariant(int cubit, int[] numLayers)
640
    {
641
    return cubit<8 ? 0 : (cubit<14 ? 1:2);
642
    }
643

    
644
///////////////////////////////////////////////////////////////////////////////////////////////////
645
// doesn't matter, we are overriding getStickerRadii() anyway
646

    
647
  public float getStickerRadius()
648
    {
649
    return 0.0f;
650
    }
651

    
652
///////////////////////////////////////////////////////////////////////////////////////////////////
653
// doesn't matter, we are overriding getStickerStrokes() anyway
654

    
655
  public float getStickerStroke()
656
    {
657
    return 0.0f;
658
    }
659

    
660
///////////////////////////////////////////////////////////////////////////////////////////////////
661
// ditto, manually provide the sticker coordinates.
662

    
663
  @Override
664
  public void adjustStickerCoords()
665
    {
666
    float A = 0.38f;
667
    float B = 0.24f;
668
    float C = 0.50f;
669
    float D = 0.00f;
670

    
671
    mStickerCoords = new float[][][][]
672
          {
673
                  { { { A,-C}, { A, A}, {-C, A}, {-C, B}, {B,-C} } },
674
                  { { { C, D}, { D, C}, {-C, D}, { D,-C} } },
675
                  { { { C,-C}, {-C, C} } }
676
          };
677
    }
678

    
679
///////////////////////////////////////////////////////////////////////////////////////////////////
680

    
681
  public float[][][] getStickerAngles()
682
    {
683
    float D = (float)(Math.PI/2);
684
    return new float[][][] { {{ 0,0,0,-D,0 }} , {{-D,-D,-D,-D}} , {{D,D}} };
685
    }
686

    
687
///////////////////////////////////////////////////////////////////////////////////////////////////
688
// PUBLIC API
689

    
690
  public Static3D[] getRotationAxis()
691
    {
692
    return ROT_AXIS;
693
    }
694

    
695
///////////////////////////////////////////////////////////////////////////////////////////////////
696

    
697
  public int[][] getBasicAngles()
698
    {
699
    if( mBasicAngle ==null )
700
      {
701
      int[] tmp1 = {3,3,3};
702
      int[] tmp2 = {4,4,4};
703
      mBasicAngle = new int[][] { tmp1,tmp1,tmp1,tmp1,tmp2,tmp2,tmp2 };
704
      }
705

    
706
    return mBasicAngle;
707
    }
708

    
709
///////////////////////////////////////////////////////////////////////////////////////////////////
710

    
711
  public String getShortName()
712
    {
713
    return ListObjects.COIH_3.name();
714
    }
715

    
716
///////////////////////////////////////////////////////////////////////////////////////////////////
717

    
718
  public String[][] getTutorials()
719
    {
720
    return new String[][] {
721
                          {"gb","8hPxLbZDSLQ","Chinese Coin Cube","CanChrisSolve"},
722
                          {"es","rK0_IsjoZqM","Ancient Coin Cube","R de Rubik"},
723
                          {"ru","HVZj2vBxD5A","Как собрать Коин Куб","Алексей Ярыгин"},
724
                          {"pl","yaNeIw4C5Uk","Ancient coin cube TUTORIAL PL","MrUK"},
725
                          {"tw","B7oD3pAXBVY","銅幣魔方教學","不正常魔術方塊研究中心"},
726
                         };
727
    }
728
}
(9-9/59)