Project

General

Profile

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

magiccube / src / main / java / org / distorted / objects / TwistyDiamond.java @ a76d9cb4

1 ece1b58d 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 f10a88a8 Leszek Koltunski
import org.distorted.helpers.ObjectShape;
25 9c06394a Leszek Koltunski
import org.distorted.helpers.ObjectSticker;
26 6cf89a3e Leszek Koltunski
import org.distorted.helpers.ScrambleState;
27 ece1b58d Leszek Koltunski
import org.distorted.library.main.DistortedEffects;
28
import org.distorted.library.main.DistortedTexture;
29
import org.distorted.library.mesh.MeshSquare;
30
import org.distorted.library.type.Static3D;
31
import org.distorted.library.type.Static4D;
32 6fd4a72c Leszek Koltunski
import org.distorted.main.R;
33 ece1b58d Leszek Koltunski
34
///////////////////////////////////////////////////////////////////////////////////////////////////
35
36 efa81f0c Leszek Koltunski
public class TwistyDiamond extends Twisty8
37 ece1b58d Leszek Koltunski
{
38
  // the four rotation axis of a Diamond. Must be normalized.
39
  static final Static3D[] ROT_AXIS = new Static3D[]
40
         {
41
           new Static3D(+SQ6/3,+SQ3/3,     0),
42
           new Static3D(-SQ6/3,+SQ3/3,     0),
43 cc99cf91 Leszek Koltunski
           new Static3D(     0,-SQ3/3,-SQ6/3),
44
           new Static3D(     0,-SQ3/3,+SQ6/3)
45 ece1b58d Leszek Koltunski
         };
46
47 91792184 Leszek Koltunski
  private ScrambleState[] mStates;
48 aec5cc91 Leszek Koltunski
  private int[] mBasicAngle;
49
  private int[] mFaceMap;
50 ef018c1b Leszek Koltunski
  private float[][] mCuts;
51
  private boolean[][] mLayerRotatable;
52 aec5cc91 Leszek Koltunski
  private Static4D[] mQuats;
53
  private int[] mTetraToFaceMap;
54
  private ObjectSticker[] mStickers;
55 e9a87113 Leszek Koltunski
  private Movement mMovement;
56 486b3417 Leszek Koltunski
57 ece1b58d Leszek Koltunski
///////////////////////////////////////////////////////////////////////////////////////////////////
58
59 9c2f0c91 Leszek Koltunski
  TwistyDiamond(int size, Static4D quat, DistortedTexture texture,
60
                MeshSquare mesh, DistortedEffects effects, int[][] moves, Resources res, int scrWidth)
61 ece1b58d Leszek Koltunski
    {
62 db875721 Leszek Koltunski
    super(size, size, quat, texture, mesh, effects, moves, ObjectList.DIAM, res, scrWidth);
63 91792184 Leszek Koltunski
    }
64 486b3417 Leszek Koltunski
65 91792184 Leszek Koltunski
///////////////////////////////////////////////////////////////////////////////////////////////////
66 486b3417 Leszek Koltunski
67 91792184 Leszek Koltunski
  ScrambleState[] getScrambleStates()
68
    {
69
    if( mStates==null )
70 486b3417 Leszek Koltunski
      {
71 91792184 Leszek Koltunski
      int size = getNumLayers();
72
      int[] tmp = new int[3*2*size];
73
74
      for(int i=0; i<2*size; i++)
75
        {
76
        tmp[3*i  ] = (i<size) ?  i:i-size;
77
        tmp[3*i+1] = (i%2==0) ? -1:1;
78
        tmp[3*i+2] = 0;
79
        }
80
81
      mStates = new ScrambleState[]
82
        {
83
        new ScrambleState( new int[][] {tmp,tmp,tmp,tmp} )
84
        };
85 486b3417 Leszek Koltunski
      }
86
87 91792184 Leszek Koltunski
    return mStates;
88 ece1b58d Leszek Koltunski
    }
89
90 aec5cc91 Leszek Koltunski
///////////////////////////////////////////////////////////////////////////////////////////////////
91
92
  private void initializeQuats()
93
    {
94
    mQuats = new Static4D[]
95
         {
96
          new Static4D(  0.0f,  0.0f,   0.0f,  1.0f ),
97
          new Static4D(  0.0f,  1.0f,   0.0f,  0.0f ),
98
          new Static4D(+SQ2/2,  0.0f, -SQ2/2,  0.0f ),
99
          new Static4D(-SQ2/2,  0.0f, -SQ2/2,  0.0f ),
100
101
          new Static4D(+SQ2/2,  0.5f,   0.0f,  0.5f ),
102
          new Static4D(-SQ2/2,  0.5f,   0.0f,  0.5f ),
103
          new Static4D(  0.0f,  0.5f, +SQ2/2,  0.5f ),
104
          new Static4D(  0.0f,  0.5f, -SQ2/2,  0.5f ),
105
          new Static4D(+SQ2/2,  0.5f,   0.0f, -0.5f ),
106
          new Static4D(-SQ2/2,  0.5f,   0.0f, -0.5f ),
107
          new Static4D(  0.0f,  0.5f, +SQ2/2, -0.5f ),
108
          new Static4D(  0.0f,  0.5f, -SQ2/2, -0.5f )
109
         };
110
    }
111
112 a480ee80 Leszek Koltunski
///////////////////////////////////////////////////////////////////////////////////////////////////
113
114
  int[] getSolvedQuats(int cubit, int numLayers)
115
    {
116 aec5cc91 Leszek Koltunski
    if( mQuats==null ) initializeQuats();
117
    if( mFaceMap==null ) mFaceMap = new int[] {4,0,6,2,7,3,5,1};
118 a480ee80 Leszek Koltunski
    int status = retCubitSolvedStatus(cubit,numLayers);
119 aec5cc91 Leszek Koltunski
    return status<0 ? null : buildSolvedQuats(MovementDiamond.FACE_AXIS[mFaceMap[status]],mQuats);
120 a480ee80 Leszek Koltunski
    }
121
122 ece1b58d Leszek Koltunski
///////////////////////////////////////////////////////////////////////////////////////////////////
123
124
  Static4D[] getQuats()
125
    {
126 aec5cc91 Leszek Koltunski
    if( mQuats==null ) initializeQuats();
127
    return mQuats;
128 ece1b58d Leszek Koltunski
    }
129
130 169219a7 Leszek Koltunski
///////////////////////////////////////////////////////////////////////////////////////////////////
131
132
  int getSolvedFunctionIndex()
133
    {
134
    return 0;
135
    }
136
137 ece1b58d Leszek Koltunski
///////////////////////////////////////////////////////////////////////////////////////////////////
138
139 a64e07d0 Leszek Koltunski
  int getNumStickerTypes(int numLayers)
140 ece1b58d Leszek Koltunski
    {
141 aec5cc91 Leszek Koltunski
    return 1;
142 ece1b58d Leszek Koltunski
    }
143
144
///////////////////////////////////////////////////////////////////////////////////////////////////
145
146 e6734aa9 Leszek Koltunski
  float[][] getCuts(int numLayers)
147 ece1b58d Leszek Koltunski
    {
148 ef018c1b Leszek Koltunski
    if( numLayers<2 ) return null;
149
150
    if( mCuts==null )
151 680f921e Leszek Koltunski
      {
152 ef018c1b Leszek Koltunski
      mCuts = new float[4][numLayers-1];
153
      float cut = (SQ6/6)*(2-numLayers);
154 680f921e Leszek Koltunski
155
      for(int i=0; i<numLayers-1; i++)
156
        {
157 ef018c1b Leszek Koltunski
        mCuts[0][i] = cut;
158
        mCuts[1][i] = cut;
159
        mCuts[2][i] = cut;
160
        mCuts[3][i] = cut;
161
        cut += SQ6/3;
162 680f921e Leszek Koltunski
        }
163 ef018c1b Leszek Koltunski
      }
164
165
    return mCuts;
166
    }
167 680f921e Leszek Koltunski
168 ef018c1b Leszek Koltunski
///////////////////////////////////////////////////////////////////////////////////////////////////
169
170
  private void getLayerRotatable(int numLayers)
171
    {
172
    if( mLayerRotatable==null )
173
      {
174
      int numAxis = ROT_AXIS.length;
175
      boolean[] tmp = new boolean[numLayers];
176
      for(int i=0; i<numLayers; i++) tmp[i] = true;
177
      mLayerRotatable = new boolean[numAxis][];
178
      for(int i=0; i<numAxis; i++) mLayerRotatable[i] = tmp;
179 680f921e Leszek Koltunski
      }
180 ece1b58d Leszek Koltunski
    }
181
182
///////////////////////////////////////////////////////////////////////////////////////////////////
183
184
  int getNumCubitFaces()
185
    {
186 efa81f0c Leszek Koltunski
    return 8;
187 ece1b58d Leszek Koltunski
    }
188
189
///////////////////////////////////////////////////////////////////////////////////////////////////
190
191 680f921e Leszek Koltunski
  private int getNumOctahedrons(int layers)
192
    {
193
    return layers==1 ? 1 : 4*(layers-1)*(layers-1) + 2;
194
    }
195
196
///////////////////////////////////////////////////////////////////////////////////////////////////
197
198
  private int getNumTetrahedrons(int layers)
199
    {
200
    return 4*layers*(layers-1);
201
    }
202
203
///////////////////////////////////////////////////////////////////////////////////////////////////
204
205 31cd7256 Leszek Koltunski
  private int createOctaPositions(float[][] centers, int index, int layers, float height)
206 680f921e Leszek Koltunski
    {
207 5da517d3 Leszek Koltunski
    float x = (layers-1)*0.5f;
208
    float z = (layers+1)*0.5f;
209 680f921e Leszek Koltunski
210
    for(int i=0; i<layers; i++, index++)
211
      {
212 5da517d3 Leszek Koltunski
      z -= 1;
213 680f921e Leszek Koltunski
      centers[index][0] = x;
214
      centers[index][1] = height;
215
      centers[index][2] = z;
216
      }
217
218
    for(int i=0; i<layers-1; i++, index++)
219
      {
220 5da517d3 Leszek Koltunski
      x -= 1;
221 680f921e Leszek Koltunski
      centers[index][0] = x;
222
      centers[index][1] = height;
223
      centers[index][2] = z;
224
      }
225
226
    for(int i=0; i<layers-1; i++, index++)
227
      {
228 5da517d3 Leszek Koltunski
      z += 1;
229 680f921e Leszek Koltunski
      centers[index][0] = x;
230
      centers[index][1] = height;
231
      centers[index][2] = z;
232
      }
233
234
    for(int i=0; i<layers-2; i++, index++)
235
      {
236 5da517d3 Leszek Koltunski
      x += 1;
237 680f921e Leszek Koltunski
      centers[index][0] = x;
238
      centers[index][1] = height;
239
      centers[index][2] = z;
240
      }
241
242
    return index;
243
    }
244
245
///////////////////////////////////////////////////////////////////////////////////////////////////
246
247 31cd7256 Leszek Koltunski
  private int createTetraPositions(float[][] centers, int index, int layers, float height)
248 ece1b58d Leszek Koltunski
    {
249 5da517d3 Leszek Koltunski
    float x = (layers-1)*0.5f;
250
    float z =  layers*0.5f;
251 680f921e Leszek Koltunski
252
    for(int i=0; i<layers-1; i++, index++)
253
      {
254 5da517d3 Leszek Koltunski
      z -= 1;
255 680f921e Leszek Koltunski
      centers[index][0] = x;
256
      centers[index][1] = height;
257
      centers[index][2] = z;
258
      }
259
260 5da517d3 Leszek Koltunski
    x += 0.5f;
261
    z -= 0.5f;
262 680f921e Leszek Koltunski
263
    for(int i=0; i<layers-1; i++, index++)
264
      {
265 5da517d3 Leszek Koltunski
      x -= 1;
266 680f921e Leszek Koltunski
      centers[index][0] = x;
267
      centers[index][1] = height;
268
      centers[index][2] = z;
269
      }
270
271 5da517d3 Leszek Koltunski
    x -= 0.5f;
272
    z -= 0.5f;
273 680f921e Leszek Koltunski
274
    for(int i=0; i<layers-1; i++, index++)
275
      {
276 5da517d3 Leszek Koltunski
      z += 1;
277 680f921e Leszek Koltunski
      centers[index][0] = x;
278
      centers[index][1] = height;
279
      centers[index][2] = z;
280
      }
281
282 5da517d3 Leszek Koltunski
    x -= 0.5f;
283
    z += 0.5f;
284 680f921e Leszek Koltunski
285
    for(int i=0; i<layers-1; i++, index++)
286
      {
287 5da517d3 Leszek Koltunski
      x += 1;
288 680f921e Leszek Koltunski
      centers[index][0] = x;
289
      centers[index][1] = height;
290
      centers[index][2] = z;
291
      }
292
293
    return index;
294
    }
295
296
///////////////////////////////////////////////////////////////////////////////////////////////////
297
298
  float[][] getCubitPositions(int layers)
299
    {
300
    int numO = getNumOctahedrons(layers);
301
    int numT = getNumTetrahedrons(layers);
302
    int index = 0;
303
    float height = 0.0f;
304
305
    float[][] CENTERS = new float[numO+numT][3];
306
307 31cd7256 Leszek Koltunski
    index = createOctaPositions(CENTERS,index,layers,height);
308 680f921e Leszek Koltunski
309
    for(int i=layers-1; i>0; i--)
310
      {
311 5da517d3 Leszek Koltunski
      height += SQ2/2;
312 31cd7256 Leszek Koltunski
      index = createOctaPositions(CENTERS,index,i,+height);
313
      index = createOctaPositions(CENTERS,index,i,-height);
314 680f921e Leszek Koltunski
      }
315
316 5da517d3 Leszek Koltunski
    height = SQ2/4;
317 680f921e Leszek Koltunski
318
    for(int i=layers; i>1; i--)
319
      {
320 31cd7256 Leszek Koltunski
      index = createTetraPositions(CENTERS,index,i,+height);
321
      index = createTetraPositions(CENTERS,index,i,-height);
322 5da517d3 Leszek Koltunski
      height += SQ2/2;
323 680f921e Leszek Koltunski
      }
324
325 ece1b58d Leszek Koltunski
    return CENTERS;
326
    }
327
328
///////////////////////////////////////////////////////////////////////////////////////////////////
329
330 680f921e Leszek Koltunski
  private int retFaceTetraBelongsTo(int tetra, int numLayers)
331 ece1b58d Leszek Koltunski
    {
332 aec5cc91 Leszek Koltunski
    if( mTetraToFaceMap==null ) mTetraToFaceMap = new int[] {1,2,3,0,5,6,7,4};
333
334 68b5f9c5 Leszek Koltunski
    for(int i=numLayers-1; i>0; i--)
335 ece1b58d Leszek Koltunski
      {
336 68b5f9c5 Leszek Koltunski
      if( tetra < 8*i ) return mTetraToFaceMap[tetra/i];
337
      tetra -= 8*i;
338 680f921e Leszek Koltunski
      }
339 68b5f9c5 Leszek Koltunski
340
    return -1;
341 680f921e Leszek Koltunski
    }
342
343 f10a88a8 Leszek Koltunski
///////////////////////////////////////////////////////////////////////////////////////////////////
344
345
  ObjectShape getObjectShape(int cubit, int numLayers)
346
    {
347
    int variant = getCubitVariant(cubit,numLayers);
348 f56b53cb Leszek Koltunski
    int N = numLayers>3 ? 5:6;
349 7d11f930 Leszek Koltunski
    int E = numLayers>2 ? (numLayers>3 ? 0:1):2;
350 ece1b58d Leszek Koltunski
351 f10a88a8 Leszek Koltunski
    if( variant==0 )
352 ece1b58d Leszek Koltunski
      {
353 aec5cc91 Leszek Koltunski
      double[][] vertices = new double[][]
354
          {
355
             { 0.5,   0.0, 0.5},
356
             { 0.5,   0.0,-0.5},
357
             {-0.5,   0.0,-0.5},
358
             {-0.5,   0.0, 0.5},
359
             { 0.0, SQ2/2, 0.0},
360
             { 0.0,-SQ2/2, 0.0}
361
          };
362
363
      int[][] vert_indices = new int[][]
364
          {
365
             {3,0,4},
366
             {0,1,4},
367
             {1,2,4},
368
             {2,3,4},
369
             {5,0,3},
370
             {5,1,0},
371
             {5,2,1},
372
             {5,3,2}
373
          };
374
375 f10a88a8 Leszek Koltunski
      float[][] bands     = new float[][] { {0.05f,35,0.5f,0.8f,N,E,E} };
376
      int[] bandIndices   = new int[] { 0,0,0,0,0,0,0,0 };
377
      float[][] corners   = new float[][] { {0.04f,0.20f} };
378
      int[] cornerIndices = new int[] { 0,0,0,0,0,0 };
379
      float[][] centers   = new float[][] { {0.0f, 0.0f, 0.0f} };
380
      int[] centerIndices = new int[] { 0,0,0,0,0,0 };
381 aec5cc91 Leszek Koltunski
      return new ObjectShape(vertices,vert_indices,bands,bandIndices,corners,cornerIndices,centers,centerIndices,getNumCubitFaces(), null);
382 ece1b58d Leszek Koltunski
      }
383
    else
384
      {
385 aec5cc91 Leszek Koltunski
      double[][] vertices = new double[][] { {-0.5, SQ2/4, 0.0}, { 0.5, SQ2/4, 0.0}, { 0.0,-SQ2/4, 0.5}, { 0.0,-SQ2/4,-0.5} };
386
      int[][] vert_indices = new int[][]  { {2,1,0}, {2,3,1}, {3,2,0}, {3,0,1} };
387 f10a88a8 Leszek Koltunski
      float[][] bands     = new float[][] { {0.05f,35,0.5f,0.8f,N,E,E} };
388
      int[] bandIndices   = new int[] { 0,0,0,0 };
389
      float[][] corners   = new float[][] { {0.08f,0.15f} };
390
      int[] cornerIndices = new int[] { 0,0,0,0 };
391
      float[][] centers   = new float[][] { {0.0f, 0.0f, 0.0f} };
392
      int[] centerIndices = new int[] { 0,0,0,0 };
393 aec5cc91 Leszek Koltunski
      return new ObjectShape(vertices,vert_indices,bands,bandIndices,corners,cornerIndices,centers,centerIndices,getNumCubitFaces(), null);
394 f10a88a8 Leszek Koltunski
      }
395
    }
396
397
///////////////////////////////////////////////////////////////////////////////////////////////////
398
399 3e605536 Leszek Koltunski
  Static4D getQuat(int cubit, int numLayers)
400 f10a88a8 Leszek Koltunski
    {
401 aec5cc91 Leszek Koltunski
    if( mQuats==null ) initializeQuats();
402 3e605536 Leszek Koltunski
    int numO = getNumOctahedrons(numLayers);
403 f10a88a8 Leszek Koltunski
404 aec5cc91 Leszek Koltunski
    if( cubit<numO ) return mQuats[0];
405 f10a88a8 Leszek Koltunski
406 3e605536 Leszek Koltunski
    switch( retFaceTetraBelongsTo(cubit-numO, numLayers) )
407 f10a88a8 Leszek Koltunski
      {
408 aec5cc91 Leszek Koltunski
      case 0: return mQuats[0];                         // unit quat
409 3e605536 Leszek Koltunski
      case 1: return new Static4D(0,-SQ2/2,0,SQ2/2);    //  90 along Y
410 aec5cc91 Leszek Koltunski
      case 2: return mQuats[1];                         // 180 along Y
411 3e605536 Leszek Koltunski
      case 3: return new Static4D(0,+SQ2/2,0,SQ2/2);    //  90 along
412
      case 4: return new Static4D(0,     0,1,    0);    // 180 along Z
413
      case 5: return new Static4D(SQ2/2, 0,SQ2/2,0);    //
414
      case 6: return new Static4D(     1,0,0,    0);    // 180 along X
415
      case 7: return new Static4D(-SQ2/2,0,SQ2/2,0);    //
416 ece1b58d Leszek Koltunski
      }
417
418 3e605536 Leszek Koltunski
    return null;
419
    }
420
421
///////////////////////////////////////////////////////////////////////////////////////////////////
422 ece1b58d Leszek Koltunski
423 3e605536 Leszek Koltunski
  int getNumCubitVariants(int numLayers)
424
    {
425
    return 2;
426
    }
427
428
///////////////////////////////////////////////////////////////////////////////////////////////////
429
430
  int getCubitVariant(int cubit, int numLayers)
431
    {
432
    return cubit<getNumOctahedrons(numLayers) ? 0 : 1;
433 ece1b58d Leszek Koltunski
    }
434
435
///////////////////////////////////////////////////////////////////////////////////////////////////
436
437 2ef489e2 Leszek Koltunski
  int getFaceColor(int cubit, int cubitface, int size)
438 ece1b58d Leszek Koltunski
    {
439 2ef489e2 Leszek Koltunski
    int numO = getNumOctahedrons(size);
440 680f921e Leszek Koltunski
441
    if( cubit<numO )
442
      {
443 2ef489e2 Leszek Koltunski
      int axis = 0;
444
      int layer= 1;
445
446
      switch(cubitface)
447
        {
448
        case 0: axis = 2; layer =             1; break;
449
        case 1: axis = 0; layer = (1<<(size-1)); break;
450
        case 2: axis = 3; layer =             1; break;
451
        case 3: axis = 1; layer = (1<<(size-1)); break;
452
        case 4: axis = 3; layer = (1<<(size-1)); break;
453
        case 5: axis = 1; layer =             1; break;
454
        case 6: axis = 2; layer = (1<<(size-1)); break;
455
        case 7: axis = 0; layer =             1; break;
456
        }
457
458 a4962b9c Leszek Koltunski
      return CUBITS[cubit].mRotationRow[axis] == layer ? cubitface : NUM_TEXTURES;
459 680f921e Leszek Koltunski
      }
460
    else
461
      {
462 a4962b9c Leszek Koltunski
      return cubitface>0 ? NUM_TEXTURES : retFaceTetraBelongsTo(cubit-numO, size);
463 680f921e Leszek Koltunski
      }
464 ece1b58d Leszek Koltunski
    }
465
466 9c06394a Leszek Koltunski
///////////////////////////////////////////////////////////////////////////////////////////////////
467 76c2bd07 Leszek Koltunski
468 9c06394a Leszek Koltunski
  ObjectSticker retSticker(int face)
469
    {
470 aec5cc91 Leszek Koltunski
    if( mStickers==null )
471
      {
472
      float[][] STICKERS = new float[][] { { -0.4330127f, -0.25f, 0.4330127f, -0.25f, 0.0f, 0.5f } };
473
      float radius = 0.06f;
474
      float stroke = 0.07f;
475
      float[] radii = new float[] {radius,radius,radius};
476
      mStickers     = new ObjectSticker[STICKERS.length];
477
      mStickers[0]  = new ObjectSticker(STICKERS[0],null,radii,stroke);
478
      }
479
480 abf36986 Leszek Koltunski
    return mStickers[face/NUM_FACE_COLORS];
481 ece1b58d Leszek Koltunski
    }
482
483
///////////////////////////////////////////////////////////////////////////////////////////////////
484 e1dc3366 Leszek Koltunski
// PUBLIC API
485 ece1b58d Leszek Koltunski
486 e1dc3366 Leszek Koltunski
  public Static3D[] getRotationAxis()
487
    {
488
    return ROT_AXIS;
489
    }
490
491 e9a87113 Leszek Koltunski
///////////////////////////////////////////////////////////////////////////////////////////////////
492
493
  public Movement getMovement()
494
    {
495 ef018c1b Leszek Koltunski
    if( mMovement==null )
496
      {
497
      int numLayers = getNumLayers();
498
      if( mCuts==null ) getCuts(numLayers);
499
      getLayerRotatable(numLayers);
500
501
      mMovement = new MovementDiamond(mCuts,mLayerRotatable,numLayers);
502
      }
503 e9a87113 Leszek Koltunski
    return mMovement;
504
    }
505
506 e1dc3366 Leszek Koltunski
///////////////////////////////////////////////////////////////////////////////////////////////////
507
508
  public int[] getBasicAngle()
509
    {
510 aec5cc91 Leszek Koltunski
    if( mBasicAngle ==null ) mBasicAngle = new int[] { 3,3,3,3 };
511
    return mBasicAngle;
512 e1dc3366 Leszek Koltunski
    }
513
514 6fd4a72c Leszek Koltunski
///////////////////////////////////////////////////////////////////////////////////////////////////
515
516
  public int getObjectName(int numLayers)
517
    {
518 2ef489e2 Leszek Koltunski
    switch(numLayers)
519
      {
520
      case 2: return R.string.diam2;
521
      case 3: return R.string.diam3;
522 2adf1263 Leszek Koltunski
      case 4: return R.string.diam4;
523 2ef489e2 Leszek Koltunski
      }
524
525
    return 0;
526 6fd4a72c Leszek Koltunski
    }
527
528
///////////////////////////////////////////////////////////////////////////////////////////////////
529
530
  public int getInventor(int numLayers)
531
    {
532 2ef489e2 Leszek Koltunski
    switch(numLayers)
533
      {
534
      case 2: return R.string.diam2_inventor;
535
      case 3: return R.string.diam3_inventor;
536 2adf1263 Leszek Koltunski
      case 4: return R.string.diam4_inventor;
537 2ef489e2 Leszek Koltunski
      }
538
539
    return 0;
540 6fd4a72c Leszek Koltunski
    }
541
542
///////////////////////////////////////////////////////////////////////////////////////////////////
543
544
  public int getComplexity(int numLayers)
545
    {
546 2ef489e2 Leszek Koltunski
    switch(numLayers)
547
      {
548 2adf1263 Leszek Koltunski
      case 2: return 4;
549
      case 3: return 6;
550
      case 4: return 8;
551 2ef489e2 Leszek Koltunski
      }
552
553
    return 0;
554 6fd4a72c Leszek Koltunski
    }
555 ece1b58d Leszek Koltunski
}