Project

General

Profile

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

distorted-objectlib / src / main / java / org / distorted / objectlib / objects / TwistyKilominx.java @ ecc01591

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.TouchControlDodecahedron.COS54;
23
import static org.distorted.objectlib.touchcontrol.TouchControlDodecahedron.SIN54;
24 29b82486 Leszek Koltunski
25 82eb152a Leszek Koltunski
import java.io.InputStream;
26 29b82486 Leszek Koltunski
27 ecf3d6e3 Leszek Koltunski
import org.distorted.library.type.Static3D;
28 29b82486 Leszek Koltunski
import org.distorted.library.type.Static4D;
29 a706f8e0 Leszek Koltunski
import org.distorted.library.main.QuatHelper;
30 29b82486 Leszek Koltunski
31 3ee1d662 Leszek Koltunski
import org.distorted.objectlib.helpers.ObjectFaceShape;
32 8005e762 Leszek Koltunski
import org.distorted.objectlib.main.ObjectType;
33 198c5bf0 Leszek Koltunski
import org.distorted.objectlib.helpers.ObjectShape;
34 29b82486 Leszek Koltunski
35
///////////////////////////////////////////////////////////////////////////////////////////////////
36
37
public class TwistyKilominx extends TwistyMinx
38
{
39 3bf19410 Leszek Koltunski
  public TwistyKilominx(int[] numL, int meshState, int iconMode, Static4D quat, Static3D move, float scale, InputStream stream)
40 29b82486 Leszek Koltunski
    {
41 3bf19410 Leszek Koltunski
    super(numL, meshState, iconMode, quat, move, scale, stream);
42 29b82486 Leszek Koltunski
    }
43
44 ed0988c0 Leszek Koltunski
///////////////////////////////////////////////////////////////////////////////////////////////////
45
// make the 'center' sticker artificially smaller, so that we paint over the area in the center of the face.
46
47
  @Override
48
  public void adjustStickerCoords()
49
    {
50
    int[] numLayers = getNumLayers();
51 169762ac Leszek Koltunski
    int index = numLayers[0]==3 ? 0:3;
52 ed0988c0 Leszek Koltunski
    float CENTER_CORR = 0.87f;
53
54
    mStickerCoords[index][2] *= CENTER_CORR;
55
    mStickerCoords[index][3] *= CENTER_CORR;
56
    }
57
58 29b82486 Leszek Koltunski
///////////////////////////////////////////////////////////////////////////////////////////////////
59
60
  private int numCubitsPerCorner(int numLayers)
61
    {
62
    return 3*((numLayers-3)/2)*((numLayers-5)/2) + (numLayers<5 ? 0:1);
63
    }
64
65
///////////////////////////////////////////////////////////////////////////////////////////////////
66
67
  private int numCubitsPerEdge(int numLayers)
68
    {
69
    return numLayers<5 ? 0 : 2*(numLayers-4);
70
    }
71
72
///////////////////////////////////////////////////////////////////////////////////////////////////
73
74 7bbfc84f Leszek Koltunski
  public float[][] getCuts(int[] numLayers)
75 29b82486 Leszek Koltunski
    {
76 a57e6870 Leszek Koltunski
    return genericGetCuts(numLayers[0],0.5f);
77 29b82486 Leszek Koltunski
    }
78
79
///////////////////////////////////////////////////////////////////////////////////////////////////
80
// Fill out mCurrCorner{X,Y,Z} by applying appropriate Quat to mBasicCorner{X,Y,Z}
81
// Appropriate one: QUATS[QUAT_INDICES[corner]].
82
83
  private void computeBasicCornerVectors(int corner)
84
    {
85
    if( mQuatCornerIndices==null ) initializeQuatIndices();
86
    if( mCurrCornerV==null || mBasicCornerV==null ) initializeCornerV();
87
88 89a00832 Leszek Koltunski
    Static4D quat = mObjectQuats[mQuatCornerIndices[corner]];
89 29b82486 Leszek Koltunski
90
    mCurrCornerV[0] = QuatHelper.rotateVectorByQuat(mBasicCornerV[0],quat);
91
    mCurrCornerV[1] = QuatHelper.rotateVectorByQuat(mBasicCornerV[1],quat);
92
    mCurrCornerV[2] = QuatHelper.rotateVectorByQuat(mBasicCornerV[2],quat);
93
    }
94
95
///////////////////////////////////////////////////////////////////////////////////////////////////
96
97
  private float[] computeCorner(int numCubitsPerCorner, int numLayers, int corner, int part)
98
    {
99
    if( mCorners==null ) initializeCorners();
100
    if( mCurrCornerV==null || mBasicCornerV==null ) initializeCornerV();
101
102
    float D = numLayers/3.0f;
103
    float[] corn = mCorners[corner];
104
105
    if( part==0 )
106
      {
107
      return new float[] { corn[0]*D, corn[1]*D, corn[2]*D };
108
      }
109
    else
110
      {
111
      float E = D/(0.5f*(numLayers-1));   // ?? maybe 0.5*
112
      int N = (numCubitsPerCorner-1)/3;
113
      int block = (part-1) % N;
114
      int index = (part-1) / N;
115
      Static4D pri = mCurrCornerV[index];
116
      Static4D sec = mCurrCornerV[(index+2)%3];
117
118
      int layers= (numLayers-5)/2;
119
      int multP = (block % layers) + 1;
120
      int multS = (block / layers);
121
122
      return new float[] {
123
                          corn[0]*D + (pri.get0()*multP + sec.get0()*multS)*E,
124
                          corn[1]*D + (pri.get1()*multP + sec.get1()*multS)*E,
125
                          corn[2]*D + (pri.get2()*multP + sec.get2()*multS)*E
126
                         };
127
      }
128
    }
129
130
///////////////////////////////////////////////////////////////////////////////////////////////////
131
132
  private float[] computeCenter(int numLayers, int center, int part)
133
    {
134
    if( mCenterCoords==null ) initializeCenterCoords();
135
    if( mCorners     ==null ) initializeCorners();
136
    if( mCenterMap   ==null ) initializeCenterMap();
137
138
    int corner = mCenterMap[center][part];
139
    float[] cent = mCenterCoords[center];
140
    float[] corn = mCorners[corner];
141
    float D = numLayers/3.0f;
142
    float F = 1.0f - (2.0f*numLayers-6.0f)/(numLayers-1)*COS54*COS54;
143
144
    return new float[]
145
      {
146
        D * ( cent[0] + (corn[0]-cent[0])*F),
147
        D * ( cent[1] + (corn[1]-cent[1])*F),
148
        D * ( cent[2] + (corn[2]-cent[2])*F)
149
      };
150
    }
151
152
///////////////////////////////////////////////////////////////////////////////////////////////////
153
154
  private int computeEdgeType(int cubit, int numCubitsPerCorner, int numCubitsPerEdge)
155
    {
156
    int part = (cubit - NUM_CORNERS*numCubitsPerCorner) % numCubitsPerEdge;
157
    return part - 2*(part/4);
158
    }
159
160
///////////////////////////////////////////////////////////////////////////////////////////////////
161
162
  private float[] computeEdge(int numLayers, int edge, int part)
163
    {
164
    if( mCenterCoords==null ) initializeCenterCoords();
165
    if( mCorners==null ) initializeCorners();
166
    if( mEdgeMap==null ) initializeEdgeMap();
167
168
    float D = numLayers/3.0f;
169
    float[] c1 = mCorners[ mEdgeMap[edge][0] ];
170
    float[] c2 = mCorners[ mEdgeMap[edge][1] ];
171
172
    int leftRight = 2*(part%2) -1;
173
    part /= 2;
174
175
    if( part==0 )
176
      {
177
      float T = 0.5f + leftRight/(numLayers-1.0f);
178
      float x = D * (T*c1[0]+(1.0f-T)*c2[0]);
179
      float y = D * (T*c1[1]+(1.0f-T)*c2[1]);
180
      float z = D * (T*c1[2]+(1.0f-T)*c2[2]);
181
182
      return new float[] { x, y, z };
183
      }
184
    else
185
      {
186
      int mult = (part+1)/2;
187
      int dir  = (part+1)%2;
188
      float[] center = mCenterCoords[ mEdgeMap[edge][dir+2] ];
189
      float x = 0.5f * D * (c1[0]+c2[0]);
190
      float y = 0.5f * D * (c1[1]+c2[1]);
191
      float z = 0.5f * D * (c1[2]+c2[2]);
192
193
      float vX = D*center[0] - x;
194
      float vY = D*center[1] - y;
195
      float vZ = D*center[2] - z;
196
197
      float T = 0.5f + leftRight*(mult*SIN18 + 1.0f)/(numLayers-1);
198
199
      x = D * (T*c1[0]+(1.0f-T)*c2[0]);
200
      y = D * (T*c1[1]+(1.0f-T)*c2[1]);
201
      z = D * (T*c1[2]+(1.0f-T)*c2[2]);
202
203
      float H = mult*D*COS18/(numLayers-1);
204
      H /= (float)Math.sqrt(vX*vX+vY*vY+vZ*vZ);
205
206
      return new float[] { x + H*vX, y + H*vY, z + H*vZ };
207
      }
208
    }
209
210
///////////////////////////////////////////////////////////////////////////////////////////////////
211
212 7b832206 Leszek Koltunski
  public float[][] getCubitPositions(int[] numLayers)
213 29b82486 Leszek Koltunski
    {
214
    if( mCorners==null ) initializeCorners();
215
216 a57e6870 Leszek Koltunski
    int numL = numLayers[0];
217
    if( numL<5 ) return mCorners;
218
219
    int numCubitsPerCorner = numCubitsPerCorner(numL);
220
    int numCubitsPerEdge   = numCubitsPerEdge(numL);
221 29b82486 Leszek Koltunski
    int numCubitsPerCenter = 5;
222
    int numCubits = NUM_CORNERS*numCubitsPerCorner + NUM_EDGES*numCubitsPerEdge + NUM_CENTERS*numCubitsPerCenter;
223
    int index=0;
224
225
    final float[][] CENTERS = new float[numCubits][];
226
227
    for(int corner=0; corner<NUM_CORNERS; corner++)
228
      {
229
      computeBasicCornerVectors(corner);
230
231
      for(int part=0; part<numCubitsPerCorner; part++, index++)
232
        {
233 a57e6870 Leszek Koltunski
        CENTERS[index] = computeCorner(numCubitsPerCorner,numL,corner,part);
234 29b82486 Leszek Koltunski
        }
235
      }
236
237
    for(int edge=0; edge<NUM_EDGES; edge++)
238
      {
239
      for(int part=0; part<numCubitsPerEdge; part++, index++)
240
        {
241 a57e6870 Leszek Koltunski
        CENTERS[index] = computeEdge(numL, edge, part );
242 29b82486 Leszek Koltunski
        }
243
      }
244
245
    for(int center=0; center<NUM_CENTERS; center++)
246
      {
247
      for(int part=0; part<numCubitsPerCenter; part++, index++)
248
        {
249 a57e6870 Leszek Koltunski
        CENTERS[index] = computeCenter(numL,center, part);
250 29b82486 Leszek Koltunski
        }
251
      }
252
253
    return CENTERS;
254
    }
255
256 d0e6cf7f Leszek Koltunski
///////////////////////////////////////////////////////////////////////////////////////////////////
257
258
  public Static4D getCubitQuats(int cubit, int[] numLayers)
259
    {
260
    int numL = numLayers[0];
261
    int numCubitsPerCorner = numCubitsPerCorner(numL);
262
    int numCubitsPerEdge   = numCubitsPerEdge(numL);
263 89a00832 Leszek Koltunski
    int q = getQuat(cubit,numCubitsPerCorner,numCubitsPerEdge);
264
    return mObjectQuats[q];
265 d0e6cf7f Leszek Koltunski
    }
266
267 29b82486 Leszek Koltunski
///////////////////////////////////////////////////////////////////////////////////////////////////
268
269
  private int getQuat(int cubit, int numCubitsPerCorner, int numCubitsPerEdge)
270
    {
271
    if( mQuatCornerIndices==null || mQuatEdgeIndices==null ) initializeQuatIndices();
272
    if( mCenterMap==null ) initializeCenterMap();
273
274
    if( cubit < NUM_CORNERS*numCubitsPerCorner )
275
      {
276
      int corner = cubit/numCubitsPerCorner;
277
      return mQuatCornerIndices[corner];
278
      }
279
280
    if( cubit < NUM_CORNERS*numCubitsPerCorner + NUM_EDGES*numCubitsPerEdge )
281
      {
282
      int edge = (cubit-NUM_CORNERS*numCubitsPerCorner)/numCubitsPerEdge;
283
      return mQuatEdgeIndices[edge];
284
      }
285
286
    if( numCubitsPerCorner==0 )
287
      {
288
      return mQuatCornerIndices[cubit];
289
      }
290
    else
291
      {
292
      cubit -= (NUM_CORNERS*numCubitsPerCorner + NUM_EDGES*numCubitsPerEdge);
293
      int numCubitsPerCenter = 5;
294
      int face = cubit/numCubitsPerCenter;
295
      int index= cubit%numCubitsPerCenter;
296
      int center=mCenterMap[face][index];
297
      return mQuatCornerIndices[center];
298
      }
299
    }
300
301
///////////////////////////////////////////////////////////////////////////////////////////////////
302
303 e30c522a Leszek Koltunski
  public ObjectShape getObjectShape(int variant)
304 29b82486 Leszek Koltunski
    {
305 e30c522a Leszek Koltunski
    int[] numLayers = getNumLayers();
306 29b82486 Leszek Koltunski
    int numVariants = getNumCubitVariants(numLayers);
307 e30c522a Leszek Koltunski
    int numL        = numLayers[0];
308 66de0d91 Leszek Koltunski
    boolean small   = numL<=3;
309 29b82486 Leszek Koltunski
310 66de0d91 Leszek Koltunski
    if( variant==0 && !small )
311 29b82486 Leszek Koltunski
      {
312 a57e6870 Leszek Koltunski
      float width = numL/(numL-1.0f);
313 57ef6378 Leszek Koltunski
      float X = width*COS18*SIN_HALFD;
314
      float Y = width*SIN18;
315
      float Z = width*COS18*COS_HALFD;
316 29b82486 Leszek Koltunski
317 4e9f2df5 Leszek Koltunski
      float[][] vertices =
318 29b82486 Leszek Koltunski
        {
319 57ef6378 Leszek Koltunski
            {   0,   0      ,   0 },
320 29b82486 Leszek Koltunski
            {   X,   Y      ,  -Z },
321 57ef6378 Leszek Koltunski
            {   0, 2*Y      ,-2*Z },
322 29b82486 Leszek Koltunski
            {  -X,   Y      ,  -Z },
323 57ef6378 Leszek Koltunski
            {   0,   0-width,   0 },
324 29b82486 Leszek Koltunski
            {   X,   Y-width,  -Z },
325 57ef6378 Leszek Koltunski
            {   0, 2*Y-width,-2*Z },
326 29b82486 Leszek Koltunski
            {  -X,   Y-width,  -Z },
327
        };
328
329 4e9f2df5 Leszek Koltunski
      int[][] indices =
330 29b82486 Leszek Koltunski
        {
331
            {4,5,1,0},
332
            {7,4,0,3},
333
            {0,1,2,3},
334 846b69f3 Leszek Koltunski
            {7,6,5,4},
335
            {2,1,5,6},
336
            {3,2,6,7}
337 29b82486 Leszek Koltunski
        };
338
339 59a971c1 Leszek Koltunski
      return new ObjectShape(vertices, indices);
340 29b82486 Leszek Koltunski
      }
341
    if( variant<numVariants-1 )
342
      {
343 e30c522a Leszek Koltunski
      int type = variant-1;
344 a57e6870 Leszek Koltunski
      float tmpVal= numL/(numL-1.0f);
345 29b82486 Leszek Koltunski
      float height= tmpVal*COS18;
346
      float width = tmpVal + (type/2)*tmpVal*SIN18;
347
      boolean left = (type%2)==0;
348
349 57ef6378 Leszek Koltunski
      float X = height*SIN_HALFD;
350
      float Y = height*SIN18/COS18;
351
      float Z = height*COS_HALFD;
352 29b82486 Leszek Koltunski
353 4e9f2df5 Leszek Koltunski
      float[][] vertices =
354 29b82486 Leszek Koltunski
        {
355 57ef6378 Leszek Koltunski
            {   0,   0   ,   0 },
356 29b82486 Leszek Koltunski
            {   X,   Y   ,  -Z },
357 57ef6378 Leszek Koltunski
            {   0, 2*Y   ,-2*Z },
358 29b82486 Leszek Koltunski
            {  -X,   Y   ,  -Z },
359 57ef6378 Leszek Koltunski
            {   0, -width,   0 },
360 29b82486 Leszek Koltunski
            {   X, -width,  -Z },
361 57ef6378 Leszek Koltunski
            {   0, -width,-2*Z },
362 29b82486 Leszek Koltunski
            {  -X, -width,  -Z },
363
        };
364
365 4e9f2df5 Leszek Koltunski
      int[][] indices =
366 29b82486 Leszek Koltunski
        {
367
            {4,5,1,0},
368
            {7,4,0,3},
369 846b69f3 Leszek Koltunski
            {3,2,6,7},
370
            {2,1,5,6},
371 29b82486 Leszek Koltunski
            {0,1,2,3},
372 846b69f3 Leszek Koltunski
            {7,6,5,4}
373 29b82486 Leszek Koltunski
        };
374
375
      if( !left )
376
        {
377
        int tmp, len = vertices.length;
378
        for(int i=0; i<len; i++) vertices[i][1] = -vertices[i][1];
379
380 4e9f2df5 Leszek Koltunski
        len = indices.length;
381 29b82486 Leszek Koltunski
        for(int i=0; i<len; i++)
382
          {
383 4e9f2df5 Leszek Koltunski
          tmp = indices[i][0];
384
          indices[i][0] = indices[i][3];
385
          indices[i][3] = tmp;
386
          tmp = indices[i][1];
387
          indices[i][1] = indices[i][2];
388
          indices[i][2] = tmp;
389 29b82486 Leszek Koltunski
          }
390
        }
391
392 59a971c1 Leszek Koltunski
      return new ObjectShape(vertices, indices);
393 29b82486 Leszek Koltunski
      }
394
    else
395
      {
396 a57e6870 Leszek Koltunski
      float width = (1+0.5f*(numL-3)*SIN18)*numL/(numL-1);
397 57ef6378 Leszek Koltunski
      float X = width*COS18*SIN_HALFD;
398
      float Y = width*SIN18;
399
      float Z = width*COS18*COS_HALFD;
400
      float H = width*(SIN54/COS54);
401
      float H3= H/COS_HALFD;
402
      float X3= H*SIN_HALFD;
403
      float Z3= H*COS_HALFD;
404
      float C = 1/(COS54*(float)Math.sqrt(2-2*SIN18));
405 29b82486 Leszek Koltunski
406 4e9f2df5 Leszek Koltunski
      float[][] vertices =
407 29b82486 Leszek Koltunski
        {
408 57ef6378 Leszek Koltunski
            {   0,   0  ,     0 },
409 29b82486 Leszek Koltunski
            {   X,   Y  ,    -Z },
410 57ef6378 Leszek Koltunski
            {   0,C*2*Y ,-2*C*Z },
411 29b82486 Leszek Koltunski
            {  -X,   Y  ,    -Z },
412 57ef6378 Leszek Koltunski
            {   0,-width,     0 },
413 29b82486 Leszek Koltunski
            {  X3,-width,   -Z3 },
414 57ef6378 Leszek Koltunski
            {   0,-width,   -H3 },
415 29b82486 Leszek Koltunski
            { -X3,-width,   -Z3 }
416
        };
417
418 4e9f2df5 Leszek Koltunski
      int[][] indices =
419 29b82486 Leszek Koltunski
        {
420
            {4,5,1,0},
421
            {7,4,0,3},
422
            {0,1,2,3},
423 846b69f3 Leszek Koltunski
            {3,2,6,7},
424
            {2,1,5,6},
425
            {7,6,5,4}
426 29b82486 Leszek Koltunski
        };
427
428 59a971c1 Leszek Koltunski
      return new ObjectShape(vertices, indices);
429 3ee1d662 Leszek Koltunski
      }
430
    }
431
432
///////////////////////////////////////////////////////////////////////////////////////////////////
433
434
  public ObjectFaceShape getObjectFaceShape(int variant)
435
    {
436
    int[] numLayers = getNumLayers();
437
    int numVariants = getNumCubitVariants(numLayers);
438
    int numL        = numLayers[0];
439
    boolean small   = numL<=3;
440
441
    if( variant==0 && !small )
442
      {
443
      float A = (2*SQ3/3)*SIN54;
444
      float B = 0.4f;
445 3bf19410 Leszek Koltunski
      float h1 = isInIconMode() ? 0.001f : 0.04f;
446 3ee1d662 Leszek Koltunski
447 3bf19410 Leszek Koltunski
      float[][] bands     = { {h1,34,0.3f,0.2f, 3, 0, 0}, {0.001f,34,0.0f,0.0f, 2, 0, 0} };
448 3ee1d662 Leszek Koltunski
      int[] bandIndices   = { 0,0,0,1,1,1};
449
      float[][] corners   = { {0.04f,0.10f} };
450
      int[] cornerIndices = { 0,-1,-1,-1,-1,-1,-1,-1 };
451
      float[][] centers   = { {0.0f, -(float)Math.sqrt(1-A*A)*B,-A*B} };
452
      int[] centerIndices = { 0,-1,-1,-1,-1,-1,-1,-1 };
453
454
      return new ObjectFaceShape(bands,bandIndices,corners,cornerIndices,centers,centerIndices,null);
455
      }
456
    if( variant<numVariants-1 )
457
      {
458
      int type = variant-1;
459
      float tmpVal= numL/(numL-1.0f);
460
      float height= tmpVal*COS18;
461
      float width = tmpVal + (type/2)*tmpVal*SIN18;
462
      float Z = height*COS_HALFD;
463
      int E  = small ? 1 : 0;
464
      int N0 = small ? 4 : 3;
465
      int N1 = small ? 3 : 2;
466 3bf19410 Leszek Koltunski
      float h1 = isInIconMode() ? 0.001f : 0.04f;
467 29b82486 Leszek Koltunski
468 3bf19410 Leszek Koltunski
      float[][] bands     = { {h1,34,0.2f,0.2f,N0,E,E}, {0.001f,34,0.0f,0.0f,N1,0,0} };
469 3ee1d662 Leszek Koltunski
      int[] bandIndices   = { 0,0,1,1,1,1};
470
      float[][] corners   = { {0.04f,0.10f} };
471
      int[] cornerIndices = { 0,-1,-1,-1, 0,-1,-1,-1 };
472
      float[][] centers   = { {0.0f, -width/2, -2*Z} };
473
      int[] centerIndices = { 0,-1,-1,-1, 0,-1,-1,-1 };
474
475
      return new ObjectFaceShape(bands,bandIndices,corners,cornerIndices,centers,centerIndices,null);
476
      }
477
    else
478
      {
479 29b82486 Leszek Koltunski
      float A = (2*SQ3/3)*SIN54;
480
      float B = 0.4f;
481 3ee1d662 Leszek Koltunski
      int N = small ? 4 : 3;
482
      int E = small ? 1 : 0;
483 3bf19410 Leszek Koltunski
      float h1 = isInIconMode() ? 0.001f : 0.04f;
484
      float h2 = isInIconMode() ? 0.001f : 0.01f;
485 29b82486 Leszek Koltunski
486 3bf19410 Leszek Koltunski
      float[][] bands     = { {h1,17,0.3f,0.2f,N,E,E},{h2,17,0.3f,0.2f,N,E,E} };
487 3ee1d662 Leszek Koltunski
      int[] bandIndices   = { 0,0,0,1,1,1};
488
      float[][] corners   = { {0.03f,0.10f} };
489
      int[] cornerIndices = { 0, 0,-1, 0, 0,-1,-1,-1 };
490
      float[][] centers   = { {0.0f, -(float)Math.sqrt(1-A*A)*B,-A*B} };
491
      int[] centerIndices = { 0, 0,-1, 0, 0,-1,-1,-1 };
492 29b82486 Leszek Koltunski
493 3ee1d662 Leszek Koltunski
      return new ObjectFaceShape(bands,bandIndices,corners,cornerIndices,centers,centerIndices,null);
494 29b82486 Leszek Koltunski
      }
495
    }
496
497
///////////////////////////////////////////////////////////////////////////////////////////////////
498
499 e30c522a Leszek Koltunski
  public int getNumCubitVariants(int[] numLayers)
500 29b82486 Leszek Koltunski
    {
501 a57e6870 Leszek Koltunski
    switch(numLayers[0])
502 61aa85e4 Leszek Koltunski
      {
503
      case 3: return 1;
504
      case 5: return 4;
505
      }
506 29b82486 Leszek Koltunski
507 61aa85e4 Leszek Koltunski
    return 1;
508 29b82486 Leszek Koltunski
    }
509
510
///////////////////////////////////////////////////////////////////////////////////////////////////
511
512 e30c522a Leszek Koltunski
  public int getCubitVariant(int cubit, int[] numLayers)
513 29b82486 Leszek Koltunski
    {
514 a57e6870 Leszek Koltunski
    int numL = numLayers[0];
515
    int numCubitsPerCorner = numCubitsPerCorner(numL);
516 29b82486 Leszek Koltunski
517
    if( cubit<NUM_CORNERS*numCubitsPerCorner ) return 0;
518
519 a57e6870 Leszek Koltunski
    int numCubitsPerEdge = numCubitsPerEdge(numL);
520 29b82486 Leszek Koltunski
521
    if( cubit<NUM_CORNERS*numCubitsPerCorner + NUM_EDGES*numCubitsPerEdge )
522
      {
523
      int type = computeEdgeType(cubit,numCubitsPerCorner,numCubitsPerEdge);
524
      return type+1;
525
      }
526
527 61aa85e4 Leszek Koltunski
    return getNumCubitVariants(numLayers)-1;
528 29b82486 Leszek Koltunski
    }
529
530 3d766df3 Leszek Koltunski
///////////////////////////////////////////////////////////////////////////////////////////////////
531
532 d53fb890 Leszek Koltunski
  public float getStickerRadius()
533 3d766df3 Leszek Koltunski
    {
534 ec42a6fe Leszek Koltunski
    return 0.18f;
535 3d766df3 Leszek Koltunski
    }
536
537
///////////////////////////////////////////////////////////////////////////////////////////////////
538 a75ae1ee Leszek Koltunski
539 d53fb890 Leszek Koltunski
  public float getStickerStroke()
540 3d766df3 Leszek Koltunski
    {
541
    float stroke = 0.25f;
542
543 3bf19410 Leszek Koltunski
    if( isInIconMode() )
544 a75ae1ee Leszek Koltunski
      {
545 3d766df3 Leszek Koltunski
      int[] numLayers = getNumLayers();
546
      if( numLayers[0]>3 ) stroke*=1.5f;
547 29b82486 Leszek Koltunski
      }
548 3d766df3 Leszek Koltunski
549
    return stroke;
550 29b82486 Leszek Koltunski
    }
551
552 00f4980d Leszek Koltunski
///////////////////////////////////////////////////////////////////////////////////////////////////
553
554 d53fb890 Leszek Koltunski
  public float[][] getStickerAngles()
555 00f4980d Leszek Koltunski
    {
556
    return null;
557
    }
558
559 61aa85e4 Leszek Koltunski
///////////////////////////////////////////////////////////////////////////////////////////////////
560
561 5f54927b Leszek Koltunski
  public String getShortName()
562 61aa85e4 Leszek Koltunski
    {
563 5f54927b Leszek Koltunski
    switch(getNumLayers()[0])
564
      {
565
      case 3: return ObjectType.KILO_3.name();
566
      case 5: return ObjectType.KILO_5.name();
567
      }
568
569
    return ObjectType.KILO_3.name();
570
    }
571
572
///////////////////////////////////////////////////////////////////////////////////////////////////
573
574
  public long getSignature()
575
    {
576
    switch(getNumLayers()[0])
577 61aa85e4 Leszek Koltunski
      {
578 5f54927b Leszek Koltunski
      case 3: return ObjectType.KILO_3.ordinal();
579
      case 5: return ObjectType.KILO_5.ordinal();
580 61aa85e4 Leszek Koltunski
      }
581
582 5f54927b Leszek Koltunski
    return ObjectType.KILO_3.ordinal();
583 61aa85e4 Leszek Koltunski
    }
584
585 29b82486 Leszek Koltunski
///////////////////////////////////////////////////////////////////////////////////////////////////
586
587 e26eb4e7 Leszek Koltunski
  public String getObjectName()
588 29b82486 Leszek Koltunski
    {
589 e26eb4e7 Leszek Koltunski
    switch(getNumLayers()[0])
590
      {
591
      case 3: return "Kilominx";
592
      case 5: return "Master Kilominx";
593
      }
594
    return "Kilominx";
595 29b82486 Leszek Koltunski
    }
596
597
///////////////////////////////////////////////////////////////////////////////////////////////////
598
599 e26eb4e7 Leszek Koltunski
  public String getInventor()
600 29b82486 Leszek Koltunski
    {
601 e26eb4e7 Leszek Koltunski
    switch(getNumLayers()[0])
602
      {
603
      case 3: return "Thomas de Bruin";
604
      case 5: return "David Gugl";
605
      }
606
    return "Thomas de Bruin";
607 29b82486 Leszek Koltunski
    }
608
609 59c20632 Leszek Koltunski
///////////////////////////////////////////////////////////////////////////////////////////////////
610
611 e26eb4e7 Leszek Koltunski
  public int getYearOfInvention()
612 59c20632 Leszek Koltunski
    {
613 e26eb4e7 Leszek Koltunski
    switch(getNumLayers()[0])
614 59c20632 Leszek Koltunski
      {
615
      case 3: return 2008;
616
      case 5: return 2010;
617
      }
618
    return 2008;
619
    }
620
621 29b82486 Leszek Koltunski
///////////////////////////////////////////////////////////////////////////////////////////////////
622
623 e26eb4e7 Leszek Koltunski
  public int getComplexity()
624 29b82486 Leszek Koltunski
    {
625 e26eb4e7 Leszek Koltunski
    switch(getNumLayers()[0])
626
      {
627 b4223a92 Leszek Koltunski
      case 3: return 2;
628
      case 5: return 3;
629 e26eb4e7 Leszek Koltunski
      }
630 a57e6870 Leszek Koltunski
    return 8;
631 29b82486 Leszek Koltunski
    }
632 052e0362 Leszek Koltunski
633
///////////////////////////////////////////////////////////////////////////////////////////////////
634
635
  public String[][] getTutorials()
636
    {
637
    int[] numLayers = getNumLayers();
638
639
    switch(numLayers[0])
640
      {
641
      case 3: return new String[][] {
642
                          {"gb","grgGgUSxiQg","How to Solve the Kilominx","Z3"},
643
                          {"es","g6WMYjkCLok","Resolver Kilominx","Cuby"},
644
                          {"ru","gjaknjuZXPs","Киломинкс как собрать","CUBES WORLD"},
645
                          {"fr","F7z6LztN-7A","Résoudre le Kilominx","Twins Cuber"},
646
                          {"de","fcmJdpLfZwk","Megaminx 2x2 lösen","JamesKnopf"},
647
                          {"pl","tdWh8f8qpq4","Kilominx TUTORIAL PL","MrUK"},
648
                          {"kr","8-X4GhQnE5I","2X2 킬로밍크스 TUTORIAL","큐브놀이터"},
649 a399e91b Leszek Koltunski
                          {"vn","eW7RLayPPmA","Tutorial N.11 - Kilominx","Duy Thích Rubik"},
650 052e0362 Leszek Koltunski
                         };
651
      case 5: return new String[][] {
652
                          {"gb","VAnzC2SYVc4","How To Solve A Master Kilominx","Grizz Media"},
653
                          {"es","ozINTg-61Fs","Tutorial Master Kilominx","RubikArt"},
654
                          {"ru","0aemQayCZRc","Как собрать Мастер Киломинкс ч.1","Артем Мартиросов"},
655
                          {"ru","ohOUFTx-oQI","Как собрать Мастер Киломинкс ч.2","Артем Мартиросов"},
656
                          {"ru","YRXRdT2jCn8","Как собрать Мастер Киломинкс ч.3","Артем Мартиросов"},
657
                          {"fr","usMiWt44aqo","Résolution du Master Kilominx","Asthalis"},
658
                          {"pl","rdln0IG86_s","Master Kilominx TUTORIAL PL","MrUK"},
659
                          {"br","0nmaZf2-44M","Como resolver o Master Kilominx 1/3","Rafael Cinoto"},
660
                          {"br","SkR6RybAKHc","Como resolver o Master Kilominx 2/3","Rafael Cinoto"},
661
                          {"br","5C7J7Cb4a7Q","Como resolver o Master Kilominx 3/3","Rafael Cinoto"},
662
                          {"kr","dvy-GxCjm5c","마스터 킬로밍크스 배우기 1","vincentcube"},
663
                          {"kr","Jm0B12vNxsE","마스터 킬로밍크스 배우기 2","vincentcube"},
664
                          {"kr","H1I18FVpr6g","마스터 킬로밍크스 배우기 3","vincentcube"},
665
                         };
666
      }
667
    return null;
668
    }
669 29b82486 Leszek Koltunski
}