Project

General

Profile

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

distorted-objectlib / src / main / java / org / distorted / objectlib / objects / TwistySkewb.java @ cf93ea4e

1 29b82486 Leszek Koltunski
///////////////////////////////////////////////////////////////////////////////////////////////////
2
// Copyright 2020 Leszek Koltunski                                                               //
3
//                                                                                               //
4
// This file is part of Magic Cube.                                                              //
5
//                                                                                               //
6 6133be67 Leszek Koltunski
// 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 29b82486 Leszek Koltunski
///////////////////////////////////////////////////////////////////////////////////////////////////
9
10
package org.distorted.objectlib.objects;
11
12 c9c71c3f Leszek Koltunski
import static org.distorted.objectlib.touchcontrol.TouchControl.TC_HEXAHEDRON;
13
import static org.distorted.objectlib.touchcontrol.TouchControl.TYPE_SPLIT_CORNER;
14 29b82486 Leszek Koltunski
15
import org.distorted.library.type.Static3D;
16
import org.distorted.library.type.Static4D;
17
18 84a17011 Leszek Koltunski
import org.distorted.objectlib.helpers.FactoryCubit;
19 3ee1d662 Leszek Koltunski
import org.distorted.objectlib.helpers.ObjectFaceShape;
20 1d581993 Leszek Koltunski
import org.distorted.objectlib.helpers.ObjectSignature;
21 84a17011 Leszek Koltunski
import org.distorted.objectlib.helpers.ObjectVertexEffects;
22 cf93ea4e Leszek Koltunski
import org.distorted.objectlib.main.InitAssets;
23 2dffaf22 Leszek Koltunski
import org.distorted.objectlib.main.ObjectSignatures;
24 9ba7f3f6 Leszek Koltunski
import org.distorted.objectlib.scrambling.ScrambleEdgeGenerator;
25 a8295031 Leszek Koltunski
import org.distorted.objectlib.main.InitData;
26 c9c71c3f Leszek Koltunski
import org.distorted.objectlib.touchcontrol.TouchControlHexahedron;
27 8005e762 Leszek Koltunski
import org.distorted.objectlib.main.ObjectType;
28 198c5bf0 Leszek Koltunski
import org.distorted.objectlib.helpers.ObjectShape;
29 b31249d6 Leszek Koltunski
import org.distorted.objectlib.shape.ShapeHexahedron;
30 29b82486 Leszek Koltunski
31
///////////////////////////////////////////////////////////////////////////////////////////////////
32
33 386af988 Leszek Koltunski
public class TwistySkewb extends ShapeHexahedron
34 29b82486 Leszek Koltunski
{
35
  static final Static3D[] ROT_AXIS = new Static3D[]
36
         {
37 84a17011 Leszek Koltunski
           new Static3D( SQ3/3, SQ3/3, SQ3/3),
38
           new Static3D( SQ3/3, SQ3/3,-SQ3/3),
39
           new Static3D( SQ3/3,-SQ3/3, SQ3/3),
40
           new Static3D( SQ3/3,-SQ3/3,-SQ3/3)
41 29b82486 Leszek Koltunski
         };
42
43 9ba7f3f6 Leszek Koltunski
  private int[][] mEdges;
44 beee90ab Leszek Koltunski
  private int[][] mBasicAngle;
45 29b82486 Leszek Koltunski
  private float[][] mCuts;
46 82e62580 Leszek Koltunski
  private float[][] mPositions;
47 29b82486 Leszek Koltunski
48
///////////////////////////////////////////////////////////////////////////////////////////////////
49
50 cf93ea4e Leszek Koltunski
  public TwistySkewb(int meshState, int iconMode, Static4D quat, Static3D move, float scale, InitData data, InitAssets asset)
51 29b82486 Leszek Koltunski
    {
52 cf93ea4e Leszek Koltunski
    super(meshState, iconMode, 2*data.getNumLayers()[0]-2, quat, move, scale, data, asset);
53 29b82486 Leszek Koltunski
    }
54
55
///////////////////////////////////////////////////////////////////////////////////////////////////
56
57 9ba7f3f6 Leszek Koltunski
  public int[][] getScrambleEdges()
58 29b82486 Leszek Koltunski
    {
59 9ba7f3f6 Leszek Koltunski
    if( mEdges==null ) mEdges = ScrambleEdgeGenerator.getScrambleEdgesSingle(mBasicAngle);
60
    return mEdges;
61 29b82486 Leszek Koltunski
    }
62
63
///////////////////////////////////////////////////////////////////////////////////////////////////
64
65
  private int getNumCorners()
66
    {
67
    return 8;
68
    }
69
70
///////////////////////////////////////////////////////////////////////////////////////////////////
71
72 a57e6870 Leszek Koltunski
  private int getNumEdges(int numLayers)
73 29b82486 Leszek Koltunski
    {
74 a57e6870 Leszek Koltunski
    return (numLayers-2)*12;
75 29b82486 Leszek Koltunski
    }
76
77
///////////////////////////////////////////////////////////////////////////////////////////////////
78
79 a57e6870 Leszek Koltunski
  private int getNumCentersPerFace(int numLayers)
80 29b82486 Leszek Koltunski
    {
81 a57e6870 Leszek Koltunski
    return ((numLayers-2)*(numLayers-2) + (numLayers-1)*(numLayers-1));
82 29b82486 Leszek Koltunski
    }
83
84
///////////////////////////////////////////////////////////////////////////////////////////////////
85
86 7bbfc84f Leszek Koltunski
  public float[][] getCuts(int[] numLayers)
87 29b82486 Leszek Koltunski
    {
88
    if( mCuts==null )
89
      {
90 84a17011 Leszek Koltunski
      float[] c = numLayers[0]==2 ? (new float[] {0.0f}) : (new float[] {-SQ3/6, SQ3/6});
91 29b82486 Leszek Koltunski
      mCuts = new float[][] {c,c,c,c};
92
      }
93
94
    return mCuts;
95
    }
96
97
///////////////////////////////////////////////////////////////////////////////////////////////////
98
99 59c20632 Leszek Koltunski
  public boolean[][] getLayerRotatable(int[] numLayers)
100
    {
101
    boolean[] tmp = numLayers[0]==2 ? (new boolean[] {true,true}) : (new boolean[] {true,false,true});
102 1b7ece90 Leszek Koltunski
    return new boolean[][] { tmp,tmp,tmp,tmp };
103 59c20632 Leszek Koltunski
    }
104
105
///////////////////////////////////////////////////////////////////////////////////////////////////
106
107 11fa413d Leszek Koltunski
  public int getTouchControlType()
108 59c20632 Leszek Koltunski
    {
109 c9c71c3f Leszek Koltunski
    return TC_HEXAHEDRON;
110 59c20632 Leszek Koltunski
    }
111
112
///////////////////////////////////////////////////////////////////////////////////////////////////
113
114 11fa413d Leszek Koltunski
  public int getTouchControlSplit()
115 59c20632 Leszek Koltunski
    {
116
    return TYPE_SPLIT_CORNER;
117
    }
118
119
///////////////////////////////////////////////////////////////////////////////////////////////////
120
121
  public int[][][] getEnabled()
122 29b82486 Leszek Koltunski
    {
123 59c20632 Leszek Koltunski
    return new int[][][]
124 29b82486 Leszek Koltunski
      {
125 59c20632 Leszek Koltunski
          {{0,1},{3,1},{2,3},{0,2}},
126
          {{2,3},{3,1},{0,1},{0,2}},
127
          {{1,2},{0,1},{0,3},{2,3}},
128
          {{1,2},{2,3},{0,3},{0,1}},
129
          {{0,3},{0,2},{1,2},{1,3}},
130
          {{1,2},{0,2},{0,3},{1,3}},
131
      };
132
    }
133
134
///////////////////////////////////////////////////////////////////////////////////////////////////
135
136
  public float[] getDist3D(int[] numLayers)
137
    {
138 4c9ca251 Leszek Koltunski
    return TouchControlHexahedron.D3D;
139
    }
140
141
///////////////////////////////////////////////////////////////////////////////////////////////////
142
143
  public Static3D[] getFaceAxis()
144
    {
145
    return TouchControlHexahedron.FACE_AXIS;
146 29b82486 Leszek Koltunski
    }
147
148
///////////////////////////////////////////////////////////////////////////////////////////////////
149
150 7b832206 Leszek Koltunski
  public float[][] getCubitPositions(int[] numLayers)
151 29b82486 Leszek Koltunski
    {
152 82e62580 Leszek Koltunski
    if( mPositions==null )
153
      {
154
      int numL = numLayers[0];
155
      final float DIST_CORNER = numL-1;
156
      final float DIST_EDGE   = numL-1;
157
      final float DIST_CENTER = numL-1;
158 29b82486 Leszek Koltunski
159 82e62580 Leszek Koltunski
      final int numCorners = getNumCorners();
160
      final int numEdges   = getNumEdges(numL);
161
      final int numCenters = 6*getNumCentersPerFace(numL);
162 29b82486 Leszek Koltunski
163 82e62580 Leszek Koltunski
      mPositions = new float[numCorners+numEdges+numCenters][];
164 29b82486 Leszek Koltunski
165 82e62580 Leszek Koltunski
      /// CORNERS //////////////////////////////////////////////
166 29b82486 Leszek Koltunski
167 82e62580 Leszek Koltunski
      mPositions[0] = new float[] { DIST_CORNER, DIST_CORNER, DIST_CORNER };
168
      mPositions[1] = new float[] { DIST_CORNER, DIST_CORNER,-DIST_CORNER };
169
      mPositions[2] = new float[] { DIST_CORNER,-DIST_CORNER, DIST_CORNER };
170
      mPositions[3] = new float[] { DIST_CORNER,-DIST_CORNER,-DIST_CORNER };
171
      mPositions[4] = new float[] {-DIST_CORNER, DIST_CORNER, DIST_CORNER };
172
      mPositions[5] = new float[] {-DIST_CORNER, DIST_CORNER,-DIST_CORNER };
173
      mPositions[6] = new float[] {-DIST_CORNER,-DIST_CORNER, DIST_CORNER };
174
      mPositions[7] = new float[] {-DIST_CORNER,-DIST_CORNER,-DIST_CORNER };
175 29b82486 Leszek Koltunski
176 82e62580 Leszek Koltunski
      /// CENTERS //////////////////////////////////////////////
177 29b82486 Leszek Koltunski
178 82e62580 Leszek Koltunski
      int index=8;
179
      final float X= -1000.0f;
180
      final float Y= -1001.0f;
181 29b82486 Leszek Koltunski
182 82e62580 Leszek Koltunski
      final float[][]  centerTable =
183 29b82486 Leszek Koltunski
        {
184 dcce7b29 Leszek Koltunski
            {X,Y,+DIST_CENTER},
185
            {X,Y,-DIST_CENTER},
186 29b82486 Leszek Koltunski
            {X,+DIST_CENTER,Y},
187
            {X,-DIST_CENTER,Y},
188 dcce7b29 Leszek Koltunski
            {+DIST_CENTER,X,Y},
189
            {-DIST_CENTER,X,Y},
190 29b82486 Leszek Koltunski
        };
191
192 82e62580 Leszek Koltunski
      float x,y, cen0, cen1, cen2;
193 29b82486 Leszek Koltunski
194 82e62580 Leszek Koltunski
      for( float[] centers : centerTable )
195 29b82486 Leszek Koltunski
        {
196 82e62580 Leszek Koltunski
        x = 2-numL;
197 29b82486 Leszek Koltunski
198 82e62580 Leszek Koltunski
        for(int i=0; i<numL-1; i++, x+=2)
199 29b82486 Leszek Koltunski
          {
200 82e62580 Leszek Koltunski
          y = 2-numL;
201
202
          for(int j=0; j<numL-1; j++, y+=2, index++)
203
            {
204
                 if( centers[0]==Y ) cen0 = y;
205
            else if( centers[0]==X ) cen0 = x;
206
            else                     cen0 = centers[0];
207 29b82486 Leszek Koltunski
208 82e62580 Leszek Koltunski
                 if( centers[1]==Y ) cen1 = y;
209
            else if( centers[1]==X ) cen1 = x;
210
            else                     cen1 = centers[1];
211 29b82486 Leszek Koltunski
212 82e62580 Leszek Koltunski
                 if( centers[2]==Y ) cen2 = y;
213
            else if( centers[2]==X ) cen2 = x;
214
            else                     cen2 = centers[2];
215 29b82486 Leszek Koltunski
216 82e62580 Leszek Koltunski
            mPositions[index] = new float[] {cen0,cen1,cen2};
217
            }
218 29b82486 Leszek Koltunski
          }
219
220 82e62580 Leszek Koltunski
        x = 3-numL;
221 29b82486 Leszek Koltunski
222 82e62580 Leszek Koltunski
        for(int i=0; i<numL-2; i++, x+=2)
223 29b82486 Leszek Koltunski
          {
224 82e62580 Leszek Koltunski
          y = 3-numL;
225
226
          for(int j=0; j<numL-2; j++, y+=2, index++)
227
            {
228
                 if( centers[0]==Y ) cen0 = y;
229
            else if( centers[0]==X ) cen0 = x;
230
            else                     cen0 = centers[0];
231 29b82486 Leszek Koltunski
232 82e62580 Leszek Koltunski
                 if( centers[1]==Y ) cen1 = y;
233
            else if( centers[1]==X ) cen1 = x;
234
            else                     cen1 = centers[1];
235 29b82486 Leszek Koltunski
236 82e62580 Leszek Koltunski
                 if( centers[2]==Y ) cen2 = y;
237
            else if( centers[2]==X ) cen2 = x;
238
            else                     cen2 = centers[2];
239 29b82486 Leszek Koltunski
240 82e62580 Leszek Koltunski
            mPositions[index] = new float[] {cen0,cen1,cen2};
241
            }
242 29b82486 Leszek Koltunski
          }
243
        }
244
245 82e62580 Leszek Koltunski
      /// EDGES ///////////////////////////////////////////////
246 7af68038 Leszek Koltunski
247 82e62580 Leszek Koltunski
      final float[][]  edgeTable =
248 7af68038 Leszek Koltunski
        {
249
            {0,+DIST_EDGE,+DIST_EDGE},
250
            {+DIST_EDGE,0,+DIST_EDGE},
251
            {0,-DIST_EDGE,+DIST_EDGE},
252
            {-DIST_EDGE,0,+DIST_EDGE},
253
            {+DIST_EDGE,+DIST_EDGE,0},
254
            {+DIST_EDGE,-DIST_EDGE,0},
255
            {-DIST_EDGE,-DIST_EDGE,0},
256
            {-DIST_EDGE,+DIST_EDGE,0},
257
            {0,+DIST_EDGE,-DIST_EDGE},
258
            {+DIST_EDGE,0,-DIST_EDGE},
259
            {0,-DIST_EDGE,-DIST_EDGE},
260
            {-DIST_EDGE,0,-DIST_EDGE}
261
        };
262
263 82e62580 Leszek Koltunski
      for (float[] edges : edgeTable)
264 7af68038 Leszek Koltunski
        {
265 82e62580 Leszek Koltunski
        float c = 3-numL;
266
267
        for (int j=0; j<numL-2; j++, c+=2, index++)
268
          {
269
          mPositions[index] = new float[] { edges[0]==0 ? c : edges[0] ,
270
                                            edges[1]==0 ? c : edges[1] ,
271
                                            edges[2]==0 ? c : edges[2] };
272
          }
273 7af68038 Leszek Koltunski
        }
274
      }
275
276 82e62580 Leszek Koltunski
    return mPositions;
277 29b82486 Leszek Koltunski
    }
278
279
///////////////////////////////////////////////////////////////////////////////////////////////////
280
281 d0e6cf7f Leszek Koltunski
  public Static4D getCubitQuats(int cubit, int[] numLayers)
282 29b82486 Leszek Koltunski
    {
283 a57e6870 Leszek Koltunski
    int numL = numLayers[0];
284 29b82486 Leszek Koltunski
    int numCorners = getNumCorners();
285 7af68038 Leszek Koltunski
    int numCentersPerFace = getNumCentersPerFace(numL);
286
    int numCenters = 6*numCentersPerFace;
287 29b82486 Leszek Koltunski
288
    if( cubit<numCorners )
289
      {
290
      switch(cubit)
291
        {
292 802fe251 Leszek Koltunski
        case  0: return mObjectQuats[0];                   //  unit quat
293 29b82486 Leszek Koltunski
        case  1: return new Static4D( SQ2/2,0,0,SQ2/2);    //  90 along X
294
        case  2: return new Static4D(-SQ2/2,0,0,SQ2/2);    // -90 along X
295 802fe251 Leszek Koltunski
        case  3: return mObjectQuats[9];                   // 180 along X
296 29b82486 Leszek Koltunski
        case  4: return new Static4D(0, SQ2/2,0,SQ2/2);    //  90 along Y
297 802fe251 Leszek Koltunski
        case  5: return mObjectQuats[11];                  // 180 along Y
298 82e62580 Leszek Koltunski
        case  6: return mObjectQuats[10];                  // 180 along Z
299 29b82486 Leszek Koltunski
        case  7: return new Static4D(SQ2/2,0,-SQ2/2,0);    // 180 along (SQ2/2,0,-SQ2/2)
300
        }
301
      }
302 7af68038 Leszek Koltunski
    else if( cubit<numCorners+numCenters )
303
      {
304
      int center = (cubit-numCorners)/numCentersPerFace;
305
306
      switch(center)
307
        {
308 dcce7b29 Leszek Koltunski
        case 0: return mObjectQuats[0];
309
        case 1: return mObjectQuats[9];
310
        case 2: return mObjectQuats[1];
311
        case 3: return mObjectQuats[4];
312
        case 4: return mObjectQuats[2];
313
        case 5: return mObjectQuats[3];
314 7af68038 Leszek Koltunski
        }
315
      }
316
    else
317 29b82486 Leszek Koltunski
      {
318 7af68038 Leszek Koltunski
      int edge = (cubit-numCorners-numCenters)/(numL-2);
319 29b82486 Leszek Koltunski
320
      switch(edge)
321
        {
322 802fe251 Leszek Koltunski
        case  0: return mObjectQuats[ 0];
323
        case  1: return mObjectQuats[ 2];
324
        case  2: return mObjectQuats[10];
325
        case  3: return mObjectQuats[ 8];
326
        case  4: return mObjectQuats[ 1];
327
        case  5: return mObjectQuats[ 4];
328
        case  6: return mObjectQuats[ 6];
329
        case  7: return mObjectQuats[ 7];
330
        case  8: return mObjectQuats[11];
331
        case  9: return mObjectQuats[ 5];
332
        case 10: return mObjectQuats[ 9];
333
        case 11: return mObjectQuats[ 3];
334 29b82486 Leszek Koltunski
        }
335
      }
336
337
    return null;
338
    }
339
340 84a17011 Leszek Koltunski
///////////////////////////////////////////////////////////////////////////////////////////////////
341
342
  private float[][] getVertices(int variant)
343
    {
344
    if( variant==0 )
345
      {
346
      return new float[][] { {-1,0,0},{0,-1,0},{0,0,-1},{-1,-1,-1},{0,0,0} };
347
      }
348
    else if( variant==1 )
349
      {
350
      return new float[][] { {-1,0,0},{0,-1,0},{1,0,0},{0,1,0},{0,0,-1} };
351
      }
352
    else
353
      {
354
      return new float[][] { {-1,0,0},{1,0,0},{0,-1,0},{0,0,-1} };
355
      }
356
    }
357
358 29b82486 Leszek Koltunski
///////////////////////////////////////////////////////////////////////////////////////////////////
359
360 e30c522a Leszek Koltunski
  public ObjectShape getObjectShape(int variant)
361 3ee1d662 Leszek Koltunski
    {
362
    if( variant==0 )
363
      {
364 84a17011 Leszek Koltunski
      int[][] indices = { {0,1,4},{2,0,4},{1,2,4},{3,1,0},{3,2,1},{3,0,2} };
365
      return new ObjectShape(getVertices(variant), indices);
366 3ee1d662 Leszek Koltunski
      }
367
    else if( variant==1 )
368
      {
369 84a17011 Leszek Koltunski
      int[][] indices = { {0,1,2,3},{4,1,0},{4,2,1},{4,3,2},{4,0,3} };
370
      return new ObjectShape(getVertices(variant), indices);
371 3ee1d662 Leszek Koltunski
      }
372
    else
373
      {
374 84a17011 Leszek Koltunski
      int[][] indices = { {2,1,0},{3,0,1},{2,3,1},{3,2,0} };
375
      return new ObjectShape(getVertices(variant), indices);
376 3ee1d662 Leszek Koltunski
      }
377
    }
378
379
///////////////////////////////////////////////////////////////////////////////////////////////////
380
381
  public ObjectFaceShape getObjectFaceShape(int variant)
382 29b82486 Leszek Koltunski
    {
383 e30c522a Leszek Koltunski
    int numL = getNumLayers()[0];
384 29b82486 Leszek Koltunski
385
    if( variant==0 )
386
      {
387 a57e6870 Leszek Koltunski
      int N = numL==2 ? 7:5;
388
      int E1= numL==2 ? 3:2;
389
      int E2= numL==2 ? 5:3;
390 3bf19410 Leszek Koltunski
      float height = isInIconMode() ? 0.001f : 0.02f;
391 84a17011 Leszek Koltunski
      float[][] bands = { {height,35,0.16f,0.7f,N,E1,E1}, {0.001f, 35,1.00f,0.0f,3,1,E2} };
392
      int[] indices   = { 0,0,0,1,1,1 };
393
      return new ObjectFaceShape(bands,indices,null);
394
      }
395
    else if( variant==1 )
396
      {
397
      int N = numL==2 ? 7:6;
398
      int E = numL==2 ? 3:1;
399
      float height = isInIconMode() ? 0.001f : 0.04f;
400
      float[][] bands = { {height,35,SQ2/8,0.9f,N,E,E}, {0.001f,35,1,0.0f,3,0,0} };
401
      int[] indices   = { 0,1,1,1,1 };
402
      return new ObjectFaceShape(bands,indices,null);
403
      }
404
    else
405
      {
406
      int N = numL==2 ? 7:5;
407
      int E = numL==2 ? 5:2;
408
      float h1 = isInIconMode() ? 0.001f : 0.035f;
409
      float h2 = isInIconMode() ? 0.001f : 0.020f;
410
      float[][] bands = { {h1,30,0.16f,0.8f,N,2,E}, {h2,45,0.16f,0.2f,3,1,2} };
411
      int[] indices   = { 0,0,1,1 };
412
      return new ObjectFaceShape(bands,indices,null);
413
      }
414
    }
415
416
///////////////////////////////////////////////////////////////////////////////////////////////////
417
418
  public ObjectVertexEffects getVertexEffects(int variant)
419
    {
420
    if( variant==0 )
421
      {
422 4e9f2df5 Leszek Koltunski
      float[][] corners   = { {0.05f,0.25f}, {0.05f,0.20f} };
423
      int[] cornerIndices = { 1,1,1,0,0 };
424
      float[][] centers   = { {-0.5f, -0.5f, -0.5f} };
425
      int[] centerIndices = { 0,0,0,-1,0 };
426 84a17011 Leszek Koltunski
       return FactoryCubit.generateVertexEffect(getVertices(variant),corners,cornerIndices,centers,centerIndices);
427 29b82486 Leszek Koltunski
      }
428
    else if( variant==1 )
429
      {
430 4e9f2df5 Leszek Koltunski
      float[][] corners   = { {0.06f,0.15f} };
431
      int[] cornerIndices = { 0,0,0,0,0 };
432
      float[][] centers   = { {0,0,-0.4f} };
433
      int[] centerIndices = { 0,0,0,0,-1 };
434 84a17011 Leszek Koltunski
       return FactoryCubit.generateVertexEffect(getVertices(variant),corners,cornerIndices,centers,centerIndices);
435 29b82486 Leszek Koltunski
      }
436 7af68038 Leszek Koltunski
    else
437
      {
438 4e9f2df5 Leszek Koltunski
      float[][] corners   = { {0.07f,0.20f}, {0.02f,0.30f} };
439
      int[] cornerIndices = { 0,0,1,1 };
440
      float[][] centers   = { {0.0f, -0.5f, -0.5f} };
441
      int[] centerIndices = { 0,0,0,0 };
442 84a17011 Leszek Koltunski
      return FactoryCubit.generateVertexEffect(getVertices(variant),corners,cornerIndices,centers,centerIndices);
443 7af68038 Leszek Koltunski
      }
444 29b82486 Leszek Koltunski
    }
445
446
///////////////////////////////////////////////////////////////////////////////////////////////////
447
448 e30c522a Leszek Koltunski
  public int getNumCubitVariants(int[] numLayers)
449 29b82486 Leszek Koltunski
    {
450 7af68038 Leszek Koltunski
    return numLayers[0]==2 ? 2:3;
451 29b82486 Leszek Koltunski
    }
452
453
///////////////////////////////////////////////////////////////////////////////////////////////////
454
455 e30c522a Leszek Koltunski
  public int getCubitVariant(int cubit, int[] numLayers)
456 29b82486 Leszek Koltunski
    {
457 7af68038 Leszek Koltunski
    return cubit<8 ? 0 : (cubit<8+6*getNumCentersPerFace(numLayers[0]) ? 1:2);
458 29b82486 Leszek Koltunski
    }
459
460 89704841 Leszek Koltunski
///////////////////////////////////////////////////////////////////////////////////////////////////
461
462 d53fb890 Leszek Koltunski
  public float getStickerRadius()
463 89704841 Leszek Koltunski
    {
464
    return 0.08f;
465
    }
466
467
///////////////////////////////////////////////////////////////////////////////////////////////////
468
469 d53fb890 Leszek Koltunski
  public float getStickerStroke()
470 89704841 Leszek Koltunski
    {
471
    float stroke = 0.08f;
472
473 3bf19410 Leszek Koltunski
    if( isInIconMode() )
474 89704841 Leszek Koltunski
      {
475
      int[] numLayers = getNumLayers();
476
      stroke *= (numLayers[0]==2 ? 2.0f : 2.7f);
477
      }
478
479
    return stroke;
480
    }
481
482
///////////////////////////////////////////////////////////////////////////////////////////////////
483
484 d53fb890 Leszek Koltunski
  public float[][] getStickerAngles()
485 89704841 Leszek Koltunski
    {
486
    return null;
487
    }
488
489 29b82486 Leszek Koltunski
///////////////////////////////////////////////////////////////////////////////////////////////////
490
// PUBLIC API
491
492
  public Static3D[] getRotationAxis()
493
    {
494
    return ROT_AXIS;
495
    }
496
497
///////////////////////////////////////////////////////////////////////////////////////////////////
498
499 beee90ab Leszek Koltunski
  public int[][] getBasicAngles()
500 29b82486 Leszek Koltunski
    {
501 beee90ab Leszek Koltunski
    if( mBasicAngle ==null )
502
      {
503
      int num = getNumLayers()[0];
504
      int[] tmp = new int[num];
505
      for(int i=0; i<num; i++) tmp[i] = 3;
506
      mBasicAngle = new int[][] { tmp,tmp,tmp,tmp };
507
      }
508
509 29b82486 Leszek Koltunski
    return mBasicAngle;
510
    }
511
512 61aa85e4 Leszek Koltunski
///////////////////////////////////////////////////////////////////////////////////////////////////
513
514 5f54927b Leszek Koltunski
  public String getShortName()
515 61aa85e4 Leszek Koltunski
    {
516 5f54927b Leszek Koltunski
    switch(getNumLayers()[0])
517
      {
518
      case 2: return ObjectType.SKEW_2.name();
519
      case 3: return ObjectType.SKEW_3.name();
520
      }
521
522
    return ObjectType.SKEW_2.name();
523
    }
524
525
///////////////////////////////////////////////////////////////////////////////////////////////////
526
527 1d581993 Leszek Koltunski
  public ObjectSignature getSignature()
528 5f54927b Leszek Koltunski
    {
529
    switch(getNumLayers()[0])
530 61aa85e4 Leszek Koltunski
      {
531 2dffaf22 Leszek Koltunski
      case 2: return new ObjectSignature(ObjectSignatures.SKEW_2);
532
      case 3: return new ObjectSignature(ObjectSignatures.SKEW_3);
533 61aa85e4 Leszek Koltunski
      }
534
535 1d581993 Leszek Koltunski
    return null;
536 61aa85e4 Leszek Koltunski
    }
537
538 29b82486 Leszek Koltunski
///////////////////////////////////////////////////////////////////////////////////////////////////
539
540 e26eb4e7 Leszek Koltunski
  public String getObjectName()
541 29b82486 Leszek Koltunski
    {
542 e26eb4e7 Leszek Koltunski
    switch(getNumLayers()[0])
543 29b82486 Leszek Koltunski
      {
544 e26eb4e7 Leszek Koltunski
      case 2: return "Skewb";
545
      case 3: return "Master Skewb";
546 29b82486 Leszek Koltunski
      }
547 1d581993 Leszek Koltunski
    return null;
548 29b82486 Leszek Koltunski
    }
549
550
///////////////////////////////////////////////////////////////////////////////////////////////////
551
552 e26eb4e7 Leszek Koltunski
  public String getInventor()
553 29b82486 Leszek Koltunski
    {
554 e26eb4e7 Leszek Koltunski
    switch(getNumLayers()[0])
555 29b82486 Leszek Koltunski
      {
556 e26eb4e7 Leszek Koltunski
      case 2: return "Tony Durham";
557
      case 3: return "Katsuhiko Okamoto";
558 29b82486 Leszek Koltunski
      }
559 1d581993 Leszek Koltunski
    return null;
560 29b82486 Leszek Koltunski
    }
561
562 59c20632 Leszek Koltunski
///////////////////////////////////////////////////////////////////////////////////////////////////
563
564 e26eb4e7 Leszek Koltunski
  public int getYearOfInvention()
565 59c20632 Leszek Koltunski
    {
566 e26eb4e7 Leszek Koltunski
    switch(getNumLayers()[0])
567 59c20632 Leszek Koltunski
      {
568
      case 2: return 1982;
569
      case 3: return 2003;
570
      }
571
    return 1982;
572
    }
573
574 29b82486 Leszek Koltunski
///////////////////////////////////////////////////////////////////////////////////////////////////
575
576 e26eb4e7 Leszek Koltunski
  public int getComplexity()
577 29b82486 Leszek Koltunski
    {
578 e26eb4e7 Leszek Koltunski
    switch(getNumLayers()[0])
579 29b82486 Leszek Koltunski
      {
580 b4223a92 Leszek Koltunski
      case 2: return 1;
581
      case 3: return 3;
582 29b82486 Leszek Koltunski
      }
583
    return 5;
584
    }
585 052e0362 Leszek Koltunski
586
///////////////////////////////////////////////////////////////////////////////////////////////////
587
588
  public String[][] getTutorials()
589
    {
590
    int[] numLayers = getNumLayers();
591
592
    switch(numLayers[0])
593
      {
594
      case 2: return new String[][] {
595
                          {"gb","I6132yshkeU","How to Solve the Skewb","Z3"},
596
                          {"es","wxQX3HhPgds","Resolver Skewb (Principiantes)","Cuby"},
597
                          {"ru","EICw3aqn6Bc","Как собрать Скьюб?","Алексей Ярыгин"},
598
                          {"fr","lR-GuIroh4k","Comment réussir le skewb","Rachma Nikov"},
599
                          {"de","7RX6D5pznOk","Skewb lösen","Pezcraft"},
600
                          {"pl","ofRu1fByNpk","Jak ułożyć: Skewb","DżoDżo"},
601
                          {"br","mNycauwshWs","Como resolver o Skewb","Pedro Filho"},
602
                          {"kr","5R3sU-_bMAI","SKEWB 초보 공식","iamzoone"},
603 a399e91b Leszek Koltunski
                          {"vn","Db5mXuqgQP8","Tutorial N.5 - Skewb","Duy Thích Rubik"},
604 052e0362 Leszek Koltunski
                     //   {"tw","8srf9xhsS9k","Skewb斜轉方塊解法","1hrBLD"},
605
                         };
606
      case 3: return new String[][] {
607
                          {"gb","Jiuf7zQyPYI","Master Skewb Cube Tutorial","Bearded Cubing"},
608
                          {"es","8TP6p63KQCA","Master Skewb en Español","jorlozCubes"},
609
                          {"ru","7155QSp3T74","часть 1: Как собрать мастер Скьюб","Иван Циков"},
610
                          {"ru","14ey-RihjgY","часть 2: Как собрать мастер Скьюб","Иван Циков"},
611
                          {"ru","watq6TLa5_E","часть 2.5: Как собрать мастер Скьюб","Иван Циков"},
612
                          {"ru","UnsvseFBXmo","часть 3: Как собрать мастер Скьюб","Иван Циков"},
613
                          {"fr","tYMoY4EOHVA","Résolution du Master Skewb","Asthalis"},
614
                          {"de","LSErzqGNElI","Master Skewb lösen","JamesKnopf"},
615
                          {"pl","Y7l3AYFvDJI","Master Skewb TUTORIAL PL","MrUk"},
616
                          {"kr","ycR-WmXJCG0","마스터 스큐브 3번째 해법","듀나메스 큐브 해법연구소"},
617 a399e91b Leszek Koltunski
                          {"vn","uG8H0ZQTZgw","Tutorial N.35 - Master Skewb","Duy Thích Rubik"},
618 052e0362 Leszek Koltunski
                         };
619
      }
620
    return null;
621
    }
622 29b82486 Leszek Koltunski
}