Project

General

Profile

Download (19.9 KB) Statistics
| Branch: | Tag: | Revision:

magiccube / src / main / java / org / distorted / objects / TwistyMinx.java @ df664009

1 a64e07d0 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.objects;
21
22
import android.content.res.Resources;
23
24 af0de0af Leszek Koltunski
import org.distorted.helpers.ObjectSticker;
25 aa26ba7f Leszek Koltunski
import org.distorted.helpers.ScrambleState;
26 a64e07d0 Leszek Koltunski
import org.distorted.library.main.DistortedEffects;
27
import org.distorted.library.main.DistortedTexture;
28
import org.distorted.library.mesh.MeshSquare;
29
import org.distorted.library.type.Static3D;
30
import org.distorted.library.type.Static4D;
31
32
///////////////////////////////////////////////////////////////////////////////////////////////////
33
34
abstract class TwistyMinx extends TwistyObject
35
{
36
  private static final int FACES_PER_CUBIT =6;
37
38 ead91342 Leszek Koltunski
  static final int NUM_CORNERS = 20;
39
  static final int NUM_CENTERS = 12;
40
  static final int NUM_EDGES   = 30;
41
42 bb11be2a Leszek Koltunski
  static final float C2       = (SQ5+3)/4;
43
  static final float LEN      = (float)(Math.sqrt(1.25f+0.5f*SQ5));
44
  static final float SIN54    = (SQ5+1)/4;
45
  static final float COS54    = (float)(Math.sqrt(10-2*SQ5)/4);
46
  static final float SIN18    = (SQ5-1)/4;
47
  static final float COS18    = (float)(0.25f*Math.sqrt(10.0f+2.0f*SQ5));
48
  static final float COS_HALFD= (float)(Math.sqrt(0.5f-0.1f*SQ5)); // cos(half the dihedral angle)
49
  static final float SIN_HALFD= (float)(Math.sqrt(0.5f+0.1f*SQ5)); // sin(half the dihedral angle)
50 a64e07d0 Leszek Koltunski
51
  // the six rotation axis of a Minx. Must be normalized.
52
  static final Static3D[] ROT_AXIS = new Static3D[]
53
         {
54 bb11be2a Leszek Koltunski
           new Static3D(    C2/LEN, SIN54/LEN,    0      ),
55
           new Static3D(   -C2/LEN, SIN54/LEN,    0      ),
56
           new Static3D( 0        ,    C2/LEN, SIN54/LEN ),
57
           new Static3D( 0        ,   -C2/LEN, SIN54/LEN ),
58
           new Static3D( SIN54/LEN,    0     ,    C2/LEN ),
59
           new Static3D( SIN54/LEN,    0     ,   -C2/LEN )
60 a64e07d0 Leszek Koltunski
         };
61
62 bc649d9a Leszek Koltunski
  static final int MINX_LGREEN = 0xff53aa00;
63
  static final int MINX_PINK   = 0xfffd7ab7;
64
  static final int MINX_SANDY  = 0xffefd48b;
65
  static final int MINX_LBLUE  = 0xff00a2d7;
66
  static final int MINX_ORANGE = 0xffff6200;
67
  static final int MINX_VIOLET = 0xff7d59a4;
68
  static final int MINX_DGREEN = 0xff007a47;
69
  static final int MINX_DRED   = 0xffbd0000;
70
  static final int MINX_DBLUE  = 0xff1a29b2;
71
  static final int MINX_DYELLOW= 0xffffc400;
72
  static final int MINX_WHITE  = 0xffffffff;
73
  static final int MINX_GREY   = 0xff727c7b;
74 a64e07d0 Leszek Koltunski
75
  static final int[] FACE_COLORS = new int[]
76
         {
77
           MINX_LGREEN, MINX_PINK   , MINX_SANDY , MINX_LBLUE,
78
           MINX_ORANGE, MINX_VIOLET , MINX_DGREEN, MINX_DRED ,
79
           MINX_DBLUE , MINX_DYELLOW, MINX_WHITE , MINX_GREY
80
         };
81
82 af0de0af Leszek Koltunski
  private ScrambleState[] mStates;
83
  private int[] mBasicAngle;
84
  private int[] mFaceMap;
85
  Static4D[] mQuats;
86
  float[][] mCenterCoords;
87
  float[][] mCorners;
88
  int[][] mCornerFaceMap;
89
  int[] mQuatEdgeIndices;
90
  int[] mQuatCornerIndices;
91
  int[][] mEdgeMap;
92
  int[][] mCenterMap;
93
  Static4D[] mBasicCornerV, mCurrCornerV;
94
  ObjectSticker[] mStickers;
95 a480ee80 Leszek Koltunski
96 af0de0af Leszek Koltunski
///////////////////////////////////////////////////////////////////////////////////////////////////
97 a64e07d0 Leszek Koltunski
98 af0de0af Leszek Koltunski
  TwistyMinx(int numLayers, int realSize, Static4D quat, DistortedTexture texture, MeshSquare mesh,
99
             DistortedEffects effects, int[][] moves, ObjectList obj, Resources res, int scrWidth)
100
    {
101
    super(numLayers, realSize, quat, texture, mesh, effects, moves, obj, res, scrWidth);
102
    }
103 a64e07d0 Leszek Koltunski
104 91792184 Leszek Koltunski
///////////////////////////////////////////////////////////////////////////////////////////////////
105
106
  ScrambleState[] getScrambleStates()
107
    {
108
    if( mStates==null )
109
      {
110
      int numLayers = getNumLayers();
111
      initializeScrambleStates(numLayers);
112
      }
113
114
    return mStates;
115
    }
116 7764a67a Leszek Koltunski
117 af0de0af Leszek Koltunski
///////////////////////////////////////////////////////////////////////////////////////////////////
118 7764a67a Leszek Koltunski
119 af0de0af Leszek Koltunski
  void initializeCornerV()
120
    {
121
    mBasicCornerV = new Static4D[3];
122
    mCurrCornerV  = new Static4D[3];
123
124 387b6326 Leszek Koltunski
    mBasicCornerV[0] = new Static4D( (SQ5+1)*0.375f, (SQ5-1)*0.375f, -0.750f, 0.0f );
125
    mBasicCornerV[1] = new Static4D(-(SQ5+1)*0.375f, (SQ5-1)*0.375f, -0.750f, 0.0f );
126
    mBasicCornerV[2] = new Static4D(              0,        -1.500f,    0.0f, 0.0f );
127 af0de0af Leszek Koltunski
    }
128
129
///////////////////////////////////////////////////////////////////////////////////////////////////
130
// the five vertices that form a given face. Order: the same as colors of the faces in TwistyMinx.
131
132
  void initializeCenterMap()
133
    {
134
    mCenterMap = new int[][]
135
         {
136
           { 0, 12,  4, 14,  2},
137
           { 0,  2, 18,  6, 16},
138
           { 6, 18, 11, 19,  7},
139
           { 3, 15,  9, 11, 19},
140
           { 4,  5, 15,  9, 14},
141
           { 1, 13,  5, 15,  3},
142
           { 1,  3, 19,  7, 17},
143
           {10, 16,  6,  7, 17},
144
           { 0, 12,  8, 10, 16},
145
           { 8, 13,  5,  4, 12},
146
           { 1, 13,  8, 10, 17},
147
           { 2, 14,  9, 11, 18},
148
         };
149
    }
150 d38f1397 Leszek Koltunski
151 af0de0af Leszek Koltunski
///////////////////////////////////////////////////////////////////////////////////////////////////
152
// the quadruple ( corner1, corner2, face1, face2 ) defining an edge.
153
// In fact the 2 corners already define it, the faces only provide easy
154
// way to get to know the colors. Order: arbitrary. Face1 arbitrarily on
155
// the 'left' or right of vector corner1 --> corner2, according to Quat.
156
157
  void initializeEdgeMap()
158
    {
159
    mEdgeMap = new int[][]
160 ead91342 Leszek Koltunski
         {
161 7a606778 Leszek Koltunski
           {  0, 12,  0,  8}, //0
162 ead91342 Leszek Koltunski
           { 12,  4,  0,  9},
163
           {  4, 14,  0,  4},
164
           { 14,  2,  0, 11},
165
           {  2,  0,  0,  1},
166 7a606778 Leszek Koltunski
           { 14,  9, 11,  4}, //5
167
           {  9, 11, 11,  3},
168
           { 11, 18, 11,  2},
169
           { 18,  2, 11,  1},
170 ead91342 Leszek Koltunski
           { 18,  6,  1,  2},
171 7a606778 Leszek Koltunski
           {  6, 16,  1,  7}, //10
172
           { 16,  0,  1,  8},
173
           { 16, 10,  8,  7},
174
           { 10,  8,  8, 10},
175
           {  8, 12,  8,  9},
176
           {  8, 13,  9, 10}, //15
177 ead91342 Leszek Koltunski
           { 13,  5,  9,  5},
178
           {  5,  4,  9,  4},
179 7a606778 Leszek Koltunski
           {  5, 15,  4,  5},
180
           { 15,  9,  4,  3},
181
           { 11, 19,  2,  3}, //20
182 ead91342 Leszek Koltunski
           { 19,  7,  2,  6},
183
           {  7,  6,  2,  7},
184
           {  7, 17,  7,  6},
185
           { 17, 10,  7, 10},
186 7a606778 Leszek Koltunski
           { 17,  1, 10,  6}, //25
187 ead91342 Leszek Koltunski
           {  1,  3,  5,  6},
188
           {  3, 19,  3,  6},
189
           {  1, 13, 10,  5},
190 7a606778 Leszek Koltunski
           {  3, 15,  5,  3},
191 ead91342 Leszek Koltunski
         };
192 af0de0af Leszek Koltunski
    }
193 ead91342 Leszek Koltunski
194 af0de0af Leszek Koltunski
///////////////////////////////////////////////////////////////////////////////////////////////////
195 ead91342 Leszek Koltunski
196 af0de0af Leszek Koltunski
  void initializeQuatIndices()
197 ead91342 Leszek Koltunski
    {
198 af0de0af Leszek Koltunski
    mQuatEdgeIndices = new int[]
199 ead91342 Leszek Koltunski
      {
200 af0de0af Leszek Koltunski
        56, 40, 43, 59,  0, 19,  9, 54, 58, 49,
201
        48, 24, 52,  4, 16, 32, 20, 11, 21, 35,
202
        37, 30,  8, 28, 36, 44,  1, 46, 12, 47
203
      };
204
    mQuatCornerIndices = new int[]
205
      {
206
         0,  2,  3,  1, 40, 31, 41, 30, 39, 35,
207
        36, 34, 56, 32, 43, 21, 48, 28, 42, 23
208
      };
209
    }
210 ead91342 Leszek Koltunski
211 af0de0af Leszek Koltunski
///////////////////////////////////////////////////////////////////////////////////////////////////
212 ead91342 Leszek Koltunski
213 af0de0af Leszek Koltunski
  void initializeCornerFaceMap()
214
    {
215
    mCornerFaceMap = new int[][]
216
         {
217
           {  0, 1, 8 },
218
           {  6, 5,10 },
219
           {  1, 0,11 },
220
           {  5, 6, 3 },
221
           {  0, 9, 4 },
222
           {  5, 4, 9 },
223
           {  7, 1, 2 },
224
           {  2, 6, 7 },
225
           { 10, 9, 8 },
226
           {  4, 3,11 },
227
           {  7,10, 8 },
228
           {  3, 2,11 },
229
           {  0, 8, 9 },
230
           {  9,10, 5 },
231
           {  0, 4,11 },
232
           {  4, 5, 3 },
233
           {  1, 7, 8 },
234
           {  7, 6,10 },
235
           {  2, 1,11 },
236
           {  6, 2, 3 },
237
         };
238
    }
239 ead91342 Leszek Koltunski
240 af0de0af Leszek Koltunski
///////////////////////////////////////////////////////////////////////////////////////////////////
241 ead91342 Leszek Koltunski
242 af0de0af Leszek Koltunski
  void initializeQuats()
243
    {
244
    mQuats = new Static4D[]
245
         {
246
         new Static4D(  0.0f,  0.0f,  0.0f,  1.0f ),  //0
247
         new Static4D(  1.0f,  0.0f,  0.0f,  0.0f ),
248
         new Static4D(  0.0f,  1.0f,  0.0f,  0.0f ),
249
         new Static4D(  0.0f,  0.0f,  1.0f,  0.0f ),
250
251
         new Static4D(  0.5f,  0.5f,  0.5f,  0.5f ),  //4
252
         new Static4D(  0.5f,  0.5f, -0.5f,  0.5f ),
253
         new Static4D(  0.5f, -0.5f,  0.5f,  0.5f ),
254
         new Static4D(  0.5f, -0.5f, -0.5f,  0.5f ),
255
         new Static4D( -0.5f,  0.5f,  0.5f,  0.5f ),
256
         new Static4D( -0.5f,  0.5f, -0.5f,  0.5f ),
257
         new Static4D( -0.5f, -0.5f,  0.5f,  0.5f ),
258
         new Static4D( -0.5f, -0.5f, -0.5f,  0.5f ),
259
260
         new Static4D(  0.5f, SIN54, SIN18,  0.0f ), // 12
261
         new Static4D(  0.5f, SIN54,-SIN18,  0.0f ),
262
         new Static4D(  0.5f,-SIN54, SIN18,  0.0f ),
263
         new Static4D(  0.5f,-SIN54,-SIN18,  0.0f ),
264
         new Static4D( SIN18,  0.5f, SIN54,  0.0f ),
265
         new Static4D( SIN18,  0.5f,-SIN54,  0.0f ),
266
         new Static4D(-SIN18,  0.5f, SIN54,  0.0f ),
267
         new Static4D(-SIN18,  0.5f,-SIN54,  0.0f ),
268
         new Static4D( SIN54, SIN18,  0.5f,  0.0f ),
269
         new Static4D( SIN54,-SIN18,  0.5f,  0.0f ),
270
         new Static4D(-SIN54, SIN18,  0.5f,  0.0f ),
271
         new Static4D(-SIN54,-SIN18,  0.5f,  0.0f ),
272
273
         new Static4D(  0.0f, SIN18, SIN54,  0.5f ), //24
274
         new Static4D(  0.0f, SIN18,-SIN54,  0.5f ),
275
         new Static4D(  0.0f,-SIN18, SIN54,  0.5f ),
276
         new Static4D(  0.0f,-SIN18,-SIN54,  0.5f ),
277
         new Static4D( SIN18, SIN54,  0.0f,  0.5f ),
278
         new Static4D( SIN18,-SIN54,  0.0f,  0.5f ),
279
         new Static4D(-SIN18, SIN54,  0.0f,  0.5f ),
280
         new Static4D(-SIN18,-SIN54,  0.0f,  0.5f ),
281
         new Static4D( SIN54,  0.0f, SIN18,  0.5f ),
282
         new Static4D( SIN54,  0.0f,-SIN18,  0.5f ),
283
         new Static4D(-SIN54,  0.0f, SIN18,  0.5f ),
284
         new Static4D(-SIN54,  0.0f,-SIN18,  0.5f ),
285
286
         new Static4D(  0.0f, SIN54,  0.5f, SIN18 ), //36
287
         new Static4D(  0.0f, SIN54, -0.5f, SIN18 ),
288
         new Static4D(  0.0f,-SIN54,  0.5f, SIN18 ),
289
         new Static4D(  0.0f,-SIN54, -0.5f, SIN18 ),
290
         new Static4D(  0.5f,  0.0f, SIN54, SIN18 ),
291
         new Static4D(  0.5f,  0.0f,-SIN54, SIN18 ),
292
         new Static4D( -0.5f,  0.0f, SIN54, SIN18 ),
293
         new Static4D( -0.5f,  0.0f,-SIN54, SIN18 ),
294
         new Static4D( SIN54,  0.5f,  0.0f, SIN18 ),
295
         new Static4D( SIN54, -0.5f,  0.0f, SIN18 ),
296
         new Static4D(-SIN54,  0.5f,  0.0f, SIN18 ),
297
         new Static4D(-SIN54, -0.5f,  0.0f, SIN18 ),
298
299
         new Static4D(  0.0f,  0.5f, SIN18, SIN54 ), //48
300
         new Static4D(  0.0f,  0.5f,-SIN18, SIN54 ),
301
         new Static4D(  0.0f, -0.5f, SIN18, SIN54 ),
302
         new Static4D(  0.0f, -0.5f,-SIN18, SIN54 ),
303
         new Static4D(  0.5f, SIN18,  0.0f, SIN54 ),
304
         new Static4D(  0.5f,-SIN18,  0.0f, SIN54 ),
305
         new Static4D( -0.5f, SIN18,  0.0f, SIN54 ),
306
         new Static4D( -0.5f,-SIN18,  0.0f, SIN54 ),
307
         new Static4D( SIN18,  0.0f,  0.5f, SIN54 ),
308
         new Static4D( SIN18,  0.0f, -0.5f, SIN54 ),
309
         new Static4D(-SIN18,  0.0f,  0.5f, SIN54 ),
310
         new Static4D(-SIN18,  0.0f, -0.5f, SIN54 ),
311
         };
312 ead91342 Leszek Koltunski
    }
313
314 af0de0af Leszek Koltunski
///////////////////////////////////////////////////////////////////////////////////////////////////
315
// Coordinates of all 20 corners of a Minx
316 ead91342 Leszek Koltunski
317 af0de0af Leszek Koltunski
  void initializeCorners()
318 ead91342 Leszek Koltunski
    {
319 387b6326 Leszek Koltunski
    float cA = 1.5f;
320
    float cB = 3*C2;
321
    float cC = 3*SIN54;
322
323 af0de0af Leszek Koltunski
    mCorners = new float[][]
324
         {
325 387b6326 Leszek Koltunski
             {  0, cA, cB},
326
             {  0, cA,-cB},
327
             {  0,-cA, cB},
328
             {  0,-cA,-cB},
329
             { cB,  0, cA},
330
             { cB,  0,-cA},
331
             {-cB,  0, cA},
332
             {-cB,  0,-cA},
333
             { cA, cB,  0},
334
             { cA,-cB,  0},
335
             {-cA, cB,  0},
336
             {-cA,-cB,  0},
337
             { cC, cC, cC},
338
             { cC, cC,-cC},
339
             { cC,-cC, cC},
340
             { cC,-cC,-cC},
341
             {-cC, cC, cC},
342
             {-cC, cC,-cC},
343
             {-cC,-cC, cC},
344
             {-cC,-cC,-cC},
345 af0de0af Leszek Koltunski
         };
346 ead91342 Leszek Koltunski
    }
347
348 a64e07d0 Leszek Koltunski
///////////////////////////////////////////////////////////////////////////////////////////////////
349
350 af0de0af Leszek Koltunski
  void initializeCenterCoords()
351 a64e07d0 Leszek Koltunski
    {
352 af0de0af Leszek Koltunski
    if( mCorners==null ) initializeCorners();
353
    if( mCenterMap==null ) initializeCenterMap();
354 aa26ba7f Leszek Koltunski
355 af0de0af Leszek Koltunski
    mCenterCoords = new float[NUM_CENTERS][3];
356
357
    for(int center=0; center<NUM_CENTERS; center++)
358
      {
359
      int[] map = mCenterMap[center];
360
361
      float x = mCorners[map[0]][0] +
362
                mCorners[map[1]][0] +
363
                mCorners[map[2]][0] +
364
                mCorners[map[3]][0] +
365
                mCorners[map[4]][0] ;
366
367
      float y = mCorners[map[0]][1] +
368
                mCorners[map[1]][1] +
369
                mCorners[map[2]][1] +
370
                mCorners[map[3]][1] +
371
                mCorners[map[4]][1] ;
372
373
      float z = mCorners[map[0]][2] +
374
                mCorners[map[1]][2] +
375
                mCorners[map[2]][2] +
376
                mCorners[map[3]][2] +
377
                mCorners[map[4]][2] ;
378
379
      mCenterCoords[center][0] = x/5;
380
      mCenterCoords[center][1] = y/5;
381
      mCenterCoords[center][2] = z/5;
382
      }
383 a64e07d0 Leszek Koltunski
    }
384
385 a480ee80 Leszek Koltunski
///////////////////////////////////////////////////////////////////////////////////////////////////
386
387 aa26ba7f Leszek Koltunski
  private int[] generateL(int numLayers, int index)
388 a480ee80 Leszek Koltunski
    {
389 aa26ba7f Leszek Koltunski
    int rows = (numLayers-1)/2;
390
    int[] ret = new int[3*4*rows];
391
392
    for(int i=0; i<rows; i++)
393
      {
394
      ret[12*i   ] = i;
395
      ret[12*i+ 1] =-2;
396
      ret[12*i+ 2] = index;
397
      ret[12*i+ 3] = i;
398
      ret[12*i+ 4] =-1;
399
      ret[12*i+ 5] = index;
400
      ret[12*i+ 6] = i;
401
      ret[12*i+ 7] =+1;
402
      ret[12*i+ 8] = index;
403
      ret[12*i+ 9] = i;
404
      ret[12*i+10] =+2;
405
      ret[12*i+11] = index;
406
      }
407
408
    return ret;
409 a480ee80 Leszek Koltunski
    }
410
411 a64e07d0 Leszek Koltunski
///////////////////////////////////////////////////////////////////////////////////////////////////
412
413 aa26ba7f Leszek Koltunski
  private int[] generateR(int numLayers, int index)
414 a64e07d0 Leszek Koltunski
    {
415 aa26ba7f Leszek Koltunski
    int rows = (numLayers-1)/2;
416
    int[] ret = new int[3*4*rows];
417
418
    for(int i=0; i<rows; i++)
419
      {
420
      int lay = rows+i+1;
421
422
      ret[12*i   ] = lay;
423
      ret[12*i+ 1] =-2;
424
      ret[12*i+ 2] = index;
425
      ret[12*i+ 3] = lay;
426
      ret[12*i+ 4] =-1;
427
      ret[12*i+ 5] = index;
428
      ret[12*i+ 6] = lay;
429
      ret[12*i+ 7] =+1;
430
      ret[12*i+ 8] = index;
431
      ret[12*i+ 9] = lay;
432
      ret[12*i+10] =+2;
433
      ret[12*i+11] = index;
434
      }
435
436
    return ret;
437 a64e07d0 Leszek Koltunski
    }
438
439
///////////////////////////////////////////////////////////////////////////////////////////////////
440
441 aa26ba7f Leszek Koltunski
  private int[] generateB(int numLayers, int index)
442 a64e07d0 Leszek Koltunski
    {
443 aa26ba7f Leszek Koltunski
    int rows = (numLayers-1);
444
    int half = rows/2;
445
    int[] ret = new int[3*4*rows];
446
447
    for(int i=0; i<rows; i++)
448
      {
449
      int ind = i<half? index : index+1;
450
      int lay = i<half? i : i+1;
451
452
      ret[12*i   ] = lay;
453
      ret[12*i+ 1] =-2;
454
      ret[12*i+ 2] = ind;
455
      ret[12*i+ 3] = lay;
456
      ret[12*i+ 4] =-1;
457
      ret[12*i+ 5] = ind;
458
      ret[12*i+ 6] = lay;
459
      ret[12*i+ 7] =+1;
460
      ret[12*i+ 8] = ind;
461
      ret[12*i+ 9] = lay;
462
      ret[12*i+10] =+2;
463
      ret[12*i+11] = ind;
464
      }
465
466
    return ret;
467 a64e07d0 Leszek Koltunski
    }
468
469 169219a7 Leszek Koltunski
///////////////////////////////////////////////////////////////////////////////////////////////////
470
471 aa26ba7f Leszek Koltunski
  private void initializeScrambleStates(int numLayers)
472 169219a7 Leszek Koltunski
    {
473 aa26ba7f Leszek Koltunski
    int[] LEFT0 = generateL(numLayers,1);
474
    int[] RIGH0 = generateR(numLayers,2);
475
    int[] LEFT1 = generateL(numLayers,3);
476
    int[] RIGH1 = generateR(numLayers,4);
477
    int[] LEFT2 = generateL(numLayers,5);
478
    int[] RIGH2 = generateR(numLayers,6);
479
    int[] LEFT3 = generateL(numLayers,7);
480
    int[] RIGH3 = generateR(numLayers,8);
481
    int[] LEFT4 = generateL(numLayers,9);
482
    int[] RIGH4 = generateR(numLayers,10);
483
    int[] LEFT5 = generateL(numLayers,11);
484
    int[] RIGH5 = generateR(numLayers,12);
485
486
    int[] BOTH1 = generateB(numLayers,1);
487
    int[] BOTH3 = generateB(numLayers,3);
488
    int[] BOTH5 = generateB(numLayers,5);
489
    int[] BOTH7 = generateB(numLayers,7);
490
    int[] BOTH9 = generateB(numLayers,9);
491
    int[] BOTH11= generateB(numLayers,11);
492
493
    mStates = new ScrambleState[]
494
      {
495
      new ScrambleState( new int[][] { BOTH1,BOTH3,BOTH5,BOTH7,BOTH9,BOTH11 } ), // beg
496
      new ScrambleState( new int[][] { {}   ,RIGH1,LEFT2,RIGH3,LEFT4,LEFT5  } ), // 0L
497
      new ScrambleState( new int[][] { {}   ,LEFT1,RIGH2,LEFT3,RIGH4,RIGH5  } ), // 0R
498
      new ScrambleState( new int[][] { RIGH0,{}   ,LEFT2,RIGH3,RIGH4,RIGH5  } ), // 1L
499
      new ScrambleState( new int[][] { LEFT0,{}   ,RIGH2,LEFT3,LEFT4,LEFT5  } ), // 1R
500
      new ScrambleState( new int[][] { LEFT0,LEFT1,{}   ,RIGH3,LEFT4,RIGH5  } ), // 2L
501
      new ScrambleState( new int[][] { RIGH0,RIGH1,{}   ,LEFT3,RIGH4,LEFT5  } ), // 2R
502
      new ScrambleState( new int[][] { RIGH0,RIGH1,RIGH2,{}   ,LEFT4,RIGH5  } ), // 3L
503
      new ScrambleState( new int[][] { LEFT0,LEFT1,LEFT2,{}   ,RIGH4,LEFT5  } ), // 3R
504
      new ScrambleState( new int[][] { LEFT0,RIGH1,LEFT2,LEFT3,{}   ,RIGH5  } ), // 4L
505
      new ScrambleState( new int[][] { RIGH0,LEFT1,RIGH2,RIGH3,{}   ,LEFT5  } ), // 4R
506
      new ScrambleState( new int[][] { LEFT0,RIGH1,RIGH2,RIGH3,RIGH4,{}     } ), // 5L
507
      new ScrambleState( new int[][] { RIGH0,LEFT1,LEFT2,LEFT3,LEFT4,{}     } ), // 5R
508
      };
509 169219a7 Leszek Koltunski
    }
510
511 a64e07d0 Leszek Koltunski
///////////////////////////////////////////////////////////////////////////////////////////////////
512
513 aa26ba7f Leszek Koltunski
  int[] getSolvedQuats(int cubit, int numLayers)
514 a64e07d0 Leszek Koltunski
    {
515 af0de0af Leszek Koltunski
    if( mQuats==null ) initializeQuats();
516
    if( mFaceMap==null ) mFaceMap = new int[] {8,10,3,7,1,11,9,2,4,0,5,6};
517 aa26ba7f Leszek Koltunski
    int status = retCubitSolvedStatus(cubit,numLayers);
518 af0de0af Leszek Koltunski
    return status<0 ? null : buildSolvedQuats(MovementMinx.FACE_AXIS[mFaceMap[status]],mQuats);
519 a64e07d0 Leszek Koltunski
    }
520
521
///////////////////////////////////////////////////////////////////////////////////////////////////
522
523 aa26ba7f Leszek Koltunski
  Static4D[] getQuats()
524 a64e07d0 Leszek Koltunski
    {
525 af0de0af Leszek Koltunski
    if( mQuats==null ) initializeQuats();
526
    return mQuats;
527 a64e07d0 Leszek Koltunski
    }
528
529
///////////////////////////////////////////////////////////////////////////////////////////////////
530
531 abf36986 Leszek Koltunski
  int getNumFaceColors()
532 a64e07d0 Leszek Koltunski
    {
533 aa26ba7f Leszek Koltunski
    return FACE_COLORS.length;
534 a64e07d0 Leszek Koltunski
    }
535
536
///////////////////////////////////////////////////////////////////////////////////////////////////
537
538 aa26ba7f Leszek Koltunski
  int getSolvedFunctionIndex()
539 a64e07d0 Leszek Koltunski
    {
540 aa26ba7f Leszek Koltunski
    return 0;
541 a64e07d0 Leszek Koltunski
    }
542
543
///////////////////////////////////////////////////////////////////////////////////////////////////
544
545 aa26ba7f Leszek Koltunski
  boolean shouldResetTextureMaps()
546 a64e07d0 Leszek Koltunski
    {
547 aa26ba7f Leszek Koltunski
    return false;
548 0812242b Leszek Koltunski
    }
549
550
///////////////////////////////////////////////////////////////////////////////////////////////////
551
552 aa26ba7f Leszek Koltunski
  int getNumCubitFaces()
553 0812242b Leszek Koltunski
    {
554 aa26ba7f Leszek Koltunski
    return FACES_PER_CUBIT;
555 a64e07d0 Leszek Koltunski
    }
556
557 4c737817 Leszek Koltunski
///////////////////////////////////////////////////////////////////////////////////////////////////
558
559 aa26ba7f Leszek Koltunski
  float returnMultiplier()
560 4c737817 Leszek Koltunski
    {
561 aa26ba7f Leszek Koltunski
    return 2.0f;
562 4c737817 Leszek Koltunski
    }
563
564 0812242b Leszek Koltunski
///////////////////////////////////////////////////////////////////////////////////////////////////
565
// PUBLIC API
566
567
  public Static3D[] getRotationAxis()
568
    {
569
    return ROT_AXIS;
570
    }
571
572
///////////////////////////////////////////////////////////////////////////////////////////////////
573
574
  public int[] getBasicAngle()
575
    {
576 af0de0af Leszek Koltunski
    if( mBasicAngle ==null ) mBasicAngle = new int[] { 5,5,5,5,5,5 };
577
    return mBasicAngle;
578 0812242b Leszek Koltunski
    }
579 a64e07d0 Leszek Koltunski
}