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/MovementCube.java
23 23

  
24 24
class MovementCube extends Movement6
25 25
{
26
  MovementCube()
27
    {
28
    super(TwistyCube.ROT_AXIS);
29
    }
26
  private static final int[][][] ENABLED = new int[][][]
27
      {
28
          {{2,1,2}},{{2,1,2}},{{2,0,2}},{{2,0,2}},{{2,0,1}},{{2,0,1}},
29
      };
30 30

  
31 31
///////////////////////////////////////////////////////////////////////////////////////////////////
32 32

  
33
  int computeRowFromOffset(int face, int axisIndex, int numLayers, float offset)
33
  MovementCube(float[][] cuts, boolean[][] rotatable, int numLayers)
34 34
    {
35
    return (int)(numLayers*(offset+DIST2D));
35
    super(TwistyCube.ROT_AXIS,cuts,rotatable,numLayers);
36 36
    }
37 37

  
38 38
///////////////////////////////////////////////////////////////////////////////////////////////////
39 39

  
40 40
  void computeEnabledAxis(int face, float[] touchPoint, int[] enabled)
41 41
    {
42
    enabled[0] = 2;
43

  
44
    switch(face/2)
45
      {
46
      case 0: enabled[1]=1; enabled[2]=2; break;
47
      case 1: enabled[1]=0; enabled[2]=2; break;
48
      case 2: enabled[1]=0; enabled[2]=1; break;
49
      }
42
    enabled[0] = ENABLED[face][0][0];
43
    enabled[1] = ENABLED[face][0][1];
44
    enabled[2] = ENABLED[face][0][2];
50 45
    }
51 46
}

Also available in: Unified diff