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/TwistyIvy.java
50 50
  private ScrambleState[] mStates;
51 51
  private int[] mBasicAngle;
52 52
  private Static4D[] mQuats;
53
  private float[][] mCuts;
54
  private boolean[][] mLayerRotatable;
53 55
  private int[][] mFaceMap;
54 56
  private ObjectSticker[] mStickers;
55 57
  private Movement mMovement;
......
136 138

  
137 139
  float[][] getCuts(int numLayers)
138 140
    {
139
    float[] cut = new float[] {0.0f};
140
    return new float[][] { cut,cut,cut,cut };
141
    if( mCuts==null )
142
      {
143
      float[] cut = new float[] {0.0f};
144
      mCuts = new float[][] { cut,cut,cut,cut };
145
      }
146

  
147
    return mCuts;
148
    }
149

  
150
///////////////////////////////////////////////////////////////////////////////////////////////////
151

  
152
  private void getLayerRotatable(int numLayers)
153
    {
154
    if( mLayerRotatable==null )
155
      {
156
      int numAxis = ROT_AXIS.length;
157
      boolean[] tmp = new boolean[numLayers];
158
      for(int i=0; i<numLayers; i++) tmp[i] = true;
159
      mLayerRotatable = new boolean[numAxis][];
160
      for(int i=0; i<numAxis; i++) mLayerRotatable[i] = tmp;
161
      }
141 162
    }
142 163

  
143 164
///////////////////////////////////////////////////////////////////////////////////////////////////
......
420 441

  
421 442
  public Movement getMovement()
422 443
    {
423
    if( mMovement==null ) mMovement = new MovementIvy();
444
    if( mMovement==null )
445
      {
446
      int numLayers = getNumLayers();
447
      if( mCuts==null ) getCuts(numLayers);
448
      getLayerRotatable(numLayers);
449

  
450
      mMovement = new MovementIvy(mCuts,mLayerRotatable,numLayers);
451
      }
424 452
    return mMovement;
425 453
    }
426 454

  

Also available in: Unified diff