Project

General

Profile

« Previous | Next » 

Revision 5eedd516

Added by Leszek Koltunski almost 4 years ago

Progress with the Rex Cube (icons)

View differences:

src/main/java/org/distorted/objects/FactoryCubit.java
634 634
      }
635 635

  
636 636
    float[] bands0 = computeBands(+0.02f,10,0.5f,0.5f,5);
637
    float[] bands1 = computeBands(-0.00f,45,0.5f,0.0f,2);
637
    float[] bands1 = computeBands(-0.05f,45,0.5f,0.0f,2);
638 638

  
639 639
    meshes[0] = new MeshPolygon(vertices,bands0,1,1);
640 640
    meshes[0].setEffectAssociation(0,1,0);
src/main/java/org/distorted/objects/ObjectList.java
123 123

  
124 124
   REX (
125 125
         new int[][] {
126
                       {3 , 16, R.raw.ivy, R.drawable.ui_small_ivy, R.drawable.ui_medium_ivy, R.drawable.ui_big_ivy, R.drawable.ui_huge_ivy} ,
126
                       {3 , 16, R.raw.ivy, R.drawable.ui_small_rex, R.drawable.ui_medium_rex, R.drawable.ui_big_rex, R.drawable.ui_huge_rex} ,
127 127
                     },
128 128
         TwistyRex.class,
129 129
         new MovementRex(),
src/main/java/org/distorted/objects/TwistyRex.java
352 352
    {
353 353
    int COLORS = FACE_COLORS.length;
354 354
    FactorySticker factory = FactorySticker.getInstance();
355
    float S  = 0.04f;
355
    float S1 = 0.06f;
356
    float S2 = 0.04f;
356 357
    float R1 = 0.12f;
357 358
    float R2 = 0.06f;
358 359

  
359 360
    if( face<COLORS )
360 361
      {
361
      factory.drawRexCornerSticker(canvas, paint, left, top, FACE_COLORS[face%COLORS], S, R2);
362
      factory.drawRexCornerSticker(canvas, paint, left, top, FACE_COLORS[face%COLORS], S1, R2);
362 363
      }
363 364
    else if( face<2*COLORS )
364 365
      {
365
      factory.drawRexFaceSticker(canvas, paint, left, top, FACE_COLORS[face%COLORS], S, R1);
366
      factory.drawRexFaceSticker(canvas, paint, left, top, FACE_COLORS[face%COLORS], S1, R1);
366 367
      }
367 368
    else
368 369
      {
369
      factory.drawRexEdgeSticker(canvas, paint, left, top, FACE_COLORS[face%COLORS], S, R1);
370
      factory.drawRexEdgeSticker(canvas, paint, left, top, FACE_COLORS[face%COLORS], S2, R1);
370 371
      }
371 372
    }
372 373

  
......
474 475
///////////////////////////////////////////////////////////////////////////////////////////////////
475 476
// The Rex is solved if and only if:
476 477
//
477
// TODO
478
// 1) all 12 of its edge cubits are rotated with the same quat
479
// 2) all its face & corner cubits are rotated with the same quat like the edge ones,
480
//    and optionally they also might be upside down.
481
//
482
// i.e.
483
// corners ( 0, 1, 2, 3, 4, 5, 6, 7) and faces (24,25) - might be extra QUAT[1]
484
// corners ( 8, 9,10,11,12,13,14,15) and faces (26,27) - might be extra QUAT[2]
485
// corners (16,17,18,19,20,21,22,23) and faces (28,29) - might be extra QUAT[3]
478 486

  
479 487
  public boolean isSolved()
480 488
    {
481
    int q = CUBITS[0].mQuatIndex;
489
    int q1,q = CUBITS[0].mQuatIndex;
482 490

  
483
    for(int i=1; i<42; i++)
491
    for(int i=30; i<42; i++)
484 492
      {
485 493
      if( CUBITS[i].mQuatIndex != q) return false;
486 494
      }
487 495

  
496
    q1 = mulQuat(q,1);
497

  
498
    for(int i=0; i<8; i++)
499
      {
500
      if( CUBITS[i].mQuatIndex != q && CUBITS[i].mQuatIndex != q1 ) return false;
501
      }
502

  
503
    if( CUBITS[24].mQuatIndex != q && CUBITS[24].mQuatIndex != q1 ) return false;
504
    if( CUBITS[25].mQuatIndex != q && CUBITS[25].mQuatIndex != q1 ) return false;
505

  
506
    q1 = mulQuat(q,2);
507

  
508
    for(int i=8; i<16; i++)
509
      {
510
      if( CUBITS[i].mQuatIndex != q && CUBITS[i].mQuatIndex != q1 ) return false;
511
      }
512

  
513
    if( CUBITS[26].mQuatIndex != q && CUBITS[26].mQuatIndex != q1 ) return false;
514
    if( CUBITS[27].mQuatIndex != q && CUBITS[27].mQuatIndex != q1 ) return false;
515

  
516
    q1 = mulQuat(q,3);
517

  
518
    for(int i=16; i<24; i++)
519
      {
520
      if( CUBITS[i].mQuatIndex != q && CUBITS[i].mQuatIndex != q1 ) return false;
521
      }
522

  
523
    if( CUBITS[28].mQuatIndex != q && CUBITS[28].mQuatIndex != q1 ) return false;
524
    if( CUBITS[29].mQuatIndex != q && CUBITS[29].mQuatIndex != q1 ) return false;
525

  
488 526
    return true;
489 527
    }
490 528

  

Also available in: Unified diff