Project

General

Profile

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

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

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