Project

General

Profile

« Previous | Next » 

Revision bb85236a

Added by Leszek Koltunski 11 months ago

Implement TwistyBandagedPyraminx

View differences:

src/main/java/org/distorted/objectlib/bandaged/BandagedObject.java
32 32

  
33 33
///////////////////////////////////////////////////////////////////////////////////////////////////
34 34

  
35
   BandagedObject(DistortedScreen screen)
35
   BandagedObject(DistortedScreen screen, int numRotAxis)
36 36
     {
37 37
     mScreen = screen;
38
     mSize = new int[3];
38
     mSize = new int[numRotAxis];
39 39
     mDist2D = getDist2D();
40 40
     Static3D[] axis = getFaceAxis();
41 41
     int numAxis = axis.length;
src/main/java/org/distorted/objectlib/bandaged/BandagedObjectCuboid.java
79 79

  
80 80
  public BandagedObjectCuboid(DistortedScreen screen)
81 81
     {
82
     super(screen);
82
     super(screen,3);
83 83
     }
84 84

  
85 85
///////////////////////////////////////////////////////////////////////////////////////////////////
src/main/java/org/distorted/objectlib/bandaged/BandagedObjectPyraminx.java
121 121

  
122 122
  public BandagedObjectPyraminx(DistortedScreen screen)
123 123
    {
124
    super(screen);
124
    super(screen,4);
125 125
    }
126 126

  
127 127
///////////////////////////////////////////////////////////////////////////////////////////////////
......
153 153
    if( mSize[0]!=x )
154 154
      {
155 155
      mSize[0] = x;
156
      mMax = mSize[0];
156
      mSize[1] = x;
157
      mSize[2] = x;
158
      mSize[3] = x;
159

  
160
      mMax = x;
157 161
      int numOcta = (x-1)*x*(x+1)/6;
158 162
      int numTetra= x*(x+1)*(x+2)/6;
159 163
      mNumCubits = numOcta + numTetra;
src/main/java/org/distorted/objectlib/bandaged/FactoryBandagedPyraminx.java
142 142
// and 'size' is mNumLayers[0]-1 in case of Octahedrons and mNumLayers[0] in case of Tetrahedrons.
143 143
// From the above, the below quickly follows. +20*num1 to avoid negative values.
144 144

  
145
  public static int getElementVariant(int size, float y)
146
    {
147
    int num = (int)(2*SQ2*y + 20*size + 0.1f);
148
    return (num-size)%2;
149
    }
150

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

  
145 153
  public int getElementVariant(float x, float y, float z)
146 154
    {
147
    int num1 = mNumLayers[0];
148
    int num2 = (int)(2*SQ2*y + 20*num1 + 0.1f);
149
    return (num2-num1)%2;
155
    return getElementVariant(mNumLayers[0],y);
150 156
    }
151 157

  
152 158
///////////////////////////////////////////////////////////////////////////////////////////////////
src/main/java/org/distorted/objectlib/helpers/FactoryCubit.java
1378 1378
    float[] convexityCenter = faceShape.getConvexityCenter();
1379 1379

  
1380 1380
    int numFaces = shape.getNumFaces();
1381
    boolean multigonMode = shape.isMultigon();
1382 1381
    float[] band, bandsComputed;
1383 1382
    MeshBase[] meshes = new MeshBase[numFaces];
1384 1383
    FaceTransform fInfo;
src/main/java/org/distorted/objectlib/objects/TwistyBandagedCuboid.java
503 503

  
504 504
  public ObjectFaceShape getObjectFaceShape(int variant)
505 505
    {
506
    int[] numLayers = getNumLayers();
507
    int size = (numLayers[0]+numLayers[1]+numLayers[2])/3;
508 506
    int[] dim = getDim(variant);
507
    FactoryBandagedCuboid factory = FactoryBandagedCuboid.getInstance();
509 508

  
510 509
    if( dim!=null )
511 510
      {
511
      boolean iconMode = isInIconMode();
512
      float[][] bands = factory.getBands(iconMode);
513

  
512 514
      int X = dim[0];
513 515
      int Y = dim[1];
514 516
      int Z = dim[2];
517
      int DX = Math.max(Y,Z);
518
      int DY = Math.max(X,Z);
519
      int DZ = Math.max(X,Y);
515 520

  
516
      float height     = isInIconMode() ? 0.001f : size<=5 ? 0.048f : 0.020f;
517
      int[] bandIndices= { 0,0,1,1,2,2 };
518

  
519
      int maxXY = Math.max(X,Y);
520
      int maxXZ = Math.max(X,Z);
521
      int maxYZ = Math.max(Y,Z);
522

  
523
      int angle = 45;
524
      float R = 0.25f;
525
      float S = 0.50f;
526
      float N = size<=4 ? 5 : size<=5 ? 4 : 3;
527

  
528
      float[][] bands =
529
        {
530
          {height/maxYZ,angle,R,S,N,0,0},
531
          {height/maxXZ,angle,R,S,N,0,0},
532
          {height/maxXY,angle,R,S,N,0,0}
533
        };
521
      int[] bandIndices= { DX,DX,DY,DY,DZ,DZ };
534 522

  
535 523
      return new ObjectFaceShape(bands,bandIndices,null);
536 524
      }
537 525

  
538
    FactoryBandagedCuboid factory = FactoryBandagedCuboid.getInstance();
526

  
539 527
    return factory.createIrregularFaceShape(variant, isInIconMode() );
540 528
    }
541 529

  
src/main/java/org/distorted/objectlib/objects/TwistyBandagedPyraminx.java
1 1
///////////////////////////////////////////////////////////////////////////////////////////////////
2
// Copyright 2021 Leszek Koltunski                                                               //
2
// Copyright 2023 Leszek Koltunski                                                               //
3 3
//                                                                                               //
4 4
// This file is part of Magic Cube.                                                              //
5 5
//                                                                                               //
......
9 9

  
10 10
package org.distorted.objectlib.objects;
11 11

  
12
import static org.distorted.objectlib.touchcontrol.TouchControl.TC_CUBOID;
12
import static org.distorted.objectlib.touchcontrol.TouchControl.TC_TETRAHEDRON;
13
import static org.distorted.objectlib.touchcontrol.TouchControl.TYPE_NOT_SPLIT;
13 14

  
14 15
import org.distorted.library.effect.EffectName;
15 16
import org.distorted.library.main.DistortedLibrary;
16 17
import org.distorted.library.type.Static3D;
17 18
import org.distorted.library.type.Static4D;
18
import org.distorted.objectlib.bandaged.FactoryBandagedCuboid;
19
import org.distorted.objectlib.bandaged.FactoryBandagedPyraminx;
19 20
import org.distorted.objectlib.helpers.ObjectFaceShape;
20 21
import org.distorted.objectlib.helpers.ObjectShape;
21 22
import org.distorted.objectlib.helpers.ObjectSignature;
22 23
import org.distorted.objectlib.helpers.ObjectVertexEffects;
23 24
import org.distorted.objectlib.main.InitAssets;
24 25
import org.distorted.objectlib.main.InitData;
25
import org.distorted.objectlib.main.ObjectType;
26 26
import org.distorted.objectlib.scrambling.ObjectScrambler;
27
import org.distorted.objectlib.shape.ShapeTetrahedron;
28
import org.distorted.objectlib.touchcontrol.TouchControlTetrahedron;
27 29

  
28 30
///////////////////////////////////////////////////////////////////////////////////////////////////
29 31

  
30
public class TwistyBandagedPyraminx extends TwistyBandagedAbstract
32
public class TwistyBandagedPyraminx extends ShapeTetrahedron
31 33
{
32
  public static final String OBJECT_NAME = "LOCAL_BANDAGED";
34
  public static final String OBJECT_NAME = "LOCAL_PYRAMINX";
33 35

  
34
  private static final int CUBIT_111 = 0;
35
  private static final int CUBIT_211 = 1;
36
  private static final int CUBIT_311 = 2;
37
  private static final int CUBIT_221 = 3;
38
  private static final int CUBIT_222 = 4;
39
  private static final int CUBIT_OTH = 5;
40

  
41
  private static final int[][] mDims = new int[][]
42
        {
43
         {1,1,1},  // has to be X>=Z>=Y so that all
44
         {2,1,1},  // the faces are horizontal
45
         {3,1,1},
46
         {2,1,2},
47
         {2,2,2},
48
        };
49

  
50
  // Fused Cube
51
  public static final float[][] POS_1 = new float[][]
52
        {
53
          {-1.0f, -1.0f, +0.0f, -1.0f, -1.0f, +1.0f, -1.0f,  0.0f, +0.0f, -1.0f,  0.0f, +1.0f,
54
            0.0f, -1.0f, +0.0f,  0.0f, -1.0f, +1.0f,  0.0f,  0.0f, +0.0f,  0.0f,  0.0f, +1.0f },
55
          {-1.0f, +1.0f, +1.0f},
56
          {-1.0f, +1.0f, +0.0f},
57
          {-1.0f, +1.0f, -1.0f},
58
          { 0.0f, +1.0f, +1.0f},
59
          { 0.0f, +1.0f, +0.0f},
60
          { 0.0f, +1.0f, -1.0f},
61
          { 1.0f, +1.0f, +1.0f},
62
          { 1.0f, +1.0f, +0.0f},
63
          { 1.0f, +1.0f, -1.0f},
64
          { 1.0f,  0.0f, +1.0f},
65
          { 1.0f,  0.0f, +0.0f},
66
          { 1.0f,  0.0f, -1.0f},
67
          { 1.0f, -1.0f, +1.0f},
68
          { 1.0f, -1.0f, +0.0f},
69
          { 1.0f, -1.0f, -1.0f},
70
          {-1.0f, -1.0f, -1.0f},
71
          {-1.0f,  0.0f, -1.0f},
72
          { 0.0f, -1.0f, -1.0f},
73
          { 0.0f,  0.0f, -1.0f}
74
        };
75

  
76
  // 2-bar cube
77
  public static final float[][] POS_2 = new float[][]
36
  private static final Static3D[] ROT_AXIS = new Static3D[]
78 37
        {
79
          { 0.0f, +1.0f,  1.0f, 0.0f, +1.0f,  0.0f, 0.0f, +1.0f, -1.0f},
80
          {-1.0f, -1.0f,  0.0f, 0.0f, -1.0f,  0.0f, 1.0f, -1.0f,  0.0f},
81
          {-1.0f, +1.0f, +1.0f},
82
          {-1.0f, +1.0f,  0.0f},
83
          {-1.0f, +1.0f, -1.0f},
84
          {-1.0f,  0.0f, +1.0f},
85
          {-1.0f,  0.0f,  0.0f},
86
          {-1.0f,  0.0f, -1.0f},
87
          {-1.0f, -1.0f, +1.0f},
88
          {-1.0f, -1.0f, -1.0f},
89
          {+1.0f, +1.0f, +1.0f},
90
          {+1.0f, +1.0f,  0.0f},
91
          {+1.0f, +1.0f, -1.0f},
92
          {+1.0f,  0.0f, +1.0f},
93
          {+1.0f,  0.0f,  0.0f},
94
          {+1.0f,  0.0f, -1.0f},
95
          {+1.0f, -1.0f, +1.0f},
96
          {+1.0f, -1.0f, -1.0f},
97
          { 0.0f,  0.0f, +1.0f},
98
          { 0.0f, -1.0f, +1.0f},
99
          { 0.0f,  0.0f, -1.0f},
100
          { 0.0f, -1.0f, -1.0f}
38
                new Static3D(     0,-SQ3/3,-SQ6/3),
39
                new Static3D(     0,-SQ3/3, SQ6/3),
40
                new Static3D( SQ6/3, SQ3/3,     0),
41
                new Static3D(-SQ6/3, SQ3/3,     0),
101 42
        };
102 43

  
103
  // 3-plate cube
104
  public static final float[][] POS_3 = new float[][]
105
        {
106
          {-1.0f,  1.0f,  1.0f, -1.0f,  0.0f,  1.0f,  0.0f,  1.0f,  1.0f,  0.0f,  0.0f,  1.0f},
107
          { 1.0f,  0.0f, -1.0f,  1.0f,  0.0f,  0.0f,  1.0f,  1.0f, -1.0f,  1.0f,  1.0f,  0.0f},
108
          {-1.0f, -1.0f, -1.0f, -1.0f, -1.0f,  0.0f,  0.0f, -1.0f, -1.0f,  0.0f, -1.0f,  0.0f},
109
          { 1.0f,  1.0f,  1.0f},
110
          { 1.0f,  0.0f,  1.0f},
111
          { 1.0f, -1.0f,  1.0f},
112
          {-1.0f, -1.0f,  1.0f},
113
          { 0.0f, -1.0f,  1.0f},
114
          { 1.0f, -1.0f,  0.0f},
115
          { 1.0f, -1.0f, -1.0f},
116
          {-1.0f,  1.0f, -1.0f},
117
          {-1.0f,  1.0f,  0.0f},
118
          { 0.0f,  1.0f, -1.0f},
119
          { 0.0f,  1.0f,  0.0f},
120
          {-1.0f,  0.0f, -1.0f},
121
          {-1.0f,  0.0f,  0.0f},
122
          { 0.0f,  0.0f, -1.0f}
123
        };
124

  
125
  // BiCube
126
  public static final float[][] POS_4 = new float[][]
127
        {
128
          { 1.0f,  1.0f, -1.0f},
129
          {-1.0f, -1.0f,  0.0f, -1.0f,  0.0f,  0.0f, 0.0f, -1.0f,  0.0f,  0.0f,  0.0f,  0.0f},
130
          {-1.0f,  1.0f, -1.0f,  0.0f,  1.0f, -1.0f},
131
          {-1.0f,  0.0f, -1.0f,  0.0f,  0.0f, -1.0f},
132
          {-1.0f, -1.0f, -1.0f,  0.0f, -1.0f, -1.0f},
133
          {-1.0f,  1.0f,  0.0f, -1.0f,  1.0f,  1.0f},
134
          { 0.0f,  1.0f,  0.0f,  0.0f,  1.0f,  1.0f},
135
          { 1.0f,  1.0f,  0.0f,  1.0f,  1.0f,  1.0f},
136
          {-1.0f, -1.0f,  1.0f, -1.0f,  0.0f,  1.0f},
137
          { 0.0f, -1.0f,  1.0f,  0.0f,  0.0f,  1.0f},
138
          { 1.0f, -1.0f,  1.0f,  1.0f,  0.0f,  1.0f},
139
          { 1.0f, -1.0f,  0.0f,  1.0f,  0.0f,  0.0f},
140
          { 1.0f, -1.0f, -1.0f,  1.0f,  0.0f, -1.0f}
141
        };
142

  
143
  // AI Cube
144
  public static final float[][] POS_5 = new float[][]
145
        {
146
          {-1.5f,-1.5f, 1.5f, -0.5f,-1.5f, 1.5f, -1.5f,-0.5f, 1.5f, -0.5f,-0.5f, 1.5f,
147
           -1.5f,-1.5f, 0.5f, -0.5f,-1.5f, 0.5f, -1.5f,-0.5f, 0.5f, -0.5f,-0.5f, 0.5f, },
148
          { 1.5f, 1.5f, 1.5f,  0.5f, 1.5f, 1.5f,  1.5f, 0.5f, 1.5f,  0.5f, 0.5f, 1.5f,
149
            1.5f, 1.5f, 0.5f,  0.5f, 1.5f, 0.5f,  1.5f, 0.5f, 0.5f,  0.5f, 0.5f, 0.5f, },
150
          {-1.5f, 1.5f,-1.5f, -0.5f, 1.5f,-1.5f, -1.5f, 0.5f,-1.5f, -0.5f, 0.5f,-1.5f,
151
           -1.5f, 1.5f,-0.5f, -0.5f, 1.5f,-0.5f, -1.5f, 0.5f,-0.5f, -0.5f, 0.5f,-0.5f, },
152
          { 1.5f,-1.5f,-1.5f,  0.5f,-1.5f,-1.5f,  1.5f,-0.5f,-1.5f,  0.5f,-0.5f,-1.5f,
153
            1.5f,-1.5f,-0.5f,  0.5f,-1.5f,-0.5f,  1.5f,-0.5f,-0.5f,  0.5f,-0.5f,-0.5f, },
154

  
155
          {-1.5f, 1.5f, 1.5f },
156
          {-1.5f, 1.5f, 0.5f },
157
          {-1.5f, 0.5f, 1.5f },
158
          {-1.5f, 0.5f, 0.5f },
159
          {-0.5f, 1.5f, 1.5f },
160
          {-0.5f, 1.5f, 0.5f },
161
          {-0.5f, 0.5f, 1.5f },
162

  
163
          { 1.5f,-1.5f, 1.5f },
164
          { 1.5f,-1.5f, 0.5f },
165
          { 1.5f,-0.5f, 1.5f },
166
          { 1.5f,-0.5f, 0.5f },
167
          { 0.5f,-1.5f, 1.5f },
168
          { 0.5f,-1.5f, 0.5f },
169
          { 0.5f,-0.5f, 1.5f },
170

  
171
          { 1.5f, 1.5f,-1.5f },
172
          { 1.5f, 1.5f,-0.5f },
173
          { 1.5f, 0.5f,-1.5f },
174
          { 1.5f, 0.5f,-0.5f },
175
          { 0.5f, 1.5f,-1.5f },
176
          { 0.5f, 1.5f,-0.5f },
177
          { 0.5f, 0.5f,-1.5f },
178

  
179
          {-1.5f,-1.5f,-1.5f },
180
          {-1.5f,-1.5f,-0.5f },
181
          {-1.5f,-0.5f,-1.5f },
182
          {-1.5f,-0.5f,-0.5f },
183
          {-0.5f,-1.5f,-1.5f },
184
          {-0.5f,-1.5f,-0.5f },
185
          {-0.5f,-0.5f,-1.5f },
186
        };
44
  private static final int OCT_1 = 0;
45
  private static final int TET_1 = 1;
46
  private static final int OTHER = 2;
187 47

  
188
  // Burr Cube
189
  public static final float[][] POS_6 = new float[][]
190
        {
191
          {-1.5f, 1.5f, 1.5f,-0.5f, 1.5f, 1.5f},
192
          { 1.5f, 1.5f, 1.5f, 0.5f, 1.5f, 1.5f},
193
          {-0.5f, 0.5f, 1.5f, 0.5f, 0.5f, 1.5f},
194
          {-1.5f,-0.5f, 1.5f,-0.5f,-0.5f, 1.5f},
195
          { 1.5f,-0.5f, 1.5f, 0.5f,-0.5f, 1.5f},
196
          {-0.5f,-1.5f, 1.5f, 0.5f,-1.5f, 1.5f},
197

  
198
          {-1.5f, 1.5f,-1.5f,-0.5f, 1.5f,-1.5f},
199
          { 1.5f, 1.5f,-1.5f, 0.5f, 1.5f,-1.5f},
200
          {-0.5f, 0.5f,-1.5f, 0.5f, 0.5f,-1.5f},
201
          {-1.5f,-0.5f,-1.5f,-0.5f,-0.5f,-1.5f},
202
          { 1.5f,-0.5f,-1.5f, 0.5f,-0.5f,-1.5f},
203
          {-0.5f,-1.5f,-1.5f, 0.5f,-1.5f,-1.5f},
204

  
205
          { 1.5f, 1.5f, 0.5f, 1.5f, 1.5f,-0.5f},
206
          { 1.5f, 0.5f, 1.5f, 1.5f, 0.5f, 0.5f},
207
          { 1.5f, 0.5f,-1.5f, 1.5f, 0.5f,-0.5f},
208
          { 1.5f,-0.5f, 0.5f, 1.5f,-0.5f,-0.5f},
209
          { 1.5f,-1.5f, 1.5f, 1.5f,-1.5f, 0.5f},
210
          { 1.5f,-1.5f,-1.5f, 1.5f,-1.5f,-0.5f},
211

  
212
          {-1.5f, 1.5f, 0.5f,-1.5f, 1.5f,-0.5f},
213
          {-1.5f, 0.5f, 1.5f,-1.5f, 0.5f, 0.5f},
214
          {-1.5f, 0.5f,-1.5f,-1.5f, 0.5f,-0.5f},
215
          {-1.5f,-0.5f, 0.5f,-1.5f,-0.5f,-0.5f},
216
          {-1.5f,-1.5f, 1.5f,-1.5f,-1.5f, 0.5f},
217
          {-1.5f,-1.5f,-1.5f,-1.5f,-1.5f,-0.5f},
218

  
219
          {-0.5f, 1.5f,-0.5f, 0.5f, 1.5f,-0.5f},
220
          {-0.5f, 1.5f, 0.5f, 0.5f, 1.5f, 0.5f},
221

  
222
          { 0.5f,-1.5f, 0.5f, 0.5f,-1.5f,-0.5f},
223
          {-0.5f,-1.5f, 0.5f,-0.5f,-1.5f,-0.5f},
224
        };
48
  private static final int NUM_TYPES = 2;  // OCT_1 and TET_1
225 49

  
226
  private int[][] mEdges;
227 50
  private int[] mCubitVariantMap;
228 51
  private int[] mTypeVariantMap;
229
  private Static4D[] mInitQuats;
52
  private ObjectShape[] mTmpShapes;
53
  private int mNumVariants;
54
  private float[][] mPosition;
55
  private ObjectSignature mSignature;
56
  private float[][] mCuts;
57
  private int[][] mBasicAngle;
230 58

  
231 59
///////////////////////////////////////////////////////////////////////////////////////////////////
232 60

  
233
  public TwistyBandagedPyraminx(int meshState, int iconMode, Static4D quat, Static3D move, float scale, InitData data, InitAssets asset)
61
  private float[][] getPositions()
234 62
    {
235
    super(meshState, iconMode, (data.getNumLayers()[0]+data.getNumLayers()[1]+data.getNumLayers()[2])/3.0f, quat, move, scale, data, asset);
63
    if( mPosition==null ) mPosition = getInitData().getPos();
64
    return mPosition;
236 65
    }
237 66

  
238 67
///////////////////////////////////////////////////////////////////////////////////////////////////
239
// Computing scramble states of many a bandaged cubes takes way too long time and too much space.
240
// Return null here and turn to construction of scramble tables just-in-time (scrambleType=2)
241
// Unless this is AI Cube :)
242 68

  
243
  public int[][] getScrambleEdges()
69
  private int getType(float[] pos)
244 70
    {
245
    if( mPosition==null ) mPosition = getInitData().getPos();
71
    if( pos.length>3 ) return OTHER;
72
    int[] numLayers = getNumLayers();
73
    int variant = FactoryBandagedPyraminx.getElementVariant(numLayers[0],pos[1]);
74
    return variant==0 ? OCT_1 : TET_1;
75
    }
246 76

  
247
    if( mPosition==POS_5 )
248
      {
249
      if( mEdges==null )
250
        {
251
        mEdges = new int[][]
252
          {
253
            { 36, 1,37, 2,38, 3,39, 4,40, 5,41, 6 },  // 0: beg
254
            {  6, 7, 7, 7, 8, 7, 9, 7,10, 7,11, 7 },  // 1: R before
255
            {  0, 8, 1, 8, 2, 8, 3, 8, 4, 8, 5, 8 },  // 2: L before
256
            { 12, 9,13, 9,14, 9,15, 9,16, 9,17, 9 },  // 3: D before
257
            { 18,10,19,10,20,10,21,10,22,10,23,10 },  // 4: U before
258
            { 24,11,25,11,26,11,27,11,28,11,29,11 },  // 5: B before
259
            { 30,12,31,12,32,12,33,12,34,12,35,12 },  // 6: F before
260
            { 42, 3,43, 4,44, 5,45, 6 }, // 7: R after
261
            { 46, 3,47, 4,48, 5,49, 6 }, // 8: L after
262
            { 50, 1,51, 2,52, 5,53, 6 }, // 9: D after
263
            { 54, 1,55, 2,56, 5,57, 6 }, //10: U after
264
            { 58, 1,59, 2,60, 3,61, 4 }, //11: B after
265
            { 62, 1,63, 2,64, 3,65, 4 }, //12: F after
266
          };
267
        }
268 77

  
269
      return mEdges;
270
      }
78
///////////////////////////////////////////////////////////////////////////////////////////////////
271 79

  
272
    return null;
80
  private int getType(int variant)
81
    {
82
    for(int t=0; t<NUM_TYPES; t++)
83
      if( mTypeVariantMap[t]==variant ) return t;
84

  
85
    return -1;
273 86
    }
274 87

  
275 88
///////////////////////////////////////////////////////////////////////////////////////////////////
276
// AI Cube is scrambled using algorithms
277 89

  
278
  @Override
279
  public int[][] getScrambleAlgorithms()
90
  private void produceTmpShape(int variant)
280 91
    {
281
    if( mPosition==null ) mPosition = getInitData().getPos();
92
    float[][] positions = getPositions();
93
    int cubit,numCubits = positions.length;
282 94

  
283
    if( mPosition==POS_5 )
95
    for(cubit=0; cubit<numCubits; cubit++)
284 96
      {
285
      return new int[][]
286
          {
287
              { 0,0,-1 }, { 0,0, 1 }, { 0,0, 2 }, { 0,1,-1 }, { 0,1, 1 }, { 0,1, 2 },  //  0-5 : L
288
              { 0,2,-1 }, { 0,2, 1 }, { 0,2, 2 }, { 0,3,-1 }, { 0,3, 1 }, { 0,3, 2 },  //  6-11: R
289
              { 1,0,-1 }, { 1,0, 1 }, { 1,0, 2 }, { 1,1,-1 }, { 1,1, 1 }, { 1,1, 2 },  // 12-17: D
290
              { 1,2,-1 }, { 1,2, 1 }, { 1,2, 2 }, { 1,3,-1 }, { 1,3, 1 }, { 1,3, 2 },  // 18-23: U
291
              { 2,0,-1 }, { 2,0, 1 }, { 2,0, 2 }, { 2,1,-1 }, { 2,1, 1 }, { 2,1, 2 },  // 24-29: B
292
              { 2,2,-1 }, { 2,2, 1 }, { 2,2, 2 }, { 2,3,-1 }, { 2,3, 1 }, { 2,3, 2 },  // 30-35: F
293

  
294
              { 1,3,1, 2,0,2 },  // 36: BEG->R
295
              { 1,0,1, 2,0,2 },  // 37: BEG->L
296
              { 2,3,1, 0,3,2 },  // 38: BEG->D
297
              { 2,0,1, 0,3,2 },  // 39: BEG->U
298
              { 0,3,1, 1,3,2 },  // 40: BEG->B
299
              { 0,0,1, 1,3,2 },  // 41: BEG->F
300

  
301
              { 1,0,-1, 0,3,2, 2,0,-1 }, // 42: R->D
302
              { 1,3, 1, 0,3,2, 2,3, 1 }, // 43: R->U
303
              { 2,0, 1, 0,3,2, 1,0, 1 }, // 44: R->B
304
              { 2,3,-1, 0,3,2, 1,3,-1 }, // 45: R->F
305

  
306
              { 1,0,-1, 0,0,2, 2,3, 1 }, // 46: L->D
307
              { 1,3, 1, 0,0,2, 2,0,-1 }, // 47: L->U
308
              { 2,0, 1, 0,0,2, 1,3,-1 }, // 48: L->B
309
              { 2,3,-1, 0,0,2, 1,0, 1 }, // 49: L->F
310

  
311
              { 0,3,-1, 1,0,2, 2,0, 1 }, // 50: D->R
312
              { 0,0, 1, 1,0,2, 2,3,-1 }, // 51: D->L
313
              { 2,0,-1, 1,0,2, 0,3, 1 }, // 52: D->B
314
              { 2,3, 1, 1,0,2, 0,0,-1 }, // 53: D->F
315

  
316
              { 0,3,-1, 1,3,2, 2,3,-1 }, // 54: U->R
317
              { 0,0, 1, 1,3,2, 2,0, 1 }, // 55: U->L
318
              { 2,0,-1, 1,3,2, 0,0,-1 }, // 56: U->B
319
              { 2,3, 1, 1,3,2, 0,3, 1 }, // 57: U->F
320

  
321
              { 0,3, 1, 2,0,2, 1,0,-1 }, // 58: B->R
322
              { 0,0,-1, 2,0,2, 1,3, 1 }, // 59: B->L
323
              { 1,0, 1, 2,0,2, 0,3,-1 }, // 60: B->D
324
              { 1,3,-1, 2,0,2, 0,0, 1 }, // 61: B->U
325

  
326
              { 0,3, 1, 2,3,2, 1,3, 1 }, // 62: F->R
327
              { 0,0,-1, 2,3,2, 1,0,-1 }, // 63: F->L
328
              { 1,0, 1, 2,3,2, 0,0, 1 }, // 64: F->D
329
              { 1,3,-1, 2,3,2, 0,3,-1 }, // 65: F->U
330
          };
97
      if( mCubitVariantMap[cubit]==variant ) break;
98
      }
99

  
100
    if( cubit>=numCubits )
101
      {
102
      android.util.Log.e("D", "unknown variant: "+variant);
331 103
      }
332 104
    else
333 105
      {
334
      return super.getScrambleAlgorithms();
106
      FactoryBandagedPyraminx factory = FactoryBandagedPyraminx.getInstance();
107
      mTmpShapes[variant] = factory.createIrregularShape(variant,positions[cubit]);
335 108
      }
336 109
    }
337 110

  
338 111
///////////////////////////////////////////////////////////////////////////////////////////////////
339
// AI Cube is scrambled using algorithms
340 112

  
341
  @Override
342
  public int getScrambleType()
113
  private float[][] getVertices(int variant)
343 114
    {
344
    if( mPosition==null ) mPosition = getInitData().getPos();
345

  
346
    return mPosition==POS_5 ? ObjectScrambler.SCRAMBLING_ALGORITHMS : ObjectScrambler.SCRAMBLING_BANDAGED;
115
    if( mTmpShapes==null ) mTmpShapes = new ObjectShape[mNumVariants];
116
    if( mTmpShapes[variant]==null ) produceTmpShape(variant);
117
    return mTmpShapes[variant].getVertices();
347 118
    }
348 119

  
349 120
///////////////////////////////////////////////////////////////////////////////////////////////////
121
// PUBLIC API
350 122

  
351
  private int getType(float[] pos)
123
  public TwistyBandagedPyraminx(int meshState, int iconMode, Static4D quat, Static3D move, float scale, InitData data, InitAssets asset)
352 124
    {
353
    switch(pos.length)
354
      {
355
      case  3: return CUBIT_111;
356
      case  6: return CUBIT_211;
357
      case  9: boolean x1 = (pos[0]==pos[3] && pos[0]==pos[6]);
358
               boolean y1 = (pos[1]==pos[4] && pos[1]==pos[7]);
359
               boolean z1 = (pos[2]==pos[5] && pos[2]==pos[8]);
360
               return ( (x1&&y1) || (x1&&z1) || (y1&&z1) ) ? CUBIT_311 : CUBIT_OTH;
361
      case 12: float x = (pos[0]+pos[3]+pos[6]+pos[ 9])/4;
362
               float y = (pos[1]+pos[4]+pos[7]+pos[10])/4;
363
               float z = (pos[2]+pos[5]+pos[8]+pos[11])/4;
364
               float d1 = (pos[0]-x)*(pos[0]-x) + (pos[ 1]-y)*(pos[ 1]-y) + (pos[ 2]-z)*(pos[ 2]-z);
365
               float d2 = (pos[3]-x)*(pos[3]-x) + (pos[ 4]-y)*(pos[ 4]-y) + (pos[ 5]-z)*(pos[ 5]-z);
366
               float d3 = (pos[6]-x)*(pos[6]-x) + (pos[ 7]-y)*(pos[ 7]-y) + (pos[ 8]-z)*(pos[ 8]-z);
367
               float d4 = (pos[9]-x)*(pos[9]-x) + (pos[10]-y)*(pos[10]-y) + (pos[11]-z)*(pos[11]-z);
368
               return ( d1==0.5f && d2==0.5f && d3==0.5f && d4==0.5f ) ? CUBIT_221 : CUBIT_OTH;
369
      case 24: float x3 = pos[0];
370
               float y3 = pos[1];
371
               float z3 = pos[2];
372
               float x4=-10,y4=-10,z4=-10;
373
               int i;
374

  
375
               for(i=0; i<8; i++)
376
                 {
377
                 if( pos[3*i]!=x3 && pos[3*i+1]!=y3 && pos[3*i+2]!=z3 )
378
                   {
379
                   x4 = pos[3*i  ];
380
                   y4 = pos[3*i+1];
381
                   z4 = pos[3*i+2];
382
                   break;
383
                   }
384
                 }
385
               if( i==9 ) return CUBIT_OTH;
386

  
387
               float dX = x4-x3;
388
               float dY = y4-y3;
389
               float dZ = z4-z3;
390

  
391
               if( (dX==1.0f || dX==-1.0f) && (dY==1.0f || dY==-1.0f) && (dZ==1.0f || dZ==-1.0f) )
392
                 {
393
                 for(i=0; i<8; i++)
394
                   {
395
                   if( (pos[3*i  ]!=x3 && pos[3*i  ]!=x4) ||
396
                       (pos[3*i+1]!=y3 && pos[3*i+1]!=y4) ||
397
                       (pos[3*i+2]!=z3 && pos[3*i+2]!=z4)  ) return CUBIT_OTH;
398
                   }
399

  
400
                 return CUBIT_222;
401
                 }
402

  
403
      default: return CUBIT_OTH;
404
      }
125
    super(meshState, iconMode, data.getNumLayers()[0], quat, move, scale, data, asset);
405 126
    }
406 127

  
407 128
///////////////////////////////////////////////////////////////////////////////////////////////////
129
// Computing scramble states of many a bandaged cubes takes way too long time and too much space.
130
// Return null here and turn to construction of scramble tables just-in-time (scrambleType=2)
408 131

  
409
  private int getQuatIndex(int cubit)
132
  public int[][] getScrambleEdges()
410 133
    {
411
    float[][] positions = getPositions();
412
    int len = positions.length;
413

  
414
    if( cubit>=0 && cubit<len )
415
      {
416
      float[] pos = positions[cubit];
417
      int type = getType(pos);
418

  
419
      switch(type)
420
        {
421
        case CUBIT_222:
422
        case CUBIT_111: return 0;
423
        case CUBIT_211:
424
        case CUBIT_311: return (pos[1]==pos[4]) ? (pos[0]==pos[3] ? 2 : 0) : 3;
425
        case CUBIT_221: if( pos[0]==pos[3] && pos[0]==pos[6] ) return 3;
426
                        if( pos[1]==pos[4] && pos[1]==pos[7] ) return 0;
427
                        if( pos[2]==pos[5] && pos[2]==pos[8] ) return 1;
428
        }
429
      }
430

  
431
    return 0;
134
    return null;
432 135
    }
433 136

  
434 137
///////////////////////////////////////////////////////////////////////////////////////////////////
435 138

  
436
  private int[] getDim(int variant)
139
  @Override
140
  public float[][] returnRotationFactor()
437 141
    {
438
    int type,numTypes = mDims.length;
439
    for(type=0; type<numTypes; type++) if( mTypeVariantMap[type]==variant ) break;
440
    return type<numTypes ? mDims[type] : null;
142
    int numL= getNumLayers()[0];
143
    float[][] factor = new float[4][numL];
144

  
145
    for(int ax=0; ax<4; ax++)
146
      for(int la=0; la<numL; la++) factor[ax][la] = ((float)numL)/(numL-la);
147

  
148
    return factor;
441 149
    }
442 150

  
443 151
///////////////////////////////////////////////////////////////////////////////////////////////////
444 152

  
445
  private void produceTmpShape(int variant)
153
  @Override
154
  public int[][] getScrambleAlgorithms()
446 155
    {
447
    float[][] positions = getPositions();
448
    int cubit,numCubits = positions.length;
449

  
450
    for(cubit=0; cubit<numCubits; cubit++)
451
      {
452
      if( mCubitVariantMap[cubit]==variant ) break;
453
      }
454

  
455
    if( cubit>=numCubits )
456
      {
457
      android.util.Log.e("D", "unknown variant: "+variant);
458
      }
459
    else
460
      {
461
      FactoryBandagedCuboid factory = FactoryBandagedCuboid.getInstance();
462
      mTmpShapes[variant] = factory.createIrregularShape(variant,positions[cubit]);
463
      }
156
    return super.getScrambleAlgorithms();
464 157
    }
465 158

  
466 159
///////////////////////////////////////////////////////////////////////////////////////////////////
467
// PUBLIC API
468 160

  
469
  public int getTouchControlType()
161
  @Override
162
  public int getScrambleType()
470 163
    {
471
    return TC_CUBOID;
164
    return ObjectScrambler.SCRAMBLING_BANDAGED;
472 165
    }
473 166

  
474 167
///////////////////////////////////////////////////////////////////////////////////////////////////
475 168

  
476 169
  public ObjectShape getObjectShape(int variant)
477 170
    {
478
    if( getDim(variant)!=null )
479
      {
480
      int[][] indices =
481
        {
482
          {2,3,1,0},
483
          {7,6,4,5},
484
          {4,0,1,5},
485
          {7,3,2,6},
486
          {6,2,0,4},
487
          {3,7,5,1},
488
        };
489

  
490
      return new ObjectShape( getVertices(variant), indices);
491
      }
492

  
493 171
    if( mTmpShapes==null ) mTmpShapes = new ObjectShape[mNumVariants];
494 172
    if( mTmpShapes[variant]==null ) produceTmpShape(variant);
495 173
    return mTmpShapes[variant];
......
499 177

  
500 178
  public ObjectFaceShape getObjectFaceShape(int variant)
501 179
    {
502
    int[] numLayers = getNumLayers();
503
    int size = (numLayers[0]+numLayers[1]+numLayers[2])/3;
504
    int[] dim = getDim(variant);
180
    int type = getType(variant);
181
    FactoryBandagedPyraminx factory = FactoryBandagedPyraminx.getInstance();
505 182

  
506
    if( dim!=null )
183
    if( type>=0 )
507 184
      {
508
      int X = dim[0];
509
      int Y = dim[1];
510
      int Z = dim[2];
511

  
512
      float height     = isInIconMode() ? 0.001f : size<=5 ? 0.048f : 0.020f;
513
      int[] bandIndices= { 0,0,1,1,2,2 };
514

  
515
      int maxXY = Math.max(X,Y);
516
      int maxXZ = Math.max(X,Z);
517
      int maxYZ = Math.max(Y,Z);
518

  
519
      int angle = 45;
520
      float R = 0.25f;
521
      float S = 0.50f;
522
      float N = size<=4 ? 5 : size<=5 ? 4 : 3;
523

  
524
      float[][] bands =
525
        {
526
          {height/maxYZ,angle,R,S,N,0,0},
527
          {height/maxXZ,angle,R,S,N,0,0},
528
          {height/maxXY,angle,R,S,N,0,0}
529
        };
530

  
185
      boolean iconMode = isInIconMode();
186
      float[][] bands = factory.getBands(iconMode);
187
      int numFaces = type==TET_1 ? 4:8;
188
      int[] bandIndices= new int[numFaces];
189
      for(int i=0; i<numFaces; i++) bandIndices[i] = 1;
531 190
      return new ObjectFaceShape(bands,bandIndices,null);
532 191
      }
533 192

  
534
    FactoryBandagedCuboid factory = FactoryBandagedCuboid.getInstance();
535 193
    return factory.createIrregularFaceShape(variant, isInIconMode() );
536 194
    }
537 195

  
......
540 198
  public ObjectVertexEffects getVertexEffects(int variant)
541 199
    {
542 200
    int[] numLayers = getNumLayers();
543
    int size = (numLayers[0]+numLayers[1]+numLayers[2])/3;
201
    int size = numLayers[0];
544 202
    boolean round = (DistortedLibrary.fastCompilationTF() && size<=5 && !isInIconMode());
203
    int type = getType(variant);
545 204

  
546
    if( getDim(variant)!=null )
205
    if( type>=0 )
547 206
      {
548 207
      float[][] vertices = getVertices(variant);
549
      float strength = -0.04f;
550

  
551
      float[][] variables =
552
        {
553
          { 0, strength*vertices[0][0], strength*vertices[0][1], strength*vertices[0][2], 1  },
554
          { 0, strength*vertices[1][0], strength*vertices[1][1], strength*vertices[1][2], 1  },
555
          { 0, strength*vertices[2][0], strength*vertices[2][1], strength*vertices[2][2], 1  },
556
          { 0, strength*vertices[3][0], strength*vertices[3][1], strength*vertices[3][2], 1  },
557
          { 0, strength*vertices[4][0], strength*vertices[4][1], strength*vertices[4][2], 1  },
558
          { 0, strength*vertices[5][0], strength*vertices[5][1], strength*vertices[5][2], 1  },
559
          { 0, strength*vertices[6][0], strength*vertices[6][1], strength*vertices[6][2], 1  },
560
          { 0, strength*vertices[7][0], strength*vertices[7][1], strength*vertices[7][2], 1  },
561
        };
208
      int numV = vertices.length;
209
      float S = -0.04f;
562 210

  
563 211
      String name = EffectName.DEFORM.name();
564 212
      float[] reg = {0,0,0,0.15f};
565 213

  
566
      String[] names = {name,name,name,name,name,name,name,name};
567
      float[][] regions = {reg,reg,reg,reg,reg,reg,reg,reg};
568
      boolean[] uses = {round,round,round,round,round,round,round,round};
214
      float[][] variables = new float[numV][];
215
      String[] names      = new String[numV];
216
      float[][] regions   = new float[numV][];
217
      boolean[] uses      = new boolean[numV];
218

  
219
      for(int i=0; i<numV; i++)
220
        {
221
        float[] v    = vertices[i];
222
        variables[i] = new float[] { 0, S*v[0], S*v[1], S*v[2], 1 };
223
        names[i]     = name;
224
        regions[i]   = reg;
225
        uses[i]      = round;
226
        }
569 227

  
570 228
      return new ObjectVertexEffects(names,variables,vertices,regions,uses);
571 229
      }
572 230

  
573
    FactoryBandagedCuboid factory = FactoryBandagedCuboid.getInstance();
231
    FactoryBandagedPyraminx factory = FactoryBandagedPyraminx.getInstance();
574 232
    return factory.createVertexEffects(variant,round);
575 233
    }
576 234

  
......
578 236

  
579 237
  public Static4D getCubitQuats(int cubit, int[] numLayers)
580 238
    {
581
    if( mInitQuats ==null )
582
      {
583
      mInitQuats = new Static4D[]
584
        {
585
        new Static4D(  0.0f,   0.0f,   0.0f,   1.0f),  // NULL
586
        new Static4D( SQ2/2,   0.0f,   0.0f, -SQ2/2),  // X
587
        new Static4D(  0.0f,  SQ2/2,   0.0f, -SQ2/2),  // Y
588
        new Static4D(  0.0f,   0.0f,  SQ2/2, -SQ2/2),  // Z
589
        new Static4D( -0.5f,  +0.5f,  -0.5f,  +0.5f),  // ZX
590
        new Static4D( +0.5f,  +0.5f,  +0.5f,  -0.5f),  // YX
591
        };
592
      }
593

  
594
    return mInitQuats[getQuatIndex(cubit)];
239
    return new Static4D(0,0,0,1);
595 240
    }
596 241

  
597 242
///////////////////////////////////////////////////////////////////////////////////////////////////
......
601 246
    if( mNumVariants==0 )
602 247
      {
603 248
      float[][] positions = getPositions();
604
      boolean C111=false;
605
      boolean C211=false;
606
      boolean C311=false;
607
      boolean C221=false;
608
      boolean C222=false;
249
      boolean T1=false;
250
      boolean O1=false;
609 251

  
610 252
      int numCubits = positions.length;
611 253
      mCubitVariantMap = new int[numCubits];
612 254

  
613
      int numTypes = mDims.length;
614
      mTypeVariantMap = new int[numTypes];
615
      for(int i=0; i<numTypes; i++) mTypeVariantMap[i] = -1;
255
      mTypeVariantMap = new int[NUM_TYPES];
256
      for(int i=0; i<NUM_TYPES; i++) mTypeVariantMap[i] = -1;
616 257

  
617 258
      for (int cubit=0; cubit<numCubits; cubit++)
618 259
        {
......
620 261

  
621 262
        switch (type)
622 263
          {
623
          case CUBIT_111: if (!C111) { C111 = true; mTypeVariantMap[CUBIT_111]=mNumVariants++; }
624
                          mCubitVariantMap[cubit]=mTypeVariantMap[CUBIT_111];
625
                          break;
626
          case CUBIT_211: if (!C211) { C211 = true; mTypeVariantMap[CUBIT_211]=mNumVariants++; }
627
                          mCubitVariantMap[cubit]=mTypeVariantMap[CUBIT_211];
628
                          break;
629
          case CUBIT_311: if (!C311) { C311 = true; mTypeVariantMap[CUBIT_311]=mNumVariants++; }
630
                          mCubitVariantMap[cubit]=mTypeVariantMap[CUBIT_311];
631
                          break;
632
          case CUBIT_221: if (!C221) { C221 = true; mTypeVariantMap[CUBIT_221]=mNumVariants++; }
633
                          mCubitVariantMap[cubit]=mTypeVariantMap[CUBIT_221];
634
                          break;
635
          case CUBIT_222: if (!C222) { C222 = true; mTypeVariantMap[CUBIT_222]=mNumVariants++; }
636
                          mCubitVariantMap[cubit]=mTypeVariantMap[CUBIT_222];
637
                          break;
638
          default       : mCubitVariantMap[cubit] = mNumVariants++;
264
          case TET_1: if (!T1) { T1 = true; mTypeVariantMap[TET_1]=mNumVariants++; }
265
                      mCubitVariantMap[cubit] = mTypeVariantMap[TET_1];
266
                      break;
267
          case OCT_1: if (!O1) { O1 = true; mTypeVariantMap[OCT_1]=mNumVariants++; }
268
                      mCubitVariantMap[cubit] = mTypeVariantMap[OCT_1];
269
                      break;
270
          default   : mCubitVariantMap[cubit] = mNumVariants++;
639 271
          }
640 272
        }
641 273

  
642
      FactoryBandagedCuboid factory = FactoryBandagedCuboid.getInstance();
274
      FactoryBandagedPyraminx factory = FactoryBandagedPyraminx.getInstance();
643 275
      factory.prepare(mNumVariants,numLayers);
644 276
      }
645 277

  
......
648 280

  
649 281
///////////////////////////////////////////////////////////////////////////////////////////////////
650 282

  
651
  public int getCubitVariant(int cubit, int[] numLayers)
283
  public float[][] getCubitPositions(int[] numLayers)
652 284
    {
653
    return mCubitVariantMap[cubit];
285
    return getPositions();
654 286
    }
655 287

  
656 288
///////////////////////////////////////////////////////////////////////////////////////////////////
657 289

  
658
  private float[][] getVertices(int variant)
290
  public boolean[][] getLayerRotatable(int[] numLayers)
659 291
    {
660
    int[] dim = getDim(variant);
292
    int numAxis = ROT_AXIS.length;
293
    int size = numLayers[0];
294
    boolean[][] layerRotatable = new boolean[numAxis][size];
661 295

  
662
    if( dim!=null )
296
    for(int i=0; i<numAxis; i++)
297
      for(int j=0; j<size; j++) layerRotatable[i][j] = true;
298

  
299
    return layerRotatable;
300
    }
301

  
302
///////////////////////////////////////////////////////////////////////////////////////////////////
303

  
304
  public float[][] getCuts(int[] numLayers)
305
    {
306
    if( mCuts==null )
663 307
      {
664
      int X = dim[0];
665
      int Y = dim[1];
666
      int Z = dim[2];
308
      int numL = numLayers[0];
309
      mCuts = new float[4][numL-1];
667 310

  
668
      return new float[][]
311
      for(int i=0; i<numL-1; i++)
669 312
        {
670
          { 0.5f*X, 0.5f*Y, 0.5f*Z},
671
          { 0.5f*X, 0.5f*Y,-0.5f*Z},
672
          { 0.5f*X,-0.5f*Y, 0.5f*Z},
673
          { 0.5f*X,-0.5f*Y,-0.5f*Z},
674
          {-0.5f*X, 0.5f*Y, 0.5f*Z},
675
          {-0.5f*X, 0.5f*Y,-0.5f*Z},
676
          {-0.5f*X,-0.5f*Y, 0.5f*Z},
677
          {-0.5f*X,-0.5f*Y,-0.5f*Z}
678
        };
313
        float cut = (1.0f+i-numL/4.0f)*(SQ6/3);
314
        mCuts[0][i] = cut;
315
        mCuts[1][i] = cut;
316
        mCuts[2][i] = cut;
317
        mCuts[3][i] = cut;
318
        }
679 319
      }
680 320

  
681
    if( mTmpShapes==null ) mTmpShapes = new ObjectShape[mNumVariants];
682
    if( mTmpShapes[variant]==null ) produceTmpShape(variant);
683
    return mTmpShapes[variant].getVertices();
321
    return mCuts;
322
    }
323

  
324
///////////////////////////////////////////////////////////////////////////////////////////////////
325

  
326
  public Static3D[] getFaceAxis()
327
    {
328
    return TouchControlTetrahedron.FACE_AXIS;
329
    }
330

  
331
///////////////////////////////////////////////////////////////////////////////////////////////////
332

  
333
  public Static3D[] getRotationAxis()
334
    {
335
    return ROT_AXIS;
336
    }
337

  
338
///////////////////////////////////////////////////////////////////////////////////////////////////
339

  
340
  public int[][][] getEnabled()
341
    {
342
    return new int[][][] { {{1,2,3}},{{0,2,3}},{{0,1,3}},{{0,1,2}} };
343
    }
344

  
345
///////////////////////////////////////////////////////////////////////////////////////////////////
346

  
347
  public int getTouchControlType()
348
    {
349
    return TC_TETRAHEDRON;
350
    }
351

  
352
///////////////////////////////////////////////////////////////////////////////////////////////////
353

  
354
  public int getTouchControlSplit()
355
    {
356
    return TYPE_NOT_SPLIT;
357
    }
358

  
359
///////////////////////////////////////////////////////////////////////////////////////////////////
360

  
361
  public int getCubitVariant(int cubit, int[] numLayers)
362
    {
363
    return mCubitVariantMap[cubit];
684 364
    }
685 365

  
686 366
///////////////////////////////////////////////////////////////////////////////////////////////////
687
// PUBLIC API
688 367

  
689 368
  public float[] getDist3D(int[] numLayers)
690 369
    {
691
    float x = numLayers[0];
692
    float y = numLayers[1];
693
    float z = numLayers[2];
694
    float a = (x+y+z)/1.5f;
370
    return TouchControlTetrahedron.D3D;
371
    }
695 372

  
696
    return new float[] {x/a,x/a,y/a,y/a,z/a,z/a};
373
///////////////////////////////////////////////////////////////////////////////////////////////////
374

  
375
  public int[][] getBasicAngles()
376
    {
377
    if( mBasicAngle ==null )
378
      {
379
      int num = getNumLayers()[0];
380
      int[] tmp = new int[num];
381
      for(int i=0; i<num; i++) tmp[i] = 3;
382
      mBasicAngle = new int[][] { tmp,tmp,tmp,tmp };
383
      }
384

  
385
    return mBasicAngle;
697 386
    }
698 387

  
699 388
///////////////////////////////////////////////////////////////////////////////////////////////////
......
707 396

  
708 397
  public float getStickerStroke()
709 398
    {
710
    if( mPosition==null ) mPosition = getInitData().getPos();
711
    boolean icon = isInIconMode();
399
    return isInIconMode() ? 0.16f : 0.08f;
400
    }
712 401

  
713
    if( mPosition==POS_5 ) return icon ? 0.30f : 0.11f;
714
    if( mPosition==POS_6 ) return icon ? 0.30f : 0.10f;
402
///////////////////////////////////////////////////////////////////////////////////////////////////
715 403

  
716
    return icon ? 0.16f : 0.08f;
404
  public float[][] getStickerAngles()
405
    {
406
    return null;
717 407
    }
718 408

  
719 409
///////////////////////////////////////////////////////////////////////////////////////////////////
720 410

  
721 411
  public String getShortName()
722 412
    {
723
    if( mPosition==null ) mPosition = getInitData().getPos();
724

  
725
    if( mPosition==POS_1 ) return ObjectType.BAN1_3.name();
726
    if( mPosition==POS_2 ) return ObjectType.BAN2_3.name();
727
    if( mPosition==POS_3 ) return ObjectType.BAN3_3.name();
728
    if( mPosition==POS_4 ) return ObjectType.BAN4_3.name();
729
    if( mPosition==POS_5 ) return ObjectType.BAN5_4.name();
730
    if( mPosition==POS_6 ) return ObjectType.BAN6_4.name();
731

  
732 413
    if( mSignature==null ) mSignature = getSignature();
733 414
    int[] numLayers = getNumLayers();
734
    int number = 100*numLayers[0]+10*numLayers[1]+numLayers[2];
735

  
736
    return number+"_"+mSignature.getString();
415
    return "P"+numLayers[0]+"_"+mSignature.getString();
737 416
    }
738 417

  
739 418
///////////////////////////////////////////////////////////////////////////////////////////////////
419
// TODO
740 420

  
741 421
  public ObjectSignature getSignature()
742 422
    {
......
752 432

  
753 433
  public String getObjectName()
754 434
    {
755
    if( mPosition==null ) mPosition = getInitData().getPos();
756

  
757
    if( mPosition==POS_1 ) return "Fused Cube";
758
    if( mPosition==POS_2 ) return "2Bar Cube";
759
    if( mPosition==POS_3 ) return "Bandaged Cube C";
760
    if( mPosition==POS_4 ) return "BiCube";
761
    if( mPosition==POS_5 ) return "AI Cube";
762
    if( mPosition==POS_6 ) return "Burr Cube";
763

  
764 435
    return OBJECT_NAME;
765 436
    }
766 437

  
......
768 439

  
769 440
  public String getInventor()
770 441
    {
771
    if( mPosition==null ) mPosition = getInitData().getPos();
772

  
773
    if( mPosition==POS_1 ) return "Ting Huang";
774
    if( mPosition==POS_2 ) return "Unknown";
775
    if( mPosition==POS_3 ) return "Andreas Nortmann";
776
    if( mPosition==POS_4 ) return "Uwe Meffert";
777
    if( mPosition==POS_5 ) return "David Adams";
778
    if( mPosition==POS_6 ) return "Unknown";
779

  
780 442
    return "??";
781 443
    }
782 444

  
......
784 446

  
785 447
  public int getYearOfInvention()
786 448
    {
787
    if( mPosition==null ) mPosition = getInitData().getPos();
788

  
789
    if( mPosition==POS_1 ) return 2011;
790
    if( mPosition==POS_2 ) return 0;
791
    if( mPosition==POS_3 ) return 2005;
792
    if( mPosition==POS_4 ) return 1999;
793
    if( mPosition==POS_5 ) return 2004;
794
    if( mPosition==POS_6 ) return 2002;
795

  
796 449
    return 0;
797 450
    }
798 451

  
......
800 453

  
801 454
  public int getComplexity()
802 455
    {
803
    if( mPosition==null ) mPosition = getInitData().getPos();
804

  
805
    if( mPosition==POS_1 ) return 1;
806
    if( mPosition==POS_2 ) return 2;
807
    if( mPosition==POS_3 ) return 2;
808
    if( mPosition==POS_4 ) return 3;
809
    if( mPosition==POS_5 ) return 4;
810
    if( mPosition==POS_6 ) return 3;
811

  
812 456
    return 4;
813 457
    }
814 458

  
......
816 460

  
817 461
  public String[][] getTutorials()
818 462
    {
819
    if( mPosition==null ) mPosition = getInitData().getPos();
820

  
821
    if( mPosition==POS_1 )
822
      {
823
      return new String[][]{
824
                            {"gb","F_iJk_IvpVo","Bandaged Cube","CanChrisSolve"},
825
                            {"es","_lTgw5aEFOg","Tutorial 3x3 Fuse Cube","QBAndo"},
826
                            {"ru","raYDwFEXIq4","Как собрать Fused Cube","Алексей Ярыгин"},
827
                            {"fr","9Cfi4rhKzIw","Tutoriel: résolution du Fused Cube","Skieur Cubb"},
828
                            {"pl","0PcUoGxQa6s","Bandaged 3x3 v.A cube","MrUK"},
829
                            {"kr","1RePOLrzJNE","밴디지 타입 A 해법","듀나메스 큐브 해법연구소"},
830
                            {"vn","vg4J0U0n1oA","Tutorial N.1 - Bandaged VA","Duy Thích Rubik"},
831
                           };
832
      }
833
    if( mPosition==POS_2 )
834
      {
835
      return new String[][]{
836
                            {"ru","lS_EK0PMWI8","Как собрать 2-bar Cube","Алексей Ярыгин"},
837
                            {"pl","tX8ubTLh6p8","Bandaged 3x3 (Two bar)","MrUK"},
838
                            {"kr","NE6XuC1r8xw","밴디지 큐브","Denzel Washington"},
839
                           };
840
      }
841
    if( mPosition==POS_3 )
842
      {
843
      return new String[][]{
844
                            {"gb","7UiCVGygUT4","Bandage Cube C Tutorial","PolyakB"},
845
                            {"ru","gXenRA92Wdc","Как собрать Bandaged 3x3 Type C","YG Cuber"},
846
                            {"pl","sKfdFLm79Zs","Bandaged 3x3 v.C cube","MrUK"},
847
                            {"kr","BcCFgeFy6Ec","밴디지 타입 C 해법","듀나메스 큐브 해법연구소"},
848
                            {"vn","9674LLkPSog","Tutorial N.2 - Bandaged VC","Duy Thích Rubik"},
849
                           };
850
      }
851
    if( mPosition==POS_4 )
852
      {
853
      return new String[][]{
854
                            {"gb","AnpdIKICBpM","Trying to Solve a Bandaged Cube","RedKB"},
855
                            {"es","cUyo5fycrvI","Tutorial Bandaged Cube en español","Rafa Garcia Benacazon"},
856
                            {"ru","-MTzeEJptsg","Как собрать bandaged Cube B","стратегия знаний"},
857
                            {"fr","3rsfIJ3roT0","Tutoriel: résolution du Bicube","Skieur Cubb"},
858
                            {"de","sqWVRwkXX9w","Bandaged Cube - Tutorial","GerCubing"},
859
                            {"pl","XcHzTvVR6Po","Bandaged 3x3 v.B cube","MrUK"},
860
                            {"kr","1gsoijF_5q0","BiCube Tutorial (해법)","듀나메스 큐브 해법연구소"},
861
                            {"vn","ZCJDaF4jEbc","Tutorial N.3 - BiCube","Duy Thích Rubik"},
862
                           };
863
      }
864
    if( mPosition==POS_5 )
865
      {
866
      return new String[][]{
867
                            {"gb","b62HPjlUmYQ","4x4x4 AI Bandaged Cube 1/2","Superantoniovivaldi"},
868
                            {"gb","DQeZ0iDqt4s","4x4x4 AI Bandaged Cube 2/2","Superantoniovivaldi"},
869
                            {"es","bZRV8aXyIY4","Tutorial AI Cube 4x4","QBAndo"},
870
                            {"ru","2NIEHu6jE9o","Как собрать AI Cube","Rodion Strizhakov"},
871
                            {"fr","iP9sSg1q0K0","Résolution de l'AI Cube","asthalis"},
872
                            {"pl","y6MNyoHgY8A","All Bandage 4x4 cube TUTORIAL","MrUK"},
873
                            {"br","yGnQ4ObiPRY","Como Resolver o 4x4 Bandaged 1/4","Rafael Cinoto"},
874
                            {"br","XJUtQrwrCmA","Como Resolver o 4x4 Bandaged 2/4","Rafael Cinoto"},
875
                            {"br","Wrdec2WNBSY","Como Resolver o 4x4 Bandaged 3/4","Rafael Cinoto"},
876
                            {"br","mWvYD53fqHI","Como Resolver o 4x4 Bandaged 4/4","Rafael Cinoto"},
877
                            {"kr","MvaFtrU4O_k","AI 밴디지 큐브 해법","듀나메스 큐브 해법연구소"},
878
                            {"vn","aAP1E567ADc","Tutorial N.78 - AI Cube","Duy Thích Rubik"},
879
                           };
880
      }
881
    if( mPosition==POS_6 )
882
      {
883
      return new String[][]{
884
                            {"gb","_FnNzFo0ITM","Burr Cube Tutorial 1/2","Superantoniovivaldi"},
885
                            {"gb","NOf-UcNh4sI","Burr Cube Tutorial 2/2","Superantoniovivaldi"},
886
                            {"es","xR2TLKQmym8","Cómo Resuelvo Wall Cube","Robert Cubes"},
887
                            {"vn","cbDUtkIJjfk","Tutorial N.96 - Burr Cube","Duy Thích Rubik"},
888
                           };
889
      }
890 463
    return null;
891 464
    }
892 465
}

Also available in: Unified diff