Project

General

Profile

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

magiccube / src / main / java / org / distorted / objects / TwistyDiamond.java @ 7ee89540

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