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/TwistyHelicopter.java
49 49
  private ScrambleState[] mStates;
50 50
  private int[] mBasicAngle;
51 51
  private Static4D[] mQuats;
52
  private float[][] mCuts;
53
  private boolean[][] mLayerRotatable;
52 54
  private float[][] mCenters;
53 55
  private int[] mQuatIndices;
54 56
  private int[][] mFaceMap;
......
160 162

  
161 163
  float[][] getCuts(int size)
162 164
    {
163
    float[] cut = new float[] { -3*SQ2/4, +3*SQ2/4 };
164
    return new float[][] { cut,cut,cut,cut,cut,cut };
165
    if( mCuts==null )
166
      {
167
      float[] cut = new float[] { -3*SQ2/4, +3*SQ2/4 };
168
      mCuts = new float[][] { cut,cut,cut,cut,cut,cut };
169
      }
170

  
171
    return mCuts;
172
    }
173

  
174
///////////////////////////////////////////////////////////////////////////////////////////////////
175

  
176
  private void getLayerRotatable(int numLayers)
177
    {
178
    if( mLayerRotatable==null )
179
      {
180
      int numAxis = ROT_AXIS.length;
181
      boolean[] tmp = new boolean[] {true,false,true};
182
      mLayerRotatable = new boolean[numAxis][];
183
      for(int i=0; i<numAxis; i++) mLayerRotatable[i] = tmp;
184
      }
165 185
    }
166 186

  
167 187
///////////////////////////////////////////////////////////////////////////////////////////////////
......
394 414

  
395 415
  public Movement getMovement()
396 416
    {
397
    if( mMovement==null ) mMovement = new MovementHelicopter();
417
    if( mMovement==null )
418
      {
419
      int numLayers = getNumLayers();
420
      if( mCuts==null ) getCuts(numLayers);
421
      getLayerRotatable(numLayers);
422

  
423
      mMovement = new MovementHelicopter(mCuts,mLayerRotatable,numLayers);
424
      }
398 425
    return mMovement;
399 426
    }
400 427

  

Also available in: Unified diff