Project

General

Profile

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

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

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