Project

General

Profile

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

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

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