Project

General

Profile

« Previous | Next » 

Revision 0021af58

Added by Leszek Koltunski over 2 years ago

Convert Square-2 to the new generic scrambling algorithm.

In order to do it we need to introduce a third, artificial rotational axis - otherwise the algorithm would make it impossible to rotate the lower layer and immediatelly after - the upper.

View differences:

src/main/java/org/distorted/objects/TwistySquare.java
40 40
  static final float SIN15 = (SQ6-SQ2)/4;
41 41
  static final float     X = 3*(2-SQ3)/2;
42 42

  
43
  // The third, artificial axis is for the generic scrambling algorithm.
44
  // Otherwise it wouldn't be possible to rotate the LO and UP layers
45
  // consecutively.
46

  
43 47
  static final Static3D[] ROT_AXIS = new Static3D[]
44 48
    {
45
      new Static3D(0,1,0),
46
      new Static3D(COS15,0,SIN15)
49
      new Static3D(0,+1,0),
50
      new Static3D(COS15,0,SIN15),
51
      new Static3D(0,-1,0),
47 52
    };
48 53

  
49
  static final int[] BASIC_ANGLE = new int[] { 12,2 };
54
  static final int[] BASIC_ANGLE = new int[] { 12,2,12 };
50 55

  
51 56
  static final int[] FACE_COLORS = new int[]
52 57
    {
......
210 215

  
211 216
  float[][] getCuts(int numLayers)
212 217
    {
213
    return new float[][] { {-0.5f,+0.5f}, {0.0f} };
218
    return new float[][] { {-0.5f,+0.5f}, {0.0f}, {-0.5f,+0.5f} };
214 219
    }
215 220

  
216 221
///////////////////////////////////////////////////////////////////////////////////////////////////

Also available in: Unified diff