Project

General

Profile

« Previous | Next » 

Revision 722b2512

Added by Leszek Koltunski over 3 years ago

Simplifications.

View differences:

src/main/java/org/distorted/objects/TwistyBandagedAbstract.java
396 396

  
397 397
    for(int i=1; i<NUM_CUBITS; i++)
398 398
      {
399
      if( !thereIsNoVisibleDifference(CUBITS[i], index) ) return false;
399
      if( thereIsVisibleDifference(CUBITS[i], index) ) return false;
400 400
      }
401 401

  
402 402
    return true;
src/main/java/org/distorted/objects/TwistyCube.java
30 30
import org.distorted.library.type.Static3D;
31 31
import org.distorted.library.type.Static4D;
32 32
import org.distorted.main.R;
33
import org.distorted.main.RubikSurfaceView;
34 33

  
35 34
import java.util.Random;
36 35

  
......
294 293

  
295 294
    for(int i=1; i<NUM_CUBITS; i++)
296 295
      {
297
      if( !thereIsNoVisibleDifference(CUBITS[i], index) ) return false;
296
      if( thereIsVisibleDifference(CUBITS[i], index) ) return false;
298 297
      }
299 298

  
300 299
    return true;
src/main/java/org/distorted/objects/TwistyMegaminx.java
162 162
    mBasicCornerV[0] = new Static4D( (SQ5+1)*0.125f, (SQ5-1)*0.125f, -0.250f, 0.0f );
163 163
    mBasicCornerV[1] = new Static4D(-(SQ5+1)*0.125f, (SQ5-1)*0.125f, -0.250f, 0.0f );
164 164
    mBasicCornerV[2] = new Static4D(              0,        -0.500f,    0.0f, 0.0f );
165
    };
165
    }
166 166

  
167 167
///////////////////////////////////////////////////////////////////////////////////////////////////
168 168

  
......
576 576

  
577 577
    for(int i=1; i<NUM_CUBITS; i++)
578 578
      {
579
      if( !thereIsNoVisibleDifference(CUBITS[i], index) ) return false;
579
      if( thereIsVisibleDifference(CUBITS[i], index) ) return false;
580 580
      }
581 581

  
582 582
    return true;
src/main/java/org/distorted/objects/TwistyObject.java
406 406
// a) is a corner or edge and the quaternions are the same
407 407
// b) is inside one of the faces and after rotations by both quats it ends up on the same face.
408 408

  
409
  boolean thereIsNoVisibleDifference(Cubit cubit, int quatIndex)
409
  boolean thereIsVisibleDifference(Cubit cubit, int quatIndex)
410 410
    {
411
    if ( cubit.mQuatIndex == quatIndex ) return true;
411
    if ( cubit.mQuatIndex == quatIndex ) return false;
412 412

  
413 413
    int belongsToHowManyFaces = 0;
414 414
    int lastLayer = getNumLayers()-1;
......
422 422

  
423 423
    switch(belongsToHowManyFaces)
424 424
      {
425
      case 0 : return true ;  // 'inside' cubit that does not lie on any face
425
      case 0 : return false;  // 'inside' cubit that does not lie on any face
426 426
      case 1 :                // cubit that lies inside one of the faces
427 427
               Static3D orig = cubit.getOrigPosition();
428 428
               Static4D quat1 = QUATS[quatIndex];
......
445 445
                 row1 = computeRow(x1,y1,z1,i);
446 446
                 row2 = computeRow(x2,y2,z2,i);
447 447

  
448
                 if( (row1==0 && row2==0) || (row1==lastLayer && row2==lastLayer) ) return true;
448
                 if( (row1==0 && row2==0) || (row1==lastLayer && row2==lastLayer) ) return false;
449 449
                 }
450
               return false;
450
               return true;
451 451

  
452
      default: return false;  // edge or corner
452
      default: return true;  // edge or corner
453 453
      }
454 454
    }
455 455

  
src/main/java/org/distorted/objects/TwistyPyraminx.java
30 30
import org.distorted.library.type.Static3D;
31 31
import org.distorted.library.type.Static4D;
32 32
import org.distorted.main.R;
33
import org.distorted.main.RubikSurfaceView;
34 33

  
35 34
import java.util.Random;
36 35

  
......
326 325

  
327 326
    for(int i=1; i<NUM_CUBITS; i++)
328 327
      {
329
      if( !thereIsNoVisibleDifference(CUBITS[i], index) ) return false;
328
      if( thereIsVisibleDifference(CUBITS[i], index) ) return false;
330 329
      }
331 330

  
332 331
    return true;

Also available in: Unified diff