Project

General

Profile

« Previous | Next » 

Revision ef018c1b

Added by Leszek Koltunski over 2 years ago

Abstract the next function, computeRowFromOffset(), out of the individual Movement classes.
Still two issues:

1) mysterious 1.5 multiplier in Movement12
2) in Movement8, moving the offset works only if the rotAxis are face-turning, i.e. they connect the centers of the opposing faces of the octahedron.

View differences:

src/main/java/org/distorted/objects/TwistyUltimate.java
54 54
  private ScrambleState[] mStates;
55 55
  private int[] mBasicAngle;
56 56
  private Static4D[] mQuats;
57
  private float[][] mCuts;
58
  private boolean[][] mLayerRotatable;
57 59
  private int[][] mFaceMap;
58 60
  private float[][] mCenters;
59 61
  private int[] mQuatIndex;
......
353 355

  
354 356
  float[][] getCuts(int numLayers)
355 357
    {
356
    float[] cut = new float[] {0.0f};
357
    return new float[][] { cut,cut,cut,cut };
358
    if( mCuts==null )
359
      {
360
      float[] cut = new float[] {0.0f};
361
      mCuts = new float[][] { cut,cut,cut,cut };
362
      }
363

  
364
    return mCuts;
365
    }
366

  
367
///////////////////////////////////////////////////////////////////////////////////////////////////
368

  
369
  private void getLayerRotatable(int numLayers)
370
    {
371
    if( mLayerRotatable==null )
372
      {
373
      int numAxis = ROT_AXIS.length;
374
      boolean[] tmp = new boolean[numLayers];
375
      for(int i=0; i<numLayers; i++) tmp[i] = true;
376
      mLayerRotatable = new boolean[numAxis][];
377
      for(int i=0; i<numAxis; i++) mLayerRotatable[i] = tmp;
378
      }
358 379
    }
359 380

  
360 381
///////////////////////////////////////////////////////////////////////////////////////////////////
......
383 404

  
384 405
  public Movement getMovement()
385 406
    {
386
    if( mMovement==null ) mMovement = new MovementUltimate();
407
    if( mMovement==null )
408
      {
409
      int numLayers = getNumLayers();
410
      if( mCuts==null ) getCuts(numLayers);
411
      getLayerRotatable(numLayers);
412

  
413
      mMovement = new MovementUltimate(mCuts,mLayerRotatable,numLayers);
414
      }
387 415
    return mMovement;
388 416
    }
389 417

  

Also available in: Unified diff