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/TwistyRedi.java
46 46
  private ScrambleState[] mStates;
47 47
  private int[] mBasicAngle;
48 48
  private Static4D[] mQuats;
49
  private float[][] mCuts;
50
  private boolean[][] mLayerRotatable;
49 51
  private float[][] mCenters;
50 52
  private int[][] mFaceMap;
51 53
  private ObjectSticker[] mStickers;
......
139 141

  
140 142
  float[][] getCuts(int size)
141 143
    {
142
    float C = +SQ3/3 +0.05f;
143
    float[] cut = new float[] {-C,+C};
144
    return new float[][] { cut,cut,cut,cut };
144
    if( mCuts==null )
145
      {
146
      float C = +SQ3/3 +0.05f;
147
      float[] cut = new float[] {-C,+C};
148
      mCuts = new float[][] { cut,cut,cut,cut };
149
      }
150

  
151
    return mCuts;
152
    }
153

  
154
///////////////////////////////////////////////////////////////////////////////////////////////////
155

  
156
  private void getLayerRotatable(int numLayers)
157
    {
158
    if( mLayerRotatable==null )
159
      {
160
      int numAxis = ROT_AXIS.length;
161
      boolean[] tmp = new boolean[] {true,false,true};
162
      mLayerRotatable = new boolean[numAxis][];
163
      for(int i=0; i<numAxis; i++) mLayerRotatable[i] = tmp;
164
      }
145 165
    }
146 166

  
147 167
///////////////////////////////////////////////////////////////////////////////////////////////////
......
391 411

  
392 412
  public Movement getMovement()
393 413
    {
394
    if( mMovement==null ) mMovement = new MovementCornerTwisting();
414
    if( mMovement==null )
415
      {
416
      int numLayers = getNumLayers();
417
      if( mCuts==null ) getCuts(numLayers);
418
      getLayerRotatable(numLayers);
419

  
420
      mMovement = new MovementCornerTwisting(mCuts,mLayerRotatable,numLayers);
421
      }
395 422
    return mMovement;
396 423
    }
397 424

  

Also available in: Unified diff