Project

General

Profile

« Previous | Next » 

Revision b5347187

Added by Leszek Koltunski about 3 years ago

Progress with any size Kilominx.

View differences:

src/main/java/org/distorted/objects/FactoryCubit.java
37 37

  
38 38
class FactoryCubit
39 39
  {
40
  static final float IVY_D = 0.003f;
41
  static final float IVY_C = 0.59f;
42
  static final float IVY_M = 0.35f;
43
  static final float REX_D = 0.2f;
44

  
45 40
  private static final float SQ2 = (float)Math.sqrt(2);
46 41
  private static final float SQ3 = (float)Math.sqrt(3);
47 42
  private static final float SQ5 = (float)Math.sqrt(5);
48 43
  private static final float SQ6 = (float)Math.sqrt(6);
49 44

  
45
  private static final Static1D RADIUS = new Static1D(1);
46
  private static FactoryCubit mThis;
47

  
48
  // IVY
49
  static final float IVY_D = 0.003f;
50
  static final float IVY_C = 0.59f;
51
  static final float IVY_M = 0.35f;
52
  private static final int IVY_N = 8;
53

  
54
  // REX
55
  static final float REX_D = 0.2f;
56

  
57
  // KILO / MEGAMINX
50 58
  static final float SIN54    = (SQ5+1)/4;
51 59
  static final float COS54    = (float)(Math.sqrt(10-2*SQ5)/4);
52 60
  static final float SIN18    = (SQ5-1)/4;
53 61
  static final float COS18    = (float)(0.25f*Math.sqrt(10.0f+2.0f*SQ5));
54 62
  static final float COS_HALFD= (float)(Math.sqrt(0.5f-0.1f*SQ5)); // cos(half the dihedral angle)
55 63
  static final float SIN_HALFD= (float)(Math.sqrt(0.5f+0.1f*SQ5)); // sin(half the dihedral angle)
56

  
57 64
  static final float DIHEDRAL1= (float)(Math.acos(-SQ5/5)*180/Math.PI);
58 65
  static final float DIHEDRAL2= (float)((180/Math.PI)*Math.asin((2*SIN54*SIN54-1)/COS54) - 90);
59

  
60 66
  static final float MINX_SC  = 0.5f;
61 67

  
62
  private static final int IVY_N = 8;
63

  
64
  private static final Static1D RADIUS = new Static1D(1);
65
  private static FactoryCubit mThis;
66

  
67 68
///////////////////////////////////////////////////////////////////////////////////////////////////
68 69

  
69 70
  private FactoryCubit()
......
1356 1357

  
1357 1358
  VertexEffect[] createVertexEffectsKilominxCenter(float width)
1358 1359
    {
1359
    VertexEffect[] effect = new VertexEffect[10];
1360
    VertexEffect[] effect = new VertexEffect[11];
1360 1361

  
1361 1362
    float H = 0.5f*(SIN54/COS54);
1362 1363
    float Y1= 0.5f*SIN_HALFD;
......
1391 1392
    effect[7] = new VertexEffectRotate(angle4, axisC, center);
1392 1393
    effect[8] = new VertexEffectRotate(angle5, axisC, center);
1393 1394
    effect[9] = new VertexEffectRotate(angle6, axisY, center);
1395
    effect[10]= new VertexEffectScale(width/0.5f);
1394 1396

  
1395 1397
    effect[0].setMeshAssociation( 7,-1);  // meshes 0,1,2
1396 1398
    effect[1].setMeshAssociation(56,-1);  // meshes 3,4,5
src/main/java/org/distorted/objects/ObjectList.java
143 143
  KILO (
144 144
         new int[][] {
145 145
                       {3 , 18, R.raw.kilo3, R.drawable.ui_small_kilo3, R.drawable.ui_medium_kilo3, R.drawable.ui_big_kilo3, R.drawable.ui_huge_kilo3} ,
146
                       {5 , 31, R.raw.kilo3, R.drawable.ui_small_kilo3, R.drawable.ui_medium_kilo3, R.drawable.ui_big_kilo3, R.drawable.ui_huge_kilo3} ,
146 147
                     },
147 148
         TwistyKilominx.class,
148 149
         new MovementMinx(),
src/main/java/org/distorted/objects/TwistyKilominx.java
250 250
        }
251 251
      }
252 252

  
253
    for(int center=0; center<NUM_CENTERS; center++, index++)
253
    for(int center=0; center<NUM_CENTERS; center++)
254 254
      {
255 255
      for(int part=0; part<numCubitsPerCenter; part++, index++)
256 256
        {
......
309 309
    if( mNumCornerEdgeVariants>0 )
310 310
      {
311 311
      if( mCornerMeshes==null ) mCornerMeshes = new MeshBase[mNumCornerEdgeVariants];
312
      if( mEdgeMeshes  ==null ) mEdgeMeshes   = new MeshBase[mNumCornerEdgeVariants][(highestSize-3)/2];
312
      if( mEdgeMeshes  ==null ) mEdgeMeshes   = new MeshBase[mNumCornerEdgeVariants][highestSize-3];
313 313
      }
314 314

  
315 315
    if( mCenterMeshes==null ) mCenterMeshes = new MeshBase[variants];
......
362 362

  
363 363
  int getFaceColor(int cubit, int cubitface, int numLayers)
364 364
    {
365
    return cubitface>=0 && cubitface<3 ? mCornerFaceMap[cubit][cubitface] : NUM_TEXTURES*NUM_FACES;
365
    if( numLayers==3 )
366
      {
367
      return cubitface>=0 && cubitface<3 ? mCornerFaceMap[cubit][cubitface] : NUM_TEXTURES*NUM_FACES;
368
      }
369

  
370
    return 0;
366 371
    }
367 372

  
368 373
///////////////////////////////////////////////////////////////////////////////////////////////////
......
381 386
    float[] vertices = { -X1, Y2, 0, -A*Y1, X1, Y2, 0, Y1 };
382 387

  
383 388
    FactorySticker factory = FactorySticker.getInstance();
384
    factory.drawRoundedPolygon(canvas, paint, left, top, vertices, S, FACE_COLORS[face], R);
389
    factory.drawRoundedPolygon(canvas, paint, left, top, vertices, S, FACE_COLORS[face%NUM_FACES], R);
385 390

  
386 391
    float MID = TEXTURE_HEIGHT*0.5f;
387 392
    float WID = TEXTURE_HEIGHT*0.1f;

Also available in: Unified diff