Project

General

Profile

« Previous | Next » 

Revision da69c279

Added by Leszek Koltunski over 3 years ago

Square-2: progress.

View differences:

src/main/java/org/distorted/objects/ObjectList.java
215 215

  
216 216
  SQU1 (
217 217
         new int[][] {
218
                       {3 , 18, 0, R.drawable.ui_small_diam2, R.drawable.ui_medium_diam2, R.drawable.ui_big_diam2, R.drawable.ui_huge_diam2} ,
218
                       {3 , 24, 0, R.drawable.ui_small_diam2, R.drawable.ui_medium_diam2, R.drawable.ui_big_diam2, R.drawable.ui_huge_diam2} ,
219 219
                     },
220 220
         TwistySquare1.class,
221 221
         new MovementSquare(),
......
225 225

  
226 226
  SQU2 (
227 227
         new int[][] {
228
                       {3 , 18, 0, R.drawable.ui_small_diam2, R.drawable.ui_medium_diam2, R.drawable.ui_big_diam2, R.drawable.ui_huge_diam2} ,
228
                       {3 , 24, 0, R.drawable.ui_small_diam2, R.drawable.ui_medium_diam2, R.drawable.ui_big_diam2, R.drawable.ui_huge_diam2} ,
229 229
                     },
230 230
         TwistySquare2.class,
231 231
         new MovementSquare(),
src/main/java/org/distorted/objects/TwistyObject.java
888 888
        int index = CUBITS[i].removeRotationNow(quat);
889 889
        mMesh.setEffectAssociation(i, CUBITS[i].computeAssociation(),index);
890 890
        }
891
/*
892
    if( NUM_CUBITS==18 )
893
      {
894
      boolean error=false;
895
      String str="";
896

  
897
      for(int i=10; i<18; i++)
898
        {
899
        int q = CUBITS[i].mQuatIndex;
900

  
901
        str += (" "+q);
902

  
903
        if( (((i%2)==0) && (q==2 || q== 8 || q==17 || q==23)) ||
904
            (((i%2)==1) && (q==5 || q==11 || q==14 || q==20))  )
905
           error=true;
906
        }
907

  
908
      if( error ) str+= " ERROR";
909
      android.util.Log.e("D", "cubit: "+str);
910
      }
911

  
912
 */
913 891
    }
914 892

  
915 893
///////////////////////////////////////////////////////////////////////////////////////////////////
src/main/java/org/distorted/objects/TwistySquare1.java
354 354
    {
355 355
    for(int corner=0; corner<8; corner++)
356 356
      {
357
//android.util.Log.e("D", "isPermittedUp: up corner: "+corner+" angle: "+angle);
358

  
359

  
360 357
      if( cornerIsUp(corner) )
361 358
        {
362 359
        int currQuat = mCornerQuat[corner];
363 360
        int finalQuat= QUAT_MULT[angle][currQuat];
364

  
365
//boolean bad = quatIsBad(finalQuat,corner);
366
//android.util.Log.e("D", "isPermittedUp: up corner: "+corner+" angle: "+angle+" is bad: "+bad);
367

  
368 361
        if( quatIsBad(finalQuat,corner) ) return false;
369 362
        }
370 363
      }
......
389 382
      {
390 383
      if( isPermittedUp(angle ) ) mPermittedAngles[1][mPermittedUp++] = angle;
391 384
      }
392
/*
393
    String strDo="";
394

  
395
    for(int i=0; i<mPermittedDo; i++)
396
      {
397
      strDo += (" "+mPermittedAngles[0][i]);
398
      }
399

  
400
    String strUp="";
401

  
402
    for(int i=0; i<mPermittedUp; i++)
403
      {
404
      strUp += (" "+mPermittedAngles[1][i]);
405
      }
406

  
407
    android.util.Log.e("D", "up  : "+strUp);
408
    android.util.Log.e("D", "down: "+strDo);
409

  
410
 */
411 385
    }
412 386

  
413 387
///////////////////////////////////////////////////////////////////////////////////////////////////
......
475 449
        mCornerQuat[corner] = QUAT_MULT[quat][curr];
476 450
        }
477 451
      }
478
/*
479
    String q="";
480

  
481
    for(int c=0; c<8; c++)
482
      {
483
      q += (" "+mCornerQuat[c]);
484
      }
485

  
486
    android.util.Log.d("D", "quat="+quat+" corner quats now= "+q);
487
*/
488 452
    }
489 453

  
490 454
///////////////////////////////////////////////////////////////////////////////////////////////////
......
517 481
                    scramble[num][2] = nextAngle;
518 482
                    mLastRot = layer==0 ? LAST_LO : LAST_UP;
519 483
                    updateCornerQuats(scramble[num]);
520

  
521
//android.util.Log.e("D", "SL axis="+scramble[num][0]+" layer="+scramble[num][1]+" angle="+scramble[num][2]);
522

  
523 484
                    break;
524 485
      case LAST_LO:
525 486
      case LAST_UP: layer = mLastRot==LAST_LO ? 1:0;
......
532 493
                      scramble[num][2] = nextAngle;
533 494
                      updateCornerQuats(scramble[num]);
534 495
                      mLastRot = LAST_UL;
535
//android.util.Log.e("D", "LO/UP 1 axis="+scramble[num][0]+" layer="+scramble[num][1]+" angle="+scramble[num][2]);
536 496
                      }
537 497
                    else
538 498
                      {
......
542 502
                      mLastRot = LAST_SL;
543 503
                      updateCornerQuats(scramble[num]);
544 504
                      computePermittedAngles();
545
//android.util.Log.e("D", "LO/UP 2 axis="+scramble[num][0]+" layer="+scramble[num][1]+" angle="+scramble[num][2]);
546 505
                      }
547 506

  
548 507
                    break;
......
552 511
                    mLastRot = LAST_SL;
553 512
                    updateCornerQuats(scramble[num]);
554 513
                    computePermittedAngles();
555
//android.util.Log.e("D", "UL axis="+scramble[num][0]+" layer="+scramble[num][1]+" angle="+scramble[num][2]);
556

  
557 514
                    break;
558 515
      }
559 516
    }
src/main/java/org/distorted/objects/TwistySquare2.java
47 47
    {
48 48
      0, 6,
49 49
      0, 9, 6, 3, 18, 15, 12, 21,
50
      0, 9, 6, 3, 15, 12, 21, 18,
51
      0, 9, 6, 3, 15, 12, 21, 18
50
      0, 9, 6, 3, 0, 9, 6, 3,
51
      15, 12, 21, 18, 15, 12, 21, 18
52 52
    };
53 53

  
54 54
  // centers of the 2 middles + 8 edges + 8 left corners + 8 right corners
......
143 143
      { 2, 0, 0, 0, 0, 0 },
144 144
      { 2, 0, 5, 0, 0, 0 },
145 145
      { 2, 0, 1, 0, 0, 0 },
146

  
146 147
      { 0, 3, 4, 0, 0, 0 },
147 148
      { 0, 3, 0, 0, 0, 0 },
148 149
      { 0, 3, 5, 0, 0, 0 },
149 150
      { 0, 3, 1, 0, 0, 0 },
150 151

  
151
      { 0, 2, 4, 0, 0, 0 }, // 18
152
      { 0, 2, 0, 0, 0, 0 },
152
      { 0, 2, 0, 0, 0, 0 }, // 18
153 153
      { 0, 2, 5, 0, 0, 0 },
154 154
      { 0, 2, 1, 0, 0, 0 },
155
      { 0, 2, 4, 0, 0, 0 },
155 156
      { 3, 0, 0, 0, 0, 0 },
156 157
      { 3, 0, 5, 0, 0, 0 },
157 158
      { 3, 0, 1, 0, 0, 0 },
......
173 174

  
174 175
  private Static4D getQuat(int cubit)
175 176
    {
176
    if( (cubit>=0 && cubit<=13) || (cubit>=22))
177
      {
178
      return QUATS[QUAT_NUMBER[cubit]];
179
      }
180
    else
181
      {
182
      return QUATS[0];
183
      }
177
    return QUATS[QUAT_NUMBER[cubit]];
184 178
    }
185 179

  
186 180
///////////////////////////////////////////////////////////////////////////////////////////////////
......
191 185
      {
192 186
      float[][] bands= new float[][]
193 187
        {
194
          {0.038f,35,0.9f,1.0f, 5,2,1},
188
          {0.030f,35,0.9f,1.0f, 5,2,1},
195 189
          {0.001f,35,0.9f,1.0f, 5,2,1}
196 190
        };
197
      int[] bandIndexes   = new int[] { 0,1,0,1,1 };
191
      int[] bandIndexes   = new int[] { 0,0,0,1,1 };
198 192
      float[][] corners   = new float[][] { {0.05f,0.13f} };
199 193
      int[] cornerIndexes = new int[] { 0,0,-1,0,0,-1 };
200 194
      float[][] centers   = new float[][] { { 0.0f, 0.0f,-0.5f} };

Also available in: Unified diff