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/TwistySkewb.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 int[][] mCornerMap,mEdgeMap,mCenterMap;
50 52
  private ObjectSticker[] mStickers;
51 53
  private Movement mMovement;
......
154 156

  
155 157
  float[][] getCuts(int numLayers)
156 158
    {
157
    switch(numLayers)
159
    if( mCuts==null )
158 160
      {
159
      case 2: float[] c2 = new float[] {0.0f};
160
              return new float[][] { c2,c2,c2,c2 };
161
      case 3: float[] c3 = new float[] {-SQ3/6,+SQ3/6};
162
              return new float[][] { c3,c3,c3,c3 };
161
      float[] c = numLayers==2 ? (new float[] {0.0f}) : (new float[] {-SQ3/6,+SQ3/6});
162
      mCuts = new float[][] {c,c,c,c};
163
      }
164

  
165
    return mCuts;
166
    }
167

  
168
///////////////////////////////////////////////////////////////////////////////////////////////////
169

  
170
  private void getLayerRotatable(int numLayers)
171
    {
172
    if( mLayerRotatable==null )
173
      {
174
      int numAxis = ROT_AXIS.length;
175
      boolean[] tmp = numLayers==2 ? (new boolean[] {true,true}) : (new boolean[] {true,false,true});
176
      mLayerRotatable = new boolean[numAxis][];
177
      for(int i=0; i<numAxis; i++) mLayerRotatable[i] = tmp;
163 178
      }
164
    return null;
165 179
    }
166 180

  
167 181
///////////////////////////////////////////////////////////////////////////////////////////////////
......
533 547

  
534 548
  public Movement getMovement()
535 549
    {
536
    if( mMovement==null ) mMovement = new MovementCornerTwisting();
550
    if( mMovement==null )
551
      {
552
      int numLayers = getNumLayers();
553
      if( mCuts==null ) getCuts(numLayers);
554
      getLayerRotatable(numLayers);
555

  
556
      mMovement = new MovementCornerTwisting(mCuts,mLayerRotatable,numLayers);
557
      }
537 558
    return mMovement;
538 559
    }
539 560

  

Also available in: Unified diff