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/TwistyDino.java
45 45

  
46 46
  private int[] mBasicAngle;
47 47
  private Static4D[] mQuats;
48
  private float[][] mCuts;
49
  private boolean[][] mLayerRotatable;
48 50
  private ObjectSticker[] mStickers;
49 51
  private float[][] mCenters;
50 52
  private Movement mMovement;
......
91 93

  
92 94
  float[][] getCuts(int size)
93 95
    {
94
    float[] cut = new float[] { -SQ3/3, +SQ3/3 };
95
    return new float[][] { cut,cut,cut,cut };
96
    if( mCuts==null )
97
      {
98
      float[] cut = new float[] { -SQ3/3, +SQ3/3 };
99
      mCuts = new float[][] { cut,cut,cut,cut };
100
      }
101

  
102
    return mCuts;
103
    }
104

  
105
///////////////////////////////////////////////////////////////////////////////////////////////////
106

  
107
  private void getLayerRotatable(int numLayers)
108
    {
109
    if( mLayerRotatable==null )
110
      {
111
      int numAxis = ROT_AXIS.length;
112
      boolean[] tmp = new boolean[] {true,false,true};
113
      mLayerRotatable = new boolean[numAxis][];
114
      for(int i=0; i<numAxis; i++) mLayerRotatable[i] = tmp;
115
      }
96 116
    }
97 117

  
98 118
///////////////////////////////////////////////////////////////////////////////////////////////////
......
201 221

  
202 222
  public Movement getMovement()
203 223
    {
204
    if( mMovement==null ) mMovement = new MovementCornerTwisting();
224
    if( mMovement==null )
225
      {
226
      int numLayers = getNumLayers();
227
      if( mCuts==null ) getCuts(numLayers);
228
      getLayerRotatable(numLayers);
229

  
230
      mMovement = new MovementCornerTwisting(mCuts,mLayerRotatable,numLayers);
231
      }
205 232
    return mMovement;
206 233
    }
207 234

  

Also available in: Unified diff