Project

General

Profile

« Previous | Next » 

Revision 967c1d17

Added by Leszek Koltunski over 2 years ago

Do away with the last method in the object Movement classes. Remove the object Movement classes altogether.
From now on the implementation of a TwistyPuzzle is 100% data, no code at all.
Next step: make the implementation a (generated?) (XML?) file.

View differences:

src/main/java/org/distorted/objects/Movement.java
27 27

  
28 28
public abstract class Movement
29 29
  {
30
  // it doesn't matter where we touch a face - the list of enabled rotAxis will always be the same
31
  static final int TYPE_NOT_SPLIT    = 0;
32
  // each face is split into several parts by lines coming from its center to the midpoints of each edge
33
  static final int TYPE_SPLIT_EDGE   = 1;
34
  // each face is split into several parts by lines coming from its center to the vertices
35
  static final int TYPE_SPLIT_CORNER = 2;
36

  
30 37
  static final float SQ3 = (float)Math.sqrt(3);
31 38
  static final float SQ6 = (float)Math.sqrt(6);
32 39

  
......
42 49
  private Static4D[][] mCastedRotAxis4D;
43 50
  private float[][] mTouchBorders, mA, mB;
44 51

  
52
  private final int mType;
53
  private final int[] mNumEnabled;
54
  private final int[][][] mEnabled;
55

  
45 56
///////////////////////////////////////////////////////////////////////////////////////////////////
46 57

  
58
  abstract int returnPart(int type, int face, float[] touchPoint);
47 59
  abstract boolean isInsideFace(int face, float[] point);
48
  abstract void computeEnabledAxis(int face, float[] touchPoint, int[] enabledAxis);
49 60
  public abstract float returnRotationFactor(int numLayers, int row);
50 61

  
51 62
///////////////////////////////////////////////////////////////////////////////////////////////////
52 63

  
53
  Movement(Static3D[] rotAxis, Static3D[] faceAxis, float[][] cuts, boolean[][] rotatable, float distance3D, int size)
64
  Movement(Static3D[] rotAxis, Static3D[] faceAxis, float[][] cuts, boolean[][] rotatable,
65
           float distance3D, int size, int type, int[] numEnabled, int[][][] enabled)
54 66
    {
55 67
    mPoint = new float[3];
56 68
    mCamera= new float[3];
......
59 71
    mPoint2D = new float[2];
60 72
    mMove2D  = new float[2];
61 73

  
74
    mType = type;
75
    mNumEnabled = numEnabled;
76
    mEnabled = enabled;
77

  
62 78
    mFaceAxis   = faceAxis;
63 79
    mNumFaceAxis= mFaceAxis.length;
64 80

  
......
380 396
    return len;
381 397
    }
382 398

  
399
///////////////////////////////////////////////////////////////////////////////////////////////////
400

  
401
  void computeEnabledAxis(int face, float[] touchPoint, int[] enabled)
402
    {
403
    int part = returnPart(mType,face,touchPoint);
404

  
405
    int num = mNumEnabled[face];
406
    enabled[0] = num;
407
    System.arraycopy(mEnabled[face][part], 0, enabled, 1, num);
408
    }
409

  
383 410
///////////////////////////////////////////////////////////////////////////////////////////////////
384 411
// PUBLIC API
385 412
///////////////////////////////////////////////////////////////////////////////////////////////////
src/main/java/org/distorted/objects/Movement12.java
30 30
///////////////////////////////////////////////////////////////////////////////////////////////////
31 31
// Dodecahedral objects: map the 2D swipes of user's fingers to 3D rotations
32 32

  
33
abstract class Movement12 extends Movement
33
class Movement12 extends Movement
34 34
{
35 35
  static final float DIST3D = (float)Math.sqrt(0.625f+0.275f*SQ5);
36 36
  static final float DIST2D = (SIN54/COS54)/2;
......
53 53

  
54 54
///////////////////////////////////////////////////////////////////////////////////////////////////
55 55

  
56
  Movement12(Static3D[] rotAxis,float[][] cuts, boolean[][] rotatable, int size)
56
  Movement12(Static3D[] rotAxis,float[][] cuts, boolean[][] rotatable, int size, int type, int[] numEnabled, int[][][] enabled)
57 57
    {
58
    super(rotAxis, FACE_AXIS, cuts,rotatable,DIST3D, size);
58
    super(rotAxis, FACE_AXIS, cuts,rotatable,DIST3D, size, type, numEnabled, enabled);
59 59
    }
60 60

  
61 61
///////////////////////////////////////////////////////////////////////////////////////////////////
......
111 111
    }
112 112

  
113 113
///////////////////////////////////////////////////////////////////////////////////////////////////
114
// Return 1,2,3,4,5 - the vertex of the pentagon to which point 'point' is the closest, if the
115
// 'point' is inside the pentagon - or 0 otherwise.
114

  
115
  int returnPart(int type, int face, float[] point)
116
    {
117
    switch(type)
118
      {
119
      case TYPE_SPLIT_EDGE  : return partEdge(point,face);
120
      case TYPE_SPLIT_CORNER: return partCorner(point,face);
121
      default               : return 0;
122
      }
123
    }
124

  
125
///////////////////////////////////////////////////////////////////////////////////////////////////
126
// Return 0,1,2,3,4 - the vertex of the pentagon to which point 'point' is the closest, if the
127
// 'point' is inside the pentagon - or -1 otherwise.
116 128
// The 'first' vertex is the one we meet the first when we rotate clockwise starting from 12:00.
117 129
// This vertex makes angle 'returnAngle()' with the line coming out upwards from the center of the
118 130
// pentagon.
119 131
// Distance from the center to a vertex of the pentagon = 1/(6*COS54)
120 132

  
121
  int returnPartOfThePentagon(float[] point, int face)
133
  int partEdge(float[] point, int face)
122 134
    {
123 135
    float angle = returnAngle(face);
124 136
    float A = (float)(Math.PI/5);
125 137

  
126 138
    for(int i=0; i<5; i++)
127 139
      {
128
      if( isOnTheLeft(point, DIST2D, (9-2*i)*A-angle) ) return 0;
140
      if( isOnTheLeft(point, DIST2D, (9-2*i)*A-angle) ) return -1;
129 141
      }
130 142

  
131 143
    if( isOnTheLeft(point, 0, 2.5f*A-angle) )
132 144
      {
133 145
      if( isOnTheLeft(point, 0, 3.5f*A-angle) )
134 146
        {
135
        return isOnTheLeft(point, 0, 5.5f*A-angle) ? 4 : 5;
147
        return isOnTheLeft(point, 0, 5.5f*A-angle) ? 3 : 4;
136 148
        }
137
      else return 1;
149
      else return 0;
138 150
      }
139 151
    else
140 152
      {
141 153
      if( isOnTheLeft(point, 0, 4.5f*A-angle) )
142 154
        {
143
        return 3;
155
        return 2;
144 156
        }
145 157
      else
146 158
        {
147
        return isOnTheLeft(point, 0, 6.5f*A-angle) ? 2 : 1;
159
        return isOnTheLeft(point, 0, 6.5f*A-angle) ? 1 : 0;
148 160
        }
149 161
      }
150 162
    }
151 163

  
164
///////////////////////////////////////////////////////////////////////////////////////////////////
165
// TODO - no such object yet
166

  
167
  int partCorner(float[] point, int face)
168
    {
169
    return 0;
170
    }
171

  
152 172
///////////////////////////////////////////////////////////////////////////////////////////////////
153 173

  
154 174
  boolean isInsideFace(int face, float[] p)
155 175
    {
156
    return returnPartOfThePentagon(p,face) > 0;
176
    float angle = returnAngle(face);
177
    float A = (float)(Math.PI/5);
178

  
179
    for(int i=0; i<5; i++)
180
      {
181
      if( isOnTheLeft(p, DIST2D, (9-2*i)*A-angle) ) return false;
182
      }
183

  
184
    return true;
157 185
    }
158 186
}
src/main/java/org/distorted/objects/Movement4.java
19 19

  
20 20
package org.distorted.objects;
21 21

  
22
import static org.distorted.objects.TwistyObject.SQ2;
23

  
24 22
import org.distorted.library.type.Static3D;
25 23

  
26 24
///////////////////////////////////////////////////////////////////////////////////////////////////
27 25
// Tetrahedral objects: map the 2D swipes of user's fingers to 3D rotations
28 26

  
29
abstract class Movement4 extends Movement
27
class Movement4 extends Movement
30 28
{
31 29
  static final float DIST3D = SQ6/12;
32 30
  static final float DIST2D = SQ3/6;
......
41 39

  
42 40
///////////////////////////////////////////////////////////////////////////////////////////////////
43 41

  
44
  Movement4(Static3D[] rotAxis,float[][] cuts, boolean[][] rotatable, int size)
42
  Movement4(Static3D[] rotAxis,float[][] cuts, boolean[][] rotatable, int size, int type, int[] numEnabled, int[][][] enabled)
45 43
    {
46
    super(rotAxis, FACE_AXIS, cuts, rotatable, DIST3D, size);
44
    super(rotAxis, FACE_AXIS, cuts, rotatable, DIST3D, size, type, numEnabled, enabled);
45
    }
46

  
47
///////////////////////////////////////////////////////////////////////////////////////////////////
48
// corner    edge
49
//   |       \ 0 /
50
// 2 | 0      \ /
51
//  / \      2 | 1
52
// / 1 \       |
53

  
54
  int returnPart(int type, int face, float[] touchPoint)
55
    {
56
    switch(type)
57
      {
58
      case TYPE_NOT_SPLIT   : return 0;
59

  
60
      case TYPE_SPLIT_EDGE  : float y1 = (face > 1 ? touchPoint[1] : -touchPoint[1]);
61
                              float x1 = touchPoint[0];
62

  
63
                              boolean e0 = x1>0;
64
                              boolean e1 = y1>(+SQ3/3)*x1;
65
                              boolean e2 = y1>(-SQ3/3)*x1;
66

  
67
                              if(  e1 && e2 ) return 0;
68
                              if( !e1 && e0 ) return 1;
69
                              if( !e0 &&!e2 ) return 2;
70

  
71
      case TYPE_SPLIT_CORNER: float y2 = (face > 1 ? touchPoint[1] : -touchPoint[1]);
72
                              float x2 = touchPoint[0];
73

  
74
                              boolean c0 = x2>0;
75
                              boolean c1 = y2>(+SQ3/3)*x2;
76
                              boolean c2 = y2>(-SQ3/3)*x2;
77

  
78
                              if(  c0 && c2 ) return 0;
79
                              if( !c1 &&!c2 ) return 1;
80
                              if( !c0 && c1 ) return 2;
81
      }
82

  
83
    return 0;
47 84
    }
48 85

  
49 86
///////////////////////////////////////////////////////////////////////////////////////////////////
src/main/java/org/distorted/objects/Movement6.java
19 19

  
20 20
package org.distorted.objects;
21 21

  
22
import static org.distorted.objects.TwistyObject.SQ2;
23

  
24 22
import org.distorted.library.type.Static3D;
25 23

  
26 24
///////////////////////////////////////////////////////////////////////////////////////////////////
27 25
// Hexahedral objects: map the 2D swipes of user's fingers to 3D rotations
28 26

  
29
abstract class Movement6 extends Movement
27
class Movement6 extends Movement
30 28
{
31 29
  static final float DIST3D = 0.5f;
32 30
  static final float DIST2D = 0.5f;
......
40 38

  
41 39
///////////////////////////////////////////////////////////////////////////////////////////////////
42 40

  
43
  Movement6(Static3D[] rotAxis,float[][] cuts, boolean[][] rotatable, int size)
41
  Movement6(Static3D[] rotAxis,float[][] cuts, boolean[][] rotatable, int size, int type, int[] numEnabled, int[][][] enabled)
44 42
    {
45
    super(rotAxis, FACE_AXIS, cuts, rotatable, DIST3D, size);
43
    super(rotAxis, FACE_AXIS, cuts, rotatable, DIST3D, size, type, numEnabled, enabled);
44
    }
45

  
46
///////////////////////////////////////////////////////////////////////////////////////////////////
47
//  corner    edge
48
//  \ 0 /     3 | 0
49
// 3 \ / 1  ___ | ___
50
//   / \        |
51
//  / 2 \     2 | 1
52

  
53
  int returnPart(int type, int face, float[] touchPoint)
54
    {
55
    switch(type)
56
      {
57
      case TYPE_NOT_SPLIT   : return 0;
58
      case TYPE_SPLIT_EDGE  : boolean e0 = touchPoint[0] > 0;
59
                              boolean e1 = touchPoint[1] > 0;
60
                              return e0 ? (e1 ? 0:1) : (e1 ? 3:2);
61
      case TYPE_SPLIT_CORNER: boolean c0 = touchPoint[1] >= touchPoint[0];
62
                              boolean c1 = touchPoint[1] >=-touchPoint[0];
63
                              return c0 ? (c1 ? 0:3) : (c1 ? 1:2);
64
      }
65

  
66
    return 0;
46 67
    }
47 68

  
48 69
///////////////////////////////////////////////////////////////////////////////////////////////////
src/main/java/org/distorted/objects/Movement8.java
19 19

  
20 20
package org.distorted.objects;
21 21

  
22
import static org.distorted.objects.TwistyObject.SQ2;
23

  
24 22
import org.distorted.library.type.Static3D;
25 23

  
26 24
///////////////////////////////////////////////////////////////////////////////////////////////////
27 25
// Octahedral objects: map the 2D swipes of user's fingers to 3D rotations
28 26

  
29
abstract class Movement8 extends Movement
27
class Movement8 extends Movement
30 28
{
31 29
  static final float DIST3D = SQ6/6;
32 30
  static final float DIST2D = SQ3/6;
......
41 39

  
42 40
///////////////////////////////////////////////////////////////////////////////////////////////////
43 41

  
44
  Movement8(Static3D[] rotAxis,float[][] cuts, boolean[][] rotatable, int size)
42
  Movement8(Static3D[] rotAxis,float[][] cuts, boolean[][] rotatable, int size, int type, int[] numEnabled, int[][][] enabled)
45 43
    {
46
    super(rotAxis, FACE_AXIS, cuts, rotatable, DIST3D, size);
44
    super(rotAxis, FACE_AXIS, cuts, rotatable, DIST3D, size, type, numEnabled, enabled);
45
    }
46

  
47
///////////////////////////////////////////////////////////////////////////////////////////////////
48
// corner    edge
49
//   |       \ 0 /
50
// 2 | 0      \ /
51
//  / \      2 | 1
52
// / 1 \       |
53

  
54
  int returnPart(int type, int face, float[] touchPoint)
55
    {
56
    switch(type)
57
      {
58
      case TYPE_NOT_SPLIT   : return 0;
59

  
60
      case TYPE_SPLIT_EDGE  : float y1 = (face%2 == 0 ? touchPoint[1] : -touchPoint[1]);
61
                              float x1 = touchPoint[0];
62

  
63
                              boolean e0 = x1>0;
64
                              boolean e1 = y1>(+SQ3/3)*x1;
65
                              boolean e2 = y1>(-SQ3/3)*x1;
66

  
67
                              if(  e1 && e2 ) return 0;
68
                              if( !e1 && e0 ) return 1;
69
                              if( !e0 &&!e2 ) return 2;
70

  
71
      case TYPE_SPLIT_CORNER: float y2 = (face%2 == 0 ? touchPoint[1] : -touchPoint[1]);
72
                              float x2 = touchPoint[0];
73

  
74
                              boolean c0 = x2>0;
75
                              boolean c1 = y2>(+SQ3/3)*x2;
76
                              boolean c2 = y2>(-SQ3/3)*x2;
77

  
78
                              if(  c0 && c2 ) return 0;
79
                              if( !c1 &&!c2 ) return 1;
80
                              if( !c0 && c1 ) return 2;
81
      }
82

  
83
    return 0;
47 84
    }
48 85

  
49 86
///////////////////////////////////////////////////////////////////////////////////////////////////
src/main/java/org/distorted/objects/MovementCornerTwisting.java
1
///////////////////////////////////////////////////////////////////////////////////////////////////
2
// Copyright 2020 Leszek Koltunski                                                               //
3
//                                                                                               //
4
// This file is part of Magic Cube.                                                              //
5
//                                                                                               //
6
// Magic Cube is free software: you can redistribute it and/or modify                            //
7
// it under the terms of the GNU General Public License as published by                          //
8
// the Free Software Foundation, either version 2 of the License, or                             //
9
// (at your option) any later version.                                                           //
10
//                                                                                               //
11
// Magic Cube is distributed in the hope that it will be useful,                                 //
12
// but WITHOUT ANY WARRANTY; without even the implied warranty of                                //
13
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the                                 //
14
// GNU General Public License for more details.                                                  //
15
//                                                                                               //
16
// You should have received a copy of the GNU General Public License                             //
17
// along with Magic Cube.  If not, see <http://www.gnu.org/licenses/>.                           //
18
///////////////////////////////////////////////////////////////////////////////////////////////////
19

  
20
package org.distorted.objects;
21

  
22
///////////////////////////////////////////////////////////////////////////////////////////////////
23

  
24
class MovementCornerTwisting extends Movement6
25
{
26
  private static final int[] NUM_ENABLED = {2,2,2,2,2,2};
27

  
28
  private static final int[][][] ENABLED = new int[][][]
29
      {
30
          {{0,1},{3,1},{2,3},{0,2}},
31
          {{2,3},{3,1},{0,1},{0,2}},
32
          {{1,2},{0,1},{0,3},{2,3}},
33
          {{1,2},{2,3},{0,3},{0,1}},
34
          {{0,3},{0,2},{1,2},{1,3}},
35
          {{1,2},{0,2},{0,3},{1,3}},
36
      };
37

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

  
40
  MovementCornerTwisting(float[][] cuts, boolean[][] rotatable,int size)
41
    {
42
    super(TwistySkewb.ROT_AXIS,cuts,rotatable,size);
43
    }
44

  
45
///////////////////////////////////////////////////////////////////////////////////////////////////
46

  
47
  void computeEnabledAxis(int face, float[] touchPoint, int[] enabled)
48
    {
49
    boolean p0 = touchPoint[1] >= touchPoint[0];
50
    boolean p1 = touchPoint[1] >=-touchPoint[0];
51
    int part = p0 ? (p1 ? 0:3) : (p1 ? 1:2);
52

  
53
    int num = NUM_ENABLED[face];
54
    enabled[0] = num;
55
    System.arraycopy(ENABLED[face][part], 0, enabled, 1, num);
56
    }
57
}
58

  
src/main/java/org/distorted/objects/MovementCube.java
1
///////////////////////////////////////////////////////////////////////////////////////////////////
2
// Copyright 2020 Leszek Koltunski                                                               //
3
//                                                                                               //
4
// This file is part of Magic Cube.                                                              //
5
//                                                                                               //
6
// Magic Cube is free software: you can redistribute it and/or modify                            //
7
// it under the terms of the GNU General Public License as published by                          //
8
// the Free Software Foundation, either version 2 of the License, or                             //
9
// (at your option) any later version.                                                           //
10
//                                                                                               //
11
// Magic Cube is distributed in the hope that it will be useful,                                 //
12
// but WITHOUT ANY WARRANTY; without even the implied warranty of                                //
13
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the                                 //
14
// GNU General Public License for more details.                                                  //
15
//                                                                                               //
16
// You should have received a copy of the GNU General Public License                             //
17
// along with Magic Cube.  If not, see <http://www.gnu.org/licenses/>.                           //
18
///////////////////////////////////////////////////////////////////////////////////////////////////
19

  
20
package org.distorted.objects;
21

  
22
///////////////////////////////////////////////////////////////////////////////////////////////////
23

  
24
class MovementCube extends Movement6
25
{
26
  private static final int[] NUM_ENABLED = {2,2,2,2,2,2};
27

  
28
  private static final int[][][] ENABLED = new int[][][]
29
      {
30
          {{1,2}},{{1,2}},{{0,2}},{{0,2}},{{0,1}},{{0,1}},
31
      };
32

  
33
///////////////////////////////////////////////////////////////////////////////////////////////////
34

  
35
  MovementCube(float[][] cuts, boolean[][] rotatable, int size)
36
    {
37
    super(TwistyCube.ROT_AXIS,cuts,rotatable,size);
38
    }
39

  
40
///////////////////////////////////////////////////////////////////////////////////////////////////
41

  
42
  void computeEnabledAxis(int face, float[] touchPoint, int[] enabled)
43
    {
44
    int num = NUM_ENABLED[face];
45
    enabled[0] = num;
46
    System.arraycopy(ENABLED[face][0], 0, enabled, 1, num);
47
    }
48
}
src/main/java/org/distorted/objects/MovementDiamond.java
1
///////////////////////////////////////////////////////////////////////////////////////////////////
2
// Copyright 2020 Leszek Koltunski                                                               //
3
//                                                                                               //
4
// This file is part of Magic Cube.                                                              //
5
//                                                                                               //
6
// Magic Cube is free software: you can redistribute it and/or modify                            //
7
// it under the terms of the GNU General Public License as published by                          //
8
// the Free Software Foundation, either version 2 of the License, or                             //
9
// (at your option) any later version.                                                           //
10
//                                                                                               //
11
// Magic Cube is distributed in the hope that it will be useful,                                 //
12
// but WITHOUT ANY WARRANTY; without even the implied warranty of                                //
13
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the                                 //
14
// GNU General Public License for more details.                                                  //
15
//                                                                                               //
16
// You should have received a copy of the GNU General Public License                             //
17
// along with Magic Cube.  If not, see <http://www.gnu.org/licenses/>.                           //
18
///////////////////////////////////////////////////////////////////////////////////////////////////
19

  
20
package org.distorted.objects;
21

  
22
///////////////////////////////////////////////////////////////////////////////////////////////////
23

  
24
class MovementDiamond extends Movement8
25
{
26
  private static final int[] NUM_ENABLED = {3,3,3,3,3,3,3,3};
27

  
28
  private static final int[][][] ENABLED = new int[][][]
29
      {
30
          {{1,2,3}},{{1,2,3}},{{0,2,3}},{{0,2,3}},{{0,1,3}},{{0,1,3}},{{0,1,2}},{{0,1,2}}
31
      };
32

  
33
///////////////////////////////////////////////////////////////////////////////////////////////////
34

  
35
  MovementDiamond(float[][] cuts, boolean[][] rotatable, int size)
36
    {
37
    super(TwistyDiamond.ROT_AXIS,cuts,rotatable,size);
38
    }
39

  
40
///////////////////////////////////////////////////////////////////////////////////////////////////
41

  
42
  void computeEnabledAxis(int face, float[] touchPoint, int[] enabled)
43
    {
44
    int num = NUM_ENABLED[face];
45
    enabled[0] = num;
46
    System.arraycopy(ENABLED[face][0], 0, enabled, 1, num);
47
    }
48
}
src/main/java/org/distorted/objects/MovementHelicopter.java
1
///////////////////////////////////////////////////////////////////////////////////////////////////
2
// Copyright 2020 Leszek Koltunski                                                               //
3
//                                                                                               //
4
// This file is part of Magic Cube.                                                              //
5
//                                                                                               //
6
// Magic Cube is free software: you can redistribute it and/or modify                            //
7
// it under the terms of the GNU General Public License as published by                          //
8
// the Free Software Foundation, either version 2 of the License, or                             //
9
// (at your option) any later version.                                                           //
10
//                                                                                               //
11
// Magic Cube is distributed in the hope that it will be useful,                                 //
12
// but WITHOUT ANY WARRANTY; without even the implied warranty of                                //
13
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the                                 //
14
// GNU General Public License for more details.                                                  //
15
//                                                                                               //
16
// You should have received a copy of the GNU General Public License                             //
17
// along with Magic Cube.  If not, see <http://www.gnu.org/licenses/>.                           //
18
///////////////////////////////////////////////////////////////////////////////////////////////////
19

  
20
package org.distorted.objects;
21

  
22
///////////////////////////////////////////////////////////////////////////////////////////////////
23

  
24
class MovementHelicopter extends Movement6
25
{
26
  private static final int[] NUM_ENABLED = {2,2,2,2,2,2};
27

  
28
  private static final int[][][] ENABLED = new int[][][]
29
      {
30
          {{2,5},{2,4},{3,4},{3,5}},
31
          {{2,4},{2,5},{3,5},{3,4}},
32
          {{0,5},{1,5},{1,4},{0,4}},
33
          {{0,4},{1,4},{1,5},{0,5}},
34
          {{1,3},{0,3},{0,2},{1,2}},
35
          {{0,3},{1,3},{1,2},{0,2}},
36
      };
37

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

  
40
  MovementHelicopter(float[][] cuts, boolean[][] rotatable, int size)
41
    {
42
    super(TwistyHelicopter.ROT_AXIS,cuts,rotatable,size);
43
    }
44

  
45
///////////////////////////////////////////////////////////////////////////////////////////////////
46

  
47
  void computeEnabledAxis(int face, float[] touchPoint, int[] enabled)
48
    {
49
    boolean p0 = touchPoint[0] > 0;
50
    boolean p1 = touchPoint[1] > 0;
51
    int part = p0 ? (p1 ? 0:1) : (p1 ? 3:2);
52

  
53
    int num = NUM_ENABLED[face];
54
    enabled[0] = num;
55
    System.arraycopy(ENABLED[face][part], 0, enabled, 1, num);
56
    }
57
}
src/main/java/org/distorted/objects/MovementIvy.java
1
///////////////////////////////////////////////////////////////////////////////////////////////////
2
// Copyright 2020 Leszek Koltunski                                                               //
3
//                                                                                               //
4
// This file is part of Magic Cube.                                                              //
5
//                                                                                               //
6
// Magic Cube is free software: you can redistribute it and/or modify                            //
7
// it under the terms of the GNU General Public License as published by                          //
8
// the Free Software Foundation, either version 2 of the License, or                             //
9
// (at your option) any later version.                                                           //
10
//                                                                                               //
11
// Magic Cube is distributed in the hope that it will be useful,                                 //
12
// but WITHOUT ANY WARRANTY; without even the implied warranty of                                //
13
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the                                 //
14
// GNU General Public License for more details.                                                  //
15
//                                                                                               //
16
// You should have received a copy of the GNU General Public License                             //
17
// along with Magic Cube.  If not, see <http://www.gnu.org/licenses/>.                           //
18
///////////////////////////////////////////////////////////////////////////////////////////////////
19

  
20
package org.distorted.objects;
21

  
22
///////////////////////////////////////////////////////////////////////////////////////////////////
23

  
24
class MovementIvy extends Movement6
25
{
26
  private static final int[] NUM_ENABLED = {1,1,1,1,1,1};
27

  
28
  private static final int[][][] ENABLED = new int[][][]
29
      {
30
          {{0},{3},{3},{0}},
31
          {{2},{1},{1},{2}},
32
          {{2},{0},{0},{2}},
33
          {{1},{3},{3},{1}},
34
          {{0},{0},{1},{1}},
35
          {{2},{2},{3},{3}},
36
      };
37

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

  
40
  MovementIvy(float[][] cuts, boolean[][] rotatable, int size)
41
    {
42
    super(TwistyIvy.ROT_AXIS,cuts,rotatable,size);
43
    }
44

  
45
///////////////////////////////////////////////////////////////////////////////////////////////////
46

  
47
  void computeEnabledAxis(int face, float[] touchPoint, int[] enabled)
48
    {
49
    boolean p0 = touchPoint[1] >= touchPoint[0];
50
    boolean p1 = touchPoint[1] >=-touchPoint[0];
51
    int part = p0 ? (p1 ? 0:3) : (p1 ? 1:2);
52

  
53
    int num = NUM_ENABLED[face];
54
    enabled[0] = num;
55
    System.arraycopy(ENABLED[face][part], 0, enabled, 1, num);
56
    }
57
}
src/main/java/org/distorted/objects/MovementJing.java
1
///////////////////////////////////////////////////////////////////////////////////////////////////
2
// Copyright 2020 Leszek Koltunski                                                               //
3
//                                                                                               //
4
// This file is part of Magic Cube.                                                              //
5
//                                                                                               //
6
// Magic Cube is free software: you can redistribute it and/or modify                            //
7
// it under the terms of the GNU General Public License as published by                          //
8
// the Free Software Foundation, either version 2 of the License, or                             //
9
// (at your option) any later version.                                                           //
10
//                                                                                               //
11
// Magic Cube is distributed in the hope that it will be useful,                                 //
12
// but WITHOUT ANY WARRANTY; without even the implied warranty of                                //
13
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the                                 //
14
// GNU General Public License for more details.                                                  //
15
//                                                                                               //
16
// You should have received a copy of the GNU General Public License                             //
17
// along with Magic Cube.  If not, see <http://www.gnu.org/licenses/>.                           //
18
///////////////////////////////////////////////////////////////////////////////////////////////////
19

  
20
package org.distorted.objects;
21

  
22
///////////////////////////////////////////////////////////////////////////////////////////////////
23

  
24
class MovementJing extends Movement4
25
{
26
  private static final int[] NUM_ENABLED = {3,3,3,3};
27

  
28
  private static final int[][][] ENABLED = new int[][][]
29
      {
30
          {{1,2,3}},{{0,2,3}},{{0,1,3}},{{0,1,2}}
31
      };
32

  
33
///////////////////////////////////////////////////////////////////////////////////////////////////
34

  
35
  MovementJing(float[][] cuts, boolean[][] rotatable, int size)
36
    {
37
    super(TwistyJing.ROT_AXIS,cuts,rotatable,size);
38
    }
39

  
40
///////////////////////////////////////////////////////////////////////////////////////////////////
41

  
42
  void computeEnabledAxis(int face, float[] touchPoint, int[] enabled)
43
    {
44
    int num = NUM_ENABLED[face];
45
    enabled[0] = num;
46
    System.arraycopy(ENABLED[face][0], 0, enabled, 1, num);
47
    }
48
}
src/main/java/org/distorted/objects/MovementMinx.java
1
///////////////////////////////////////////////////////////////////////////////////////////////////
2
// Copyright 2020 Leszek Koltunski                                                               //
3
//                                                                                               //
4
// This file is part of Magic Cube.                                                              //
5
//                                                                                               //
6
// Magic Cube is free software: you can redistribute it and/or modify                            //
7
// it under the terms of the GNU General Public License as published by                          //
8
// the Free Software Foundation, either version 2 of the License, or                             //
9
// (at your option) any later version.                                                           //
10
//                                                                                               //
11
// Magic Cube is distributed in the hope that it will be useful,                                 //
12
// but WITHOUT ANY WARRANTY; without even the implied warranty of                                //
13
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the                                 //
14
// GNU General Public License for more details.                                                  //
15
//                                                                                               //
16
// You should have received a copy of the GNU General Public License                             //
17
// along with Magic Cube.  If not, see <http://www.gnu.org/licenses/>.                           //
18
///////////////////////////////////////////////////////////////////////////////////////////////////
19

  
20
package org.distorted.objects;
21

  
22
///////////////////////////////////////////////////////////////////////////////////////////////////
23

  
24
class MovementMinx extends Movement12
25
{
26
  private static final int[] NUM_ENABLED = {2,2,2,2,2,2,2,2,2,2,2,2};
27

  
28
  private static final int[][][] ENABLED = new int[][][]
29
      {
30
          {{2,3},{3,5},{1,5},{1,4},{2,4}},
31
          {{0,5},{2,5},{2,3},{3,4},{0,4}},
32
          {{2,3},{2,5},{0,5},{0,4},{3,4}},
33
          {{1,5},{3,5},{2,3},{2,4},{1,4}},
34
          {{0,3},{0,4},{4,5},{1,5},{1,3}},
35
          {{1,2},{1,4},{4,5},{0,5},{0,2}},
36
          {{4,5},{1,4},{1,2},{0,2},{0,5}},
37
          {{4,5},{0,4},{0,3},{1,3},{1,5}},
38
          {{0,2},{0,1},{1,3},{3,5},{2,5}},
39
          {{3,4},{2,4},{1,2},{0,1},{0,3}},
40
          {{2,4},{3,4},{0,3},{0,1},{1,2}},
41
          {{1,3},{0,1},{0,2},{2,5},{3,5}},
42
      };
43

  
44
///////////////////////////////////////////////////////////////////////////////////////////////////
45

  
46
  MovementMinx(float[][] cuts, boolean[][] rotatable, int size)
47
    {
48
    super(TwistyMinx.ROT_AXIS,cuts,rotatable,size);
49
    }
50

  
51
///////////////////////////////////////////////////////////////////////////////////////////////////
52

  
53
  void computeEnabledAxis(int face, float[] touchPoint, int[] enabled)
54
    {
55
    int part = returnPartOfThePentagon(touchPoint,face);
56

  
57
    if( part>0 )
58
      {
59
      int num = NUM_ENABLED[face];
60
      enabled[0] = num;
61
      System.arraycopy(ENABLED[face][part-1], 0, enabled, 1, num);
62
      }
63
    else enabled[0] = 0;
64
    }
65
}
src/main/java/org/distorted/objects/MovementPyraminx.java
1
///////////////////////////////////////////////////////////////////////////////////////////////////
2
// Copyright 2020 Leszek Koltunski                                                               //
3
//                                                                                               //
4
// This file is part of Magic Cube.                                                              //
5
//                                                                                               //
6
// Magic Cube is free software: you can redistribute it and/or modify                            //
7
// it under the terms of the GNU General Public License as published by                          //
8
// the Free Software Foundation, either version 2 of the License, or                             //
9
// (at your option) any later version.                                                           //
10
//                                                                                               //
11
// Magic Cube is distributed in the hope that it will be useful,                                 //
12
// but WITHOUT ANY WARRANTY; without even the implied warranty of                                //
13
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the                                 //
14
// GNU General Public License for more details.                                                  //
15
//                                                                                               //
16
// You should have received a copy of the GNU General Public License                             //
17
// along with Magic Cube.  If not, see <http://www.gnu.org/licenses/>.                           //
18
///////////////////////////////////////////////////////////////////////////////////////////////////
19

  
20
package org.distorted.objects;
21

  
22
///////////////////////////////////////////////////////////////////////////////////////////////////
23

  
24
class MovementPyraminx extends Movement4
25
{
26
  private static final int[] NUM_ENABLED = {3,3,3,3};
27

  
28
  private static final int[][][] ENABLED = new int[][][]
29
      {
30
          {{1,2,3}},{{0,2,3}},{{0,1,3}},{{0,1,2}}
31
      };
32

  
33
///////////////////////////////////////////////////////////////////////////////////////////////////
34

  
35
  MovementPyraminx(float[][] cuts, boolean[][] rotatable, int size)
36
    {
37
    super(TwistyPyraminx.ROT_AXIS,cuts,rotatable,size);
38
    }
39

  
40
///////////////////////////////////////////////////////////////////////////////////////////////////
41

  
42
  void computeEnabledAxis(int face, float[] touchPoint, int[] enabled)
43
    {
44
    int num = NUM_ENABLED[face];
45
    enabled[0] = num;
46
    System.arraycopy(ENABLED[face][0], 0, enabled, 1, num);
47
    }
48
}
src/main/java/org/distorted/objects/MovementSquare.java
1
///////////////////////////////////////////////////////////////////////////////////////////////////
2
// Copyright 2020 Leszek Koltunski                                                               //
3
//                                                                                               //
4
// This file is part of Magic Cube.                                                              //
5
//                                                                                               //
6
// Magic Cube is free software: you can redistribute it and/or modify                            //
7
// it under the terms of the GNU General Public License as published by                          //
8
// the Free Software Foundation, either version 2 of the License, or                             //
9
// (at your option) any later version.                                                           //
10
//                                                                                               //
11
// Magic Cube is distributed in the hope that it will be useful,                                 //
12
// but WITHOUT ANY WARRANTY; without even the implied warranty of                                //
13
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the                                 //
14
// GNU General Public License for more details.                                                  //
15
//                                                                                               //
16
// You should have received a copy of the GNU General Public License                             //
17
// along with Magic Cube.  If not, see <http://www.gnu.org/licenses/>.                           //
18
///////////////////////////////////////////////////////////////////////////////////////////////////
19

  
20
package org.distorted.objects;
21

  
22
///////////////////////////////////////////////////////////////////////////////////////////////////
23

  
24
class MovementSquare extends Movement6
25
{
26
  private static final int[] NUM_ENABLED = {1,1,1,1,2,2};
27

  
28
  private static final int[][][] ENABLED = new int[][][]
29
    {
30
      {{0}},{{0}},{{1}},{{1}},{{0,1}},{{0,1}}
31
    };
32

  
33
///////////////////////////////////////////////////////////////////////////////////////////////////
34

  
35
  MovementSquare(float[][] cuts, boolean[][] rotatable, int size)
36
    {
37
    super(TwistySquare.ROT_AXIS,cuts,rotatable,size);
38
    }
39

  
40
///////////////////////////////////////////////////////////////////////////////////////////////////
41

  
42
  void computeEnabledAxis(int face, float[] touchPoint, int[] enabled)
43
    {
44
    int num = NUM_ENABLED[face];
45
    enabled[0] = num;
46
    System.arraycopy(ENABLED[face][0], 0, enabled, 1, num);
47
    }
48
}
src/main/java/org/distorted/objects/MovementUltimate.java
1
///////////////////////////////////////////////////////////////////////////////////////////////////
2
// Copyright 2020 Leszek Koltunski                                                               //
3
//                                                                                               //
4
// This file is part of Magic Cube.                                                              //
5
//                                                                                               //
6
// Magic Cube is free software: you can redistribute it and/or modify                            //
7
// it under the terms of the GNU General Public License as published by                          //
8
// the Free Software Foundation, either version 2 of the License, or                             //
9
// (at your option) any later version.                                                           //
10
//                                                                                               //
11
// Magic Cube is distributed in the hope that it will be useful,                                 //
12
// but WITHOUT ANY WARRANTY; without even the implied warranty of                                //
13
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the                                 //
14
// GNU General Public License for more details.                                                  //
15
//                                                                                               //
16
// You should have received a copy of the GNU General Public License                             //
17
// along with Magic Cube.  If not, see <http://www.gnu.org/licenses/>.                           //
18
///////////////////////////////////////////////////////////////////////////////////////////////////
19

  
20
package org.distorted.objects;
21

  
22
///////////////////////////////////////////////////////////////////////////////////////////////////
23

  
24
class MovementUltimate extends Movement12
25
{
26
  private static final int[] NUM_ENABLED = {2,2,2,2,2,2,2,2,2,2,2,2};
27

  
28
  private static final int[][][] ENABLED = new int[][][]
29
    {
30
      {{2,3}},{{1,3}},{{1,3}},{{2,3}},{{0,3}},{{0,2}},{{0,2}},{{0,3}},{{1,2}},{{0,1}},{{0,1}},{{1,2}}
31
    };
32

  
33
///////////////////////////////////////////////////////////////////////////////////////////////////
34

  
35
  MovementUltimate(float[][] cuts, boolean[][] rotatable, int size)
36
    {
37
    super(TwistyUltimate.ROT_AXIS,cuts,rotatable,size);
38
    }
39

  
40
///////////////////////////////////////////////////////////////////////////////////////////////////
41

  
42
  void computeEnabledAxis(int face, float[] touchPoint, int[] enabled)
43
    {
44
    int num = NUM_ENABLED[face];
45
    enabled[0] = num;
46
    System.arraycopy(ENABLED[face][0], 0, enabled, 1, num);
47
    }
48
}
src/main/java/org/distorted/objects/TwistyBandagedAbstract.java
19 19

  
20 20
package org.distorted.objects;
21 21

  
22
import static org.distorted.objects.Movement.TYPE_NOT_SPLIT;
23

  
22 24
import android.content.res.Resources;
23 25

  
24 26
import org.distorted.helpers.ObjectShape;
......
51 53
         {2,2,2}
52 54
        };
53 55

  
56
  private static final int[] NUM_ENABLED = {2,2,2,2,2,2};
57

  
58
  private static final int[][][] ENABLED = new int[][][]
59
      {
60
          {{1,2}},{{1,2}},{{0,2}},{{0,2}},{{0,1}},{{0,1}},
61
      };
62

  
54 63
  private static final int NUM_STICKERS = 4;
55 64

  
56 65
  private int[] mBasicAngle;
......
120 129
    {
121 130
    if( mQuats==null ) initializeQuats();
122 131
    int status = retCubitSolvedStatus(cubit,numLayers);
123
    return status<0 ? null : buildSolvedQuats(MovementCube.FACE_AXIS[status],mQuats);
132
    return status<0 ? null : buildSolvedQuats(Movement6.FACE_AXIS[status],mQuats);
124 133
    }
125 134

  
126 135
///////////////////////////////////////////////////////////////////////////////////////////////////
......
457 466
      int numLayers = getNumLayers();
458 467
      if( mCuts==null ) getCuts(numLayers);
459 468
      getLayerRotatable(numLayers);
460

  
461
      mMovement = new MovementCube(mCuts,mLayerRotatable,numLayers);
469
      mMovement = new Movement6(ROT_AXIS,mCuts,mLayerRotatable,numLayers,TYPE_NOT_SPLIT,NUM_ENABLED,ENABLED);
462 470
      }
463 471
    return mMovement;
464 472
    }
src/main/java/org/distorted/objects/TwistyCube.java
19 19

  
20 20
package org.distorted.objects;
21 21

  
22
import static org.distorted.objects.Movement.TYPE_NOT_SPLIT;
23

  
22 24
import android.content.res.Resources;
23 25

  
24 26
import org.distorted.helpers.ObjectShape;
......
42 44
           new Static3D(0,0,1)
43 45
         };
44 46

  
47
  private static final int[] NUM_ENABLED = {2,2,2,2,2,2};
48

  
49
  private static final int[][][] ENABLED = new int[][][]
50
      {
51
          {{1,2}},{{1,2}},{{0,2}},{{0,2}},{{0,1}},{{0,1}},
52
      };
53

  
45 54
  private ScrambleState[] mStates;
46 55
  private Static4D[] mQuats;
47 56
  private float[][] mCuts;
......
155 164
    {
156 165
    if( mQuats ==null ) initializeQuats();
157 166
    int status = retCubitSolvedStatus(cubit,numLayers);
158
    return status<0 ? null : buildSolvedQuats(MovementCube.FACE_AXIS[status], mQuats);
167
    return status<0 ? null : buildSolvedQuats(Movement6.FACE_AXIS[status], mQuats);
159 168
    }
160 169

  
161 170
///////////////////////////////////////////////////////////////////////////////////////////////////
......
354 363
      int numLayers = getNumLayers();
355 364
      if( mCuts==null ) getCuts(numLayers);
356 365
      getLayerRotatable(numLayers);
357

  
358
      mMovement = new MovementCube(mCuts,mLayerRotatable,numLayers);
366
      mMovement = new Movement6(ROT_AXIS,mCuts,mLayerRotatable,numLayers,TYPE_NOT_SPLIT,NUM_ENABLED,ENABLED);
359 367
      }
360 368
    return mMovement;
361 369
    }
src/main/java/org/distorted/objects/TwistyDiamond.java
19 19

  
20 20
package org.distorted.objects;
21 21

  
22
import static org.distorted.objects.Movement.TYPE_NOT_SPLIT;
23

  
22 24
import android.content.res.Resources;
23 25

  
24 26
import org.distorted.helpers.ObjectShape;
......
44 46
           new Static3D(     0,-SQ3/3,+SQ6/3)
45 47
         };
46 48

  
49
  private static final int[] NUM_ENABLED = {3,3,3,3,3,3,3,3};
50

  
51
  private static final int[][][] ENABLED = new int[][][]
52
      {
53
          {{1,2,3}},{{1,2,3}},{{0,2,3}},{{0,2,3}},{{0,1,3}},{{0,1,3}},{{0,1,2}},{{0,1,2}}
54
      };
55

  
47 56
  private ScrambleState[] mStates;
48 57
  private int[] mBasicAngle;
49 58
  private int[] mFaceMap;
......
116 125
    if( mQuats==null ) initializeQuats();
117 126
    if( mFaceMap==null ) mFaceMap = new int[] {4,0,6,2,7,3,5,1};
118 127
    int status = retCubitSolvedStatus(cubit,numLayers);
119
    return status<0 ? null : buildSolvedQuats(MovementDiamond.FACE_AXIS[mFaceMap[status]],mQuats);
128
    return status<0 ? null : buildSolvedQuats(Movement8.FACE_AXIS[mFaceMap[status]],mQuats);
120 129
    }
121 130

  
122 131
///////////////////////////////////////////////////////////////////////////////////////////////////
......
497 506
      int numLayers = getNumLayers();
498 507
      if( mCuts==null ) getCuts(numLayers);
499 508
      getLayerRotatable(numLayers);
500

  
501
      mMovement = new MovementDiamond(mCuts,mLayerRotatable,numLayers);
509
      mMovement = new Movement8(ROT_AXIS,mCuts,mLayerRotatable,numLayers,TYPE_NOT_SPLIT,NUM_ENABLED,ENABLED);
502 510
      }
503 511
    return mMovement;
504 512
    }
src/main/java/org/distorted/objects/TwistyDino.java
19 19

  
20 20
package org.distorted.objects;
21 21

  
22
import static org.distorted.objects.Movement.TYPE_SPLIT_CORNER;
23

  
22 24
import android.content.res.Resources;
23 25

  
24 26
import org.distorted.helpers.ObjectShape;
......
43 45
           new Static3D(+SQ3/3,-SQ3/3,-SQ3/3)
44 46
         };
45 47

  
48
  private static final int[] NUM_ENABLED = {2,2,2,2,2,2};
49

  
50
  private static final int[][][] ENABLED = new int[][][]
51
      {
52
          {{0,1},{3,1},{2,3},{0,2}},
53
          {{2,3},{3,1},{0,1},{0,2}},
54
          {{1,2},{0,1},{0,3},{2,3}},
55
          {{1,2},{2,3},{0,3},{0,1}},
56
          {{0,3},{0,2},{1,2},{1,3}},
57
          {{1,2},{0,2},{0,3},{1,3}},
58
      };
59

  
46 60
  private int[] mBasicAngle;
47 61
  private Static4D[] mQuats;
48 62
  private float[][] mCuts;
......
226 240
      int numLayers = getNumLayers();
227 241
      if( mCuts==null ) getCuts(numLayers);
228 242
      getLayerRotatable(numLayers);
229

  
230
      mMovement = new MovementCornerTwisting(mCuts,mLayerRotatable,numLayers);
243
      mMovement = new Movement6(ROT_AXIS,mCuts,mLayerRotatable,numLayers,TYPE_SPLIT_CORNER,NUM_ENABLED,ENABLED);
231 244
      }
232 245
    return mMovement;
233 246
    }
src/main/java/org/distorted/objects/TwistyHelicopter.java
19 19

  
20 20
package org.distorted.objects;
21 21

  
22
import static org.distorted.objects.Movement.TYPE_SPLIT_EDGE;
23

  
22 24
import android.content.res.Resources;
23 25

  
24 26
import org.distorted.helpers.ObjectShape;
......
46 48
           new Static3D(-SQ2/2, -SQ2/2,      0)
47 49
         };
48 50

  
51
  private static final int[] NUM_ENABLED = {2,2,2,2,2,2};
52

  
53
  private static final int[][][] ENABLED = new int[][][]
54
      {
55
          {{2,5},{2,4},{3,4},{3,5}},
56
          {{2,4},{2,5},{3,5},{3,4}},
57
          {{0,5},{1,5},{1,4},{0,4}},
58
          {{0,4},{1,4},{1,5},{0,5}},
59
          {{1,3},{0,3},{0,2},{1,2}},
60
          {{0,3},{1,3},{1,2},{0,2}},
61
      };
62

  
49 63
  private ScrambleState[] mStates;
50 64
  private int[] mBasicAngle;
51 65
  private Static4D[] mQuats;
......
133 147
    {
134 148
    if( mQuats==null ) initializeQuats();
135 149
    int status = retCubitSolvedStatus(cubit,numLayers);
136
    return status<0 ? null : buildSolvedQuats(MovementHelicopter.FACE_AXIS[status],mQuats);
150
    return status<0 ? null : buildSolvedQuats(Movement6.FACE_AXIS[status],mQuats);
137 151
    }
138 152

  
139 153
///////////////////////////////////////////////////////////////////////////////////////////////////
......
419 433
      int numLayers = getNumLayers();
420 434
      if( mCuts==null ) getCuts(numLayers);
421 435
      getLayerRotatable(numLayers);
422

  
423
      mMovement = new MovementHelicopter(mCuts,mLayerRotatable,numLayers);
436
      mMovement = new Movement6(ROT_AXIS,mCuts,mLayerRotatable,numLayers,TYPE_SPLIT_EDGE,NUM_ENABLED,ENABLED);
424 437
      }
425 438
    return mMovement;
426 439
    }
src/main/java/org/distorted/objects/TwistyIvy.java
19 19

  
20 20
package org.distorted.objects;
21 21

  
22
import static org.distorted.objects.Movement.TYPE_SPLIT_CORNER;
23

  
22 24
import android.content.res.Resources;
23 25

  
24 26
import org.distorted.helpers.ObjectShape;
......
43 45
           new Static3D(+SQ3/3,-SQ3/3,-SQ3/3)
44 46
         };
45 47

  
48
  private static final int[] NUM_ENABLED = {1,1,1,1,1,1};
49

  
50
  private static final int[][][] ENABLED = new int[][][]
51
      {
52
          {{0},{3},{3},{0}},
53
          {{2},{1},{1},{2}},
54
          {{2},{0},{0},{2}},
55
          {{1},{3},{3},{1}},
56
          {{0},{0},{1},{1}},
57
          {{2},{2},{3},{3}},
58
      };
59

  
46 60
  private static final int NUM_STICKERS = 2;
47 61
  public static final float IVY_D = 0.006f;
48 62
  private static final int  IVY_N = 8;
......
109 123
    {
110 124
    if( mQuats==null ) initializeQuats();
111 125
    int status = retCubitSolvedStatus(cubit,numLayers);
112
    return status<0 ? null : buildSolvedQuats(MovementIvy.FACE_AXIS[status],mQuats);
126
    return status<0 ? null : buildSolvedQuats(Movement6.FACE_AXIS[status],mQuats);
113 127
    }
114 128

  
115 129
///////////////////////////////////////////////////////////////////////////////////////////////////
......
446 460
      int numLayers = getNumLayers();
447 461
      if( mCuts==null ) getCuts(numLayers);
448 462
      getLayerRotatable(numLayers);
449

  
450
      mMovement = new MovementIvy(mCuts,mLayerRotatable,numLayers);
463
      mMovement = new Movement6(ROT_AXIS,mCuts,mLayerRotatable,numLayers,TYPE_SPLIT_CORNER,NUM_ENABLED,ENABLED);
451 464
      }
452 465
    return mMovement;
453 466
    }
src/main/java/org/distorted/objects/TwistyJing.java
19 19

  
20 20
package org.distorted.objects;
21 21

  
22
import static org.distorted.objects.Movement.TYPE_NOT_SPLIT;
23

  
22 24
import android.content.res.Resources;
23 25

  
24 26
import org.distorted.helpers.ObjectShape;
......
43 45
           new Static3D(-SQ6/3,+SQ3/3,     0),
44 46
         };
45 47

  
48
  private static final int[] NUM_ENABLED = {3,3,3,3};
49

  
50
  private static final int[][][] ENABLED = new int[][][]
51
      {
52
          {{1,2,3}},{{0,2,3}},{{0,1,3}},{{0,1,2}}
53
      };
54

  
46 55
  static final float F = 0.48f;  // length of the edge of the corner cubit. Keep<0.5
47 56
                                 // Assuming the length of the edge of the whole
48 57
                                 // tetrahedron is 2.0 (ie standard, equal to numLayers
......
110 119
    {
111 120
    if( mQuats==null ) initializeQuats();
112 121
    int status = retCubitSolvedStatus(cubit,numLayers);
113
    return status<0 ? null : buildSolvedQuats(MovementJing.FACE_AXIS[status],mQuats);
122
    return status<0 ? null : buildSolvedQuats(Movement4.FACE_AXIS[status],mQuats);
114 123
    }
115 124

  
116 125
///////////////////////////////////////////////////////////////////////////////////////////////////
......
410 419
      int numLayers = getNumLayers();
411 420
      if( mCuts==null ) getCuts(numLayers);
412 421
      getLayerRotatable(numLayers);
413

  
414
      mMovement = new MovementJing(mCuts,mLayerRotatable,numLayers);
422
      mMovement = new Movement4(ROT_AXIS,mCuts,mLayerRotatable,numLayers,TYPE_NOT_SPLIT,NUM_ENABLED,ENABLED);
415 423
      }
416 424
    return mMovement;
417 425
    }
src/main/java/org/distorted/objects/TwistyMinx.java
19 19

  
20 20
package org.distorted.objects;
21 21

  
22
import static org.distorted.objects.Movement.TYPE_SPLIT_EDGE;
23

  
22 24
import android.content.res.Resources;
23 25

  
24 26
import org.distorted.helpers.ObjectSticker;
......
57 59
           new Static3D( SIN54/LEN,    0     ,   -C2/LEN )
58 60
         };
59 61

  
62
  private static final int[] NUM_ENABLED = {2,2,2,2,2,2,2,2,2,2,2,2};
63

  
64
  private static final int[][][] ENABLED = new int[][][]
65
      {
66
          {{2,3},{3,5},{1,5},{1,4},{2,4}},
67
          {{0,5},{2,5},{2,3},{3,4},{0,4}},
68
          {{2,3},{2,5},{0,5},{0,4},{3,4}},
69
          {{1,5},{3,5},{2,3},{2,4},{1,4}},
70
          {{0,3},{0,4},{4,5},{1,5},{1,3}},
71
          {{1,2},{1,4},{4,5},{0,5},{0,2}},
72
          {{4,5},{1,4},{1,2},{0,2},{0,5}},
73
          {{4,5},{0,4},{0,3},{1,3},{1,5}},
74
          {{0,2},{0,1},{1,3},{3,5},{2,5}},
75
          {{3,4},{2,4},{1,2},{0,1},{0,3}},
76
          {{2,4},{3,4},{0,3},{0,1},{1,2}},
77
          {{1,3},{0,1},{0,2},{2,5},{3,5}},
78
      };
79

  
60 80
  private ScrambleState[] mStates;
61 81
  private int[] mBasicAngle;
62 82
  private int[] mFaceMap;
......
496 516
    if( mQuats==null ) initializeQuats();
497 517
    if( mFaceMap==null ) mFaceMap = new int[] {8,10,3,7,1,11,9,2,4,0,5,6};
498 518
    int status = retCubitSolvedStatus(cubit,numLayers);
499
    return status<0 ? null : buildSolvedQuats(MovementMinx.FACE_AXIS[mFaceMap[status]],mQuats);
519
    return status<0 ? null : buildSolvedQuats(Movement12.FACE_AXIS[mFaceMap[status]],mQuats);
500 520
    }
501 521

  
502 522
///////////////////////////////////////////////////////////////////////////////////////////////////
......
513 533
    if( mCuts==null )
514 534
      {
515 535
      mCuts = new float[6][numLayers-1];
516
      float D = numLayers*MovementMinx.DIST3D;
536
      float D = numLayers*Movement12.DIST3D;
517 537
      float X = 2*D/(2+SIN18);  // height of the 'upper' part of a dodecahedron, i.e. put it on a table,
518 538
                                // its height is then 2D, it has one 'lower' part of height X, one
519 539
                                // 'middle' part of height Y and one upper part of height X again.
......
589 609
      int numLayers = getNumLayers();
590 610
      if( mCuts==null ) getCuts(numLayers);
591 611
      getLayerRotatable(numLayers);
592

  
593
      mMovement = new MovementMinx(mCuts,mLayerRotatable,numLayers);
612
      mMovement = new Movement12(ROT_AXIS,mCuts,mLayerRotatable,numLayers,TYPE_SPLIT_EDGE,NUM_ENABLED,ENABLED);
594 613
      }
595 614
    return mMovement;
596 615
    }
src/main/java/org/distorted/objects/TwistyMirror.java
19 19

  
20 20
package org.distorted.objects;
21 21

  
22
import static org.distorted.objects.Movement.TYPE_NOT_SPLIT;
23

  
22 24
import android.content.res.Resources;
23 25

  
24 26
import org.distorted.helpers.ObjectShape;
......
42 44
           new Static3D(0,0,1)
43 45
         };
44 46

  
47
  private static final int[] NUM_ENABLED = {2,2,2,2,2,2};
48

  
49
  private static final int[][][] ENABLED = new int[][][]
50
      {
51
          {{1,2}},{{1,2}},{{0,2}},{{0,2}},{{0,1}},{{0,1}},
52
      };
53

  
45 54
  private static final int[] FACE_COLORS = new int[] { COLOR_WHITE };
46 55
  private static final float DX = 0.10f;
47 56
  private static final float DY = 0.25f;
......
654 663
      int numLayers = getNumLayers();
655 664
      if( mCuts==null ) getCuts(numLayers);
656 665
      getLayerRotatable(numLayers);
657

  
658
      mMovement = new MovementCube(mCuts,mLayerRotatable,numLayers);
666
      mMovement = new Movement6(ROT_AXIS,mCuts,mLayerRotatable,numLayers,TYPE_NOT_SPLIT,NUM_ENABLED,ENABLED);
659 667
      }
660 668
    return mMovement;
661 669
    }
src/main/java/org/distorted/objects/TwistyPyraminx.java
19 19

  
20 20
package org.distorted.objects;
21 21

  
22
import static org.distorted.objects.Movement.TYPE_NOT_SPLIT;
23

  
22 24
import android.content.res.Resources;
23 25

  
24 26
import org.distorted.helpers.ObjectShape;
......
43 45
           new Static3D(-SQ6/3,+SQ3/3,     0),
44 46
         };
45 47

  
48
  private static final int[] NUM_ENABLED = {3,3,3,3};
49

  
50
  private static final int[][][] ENABLED = new int[][][]
51
      {
52
          {{1,2,3}},{{0,2,3}},{{0,1,3}},{{0,1,2}}
53
      };
54

  
46 55
  private ScrambleState[] mStates;
47 56
  private int[] mBasicAngle;
48 57
  private Static4D[] mQuats;
......
135 144
    {
136 145
    if( mQuats==null ) initializeQuats();
137 146
    int status = retCubitSolvedStatus(cubit,numLayers);
138
    return status<0 ? null : buildSolvedQuats(MovementPyraminx.FACE_AXIS[status],mQuats);
147
    return status<0 ? null : buildSolvedQuats(Movement4.FACE_AXIS[status],mQuats);
139 148
    }
140 149

  
141 150
///////////////////////////////////////////////////////////////////////////////////////////////////
......
381 390
      int numLayers = getNumLayers();
382 391
      if( mCuts==null ) getCuts(numLayers);
383 392
      getLayerRotatable(numLayers);
384

  
385
      mMovement = new MovementPyraminx(mCuts,mLayerRotatable,numLayers);
393
      mMovement = new Movement4(ROT_AXIS,mCuts,mLayerRotatable,numLayers,TYPE_NOT_SPLIT,NUM_ENABLED,ENABLED);
386 394
      }
387 395
    return mMovement;
388 396
    }
src/main/java/org/distorted/objects/TwistyRedi.java
19 19

  
20 20
package org.distorted.objects;
21 21

  
22
import static org.distorted.objects.Movement.TYPE_SPLIT_CORNER;
23

  
22 24
import android.content.res.Resources;
23 25

  
24 26
import org.distorted.helpers.ObjectShape;
......
43 45
           new Static3D(+SQ3/3,-SQ3/3,-SQ3/3)
44 46
         };
45 47

  
48
  private static final int[] NUM_ENABLED = {2,2,2,2,2,2};
49

  
50
  private static final int[][][] ENABLED = new int[][][]
51
      {
52
          {{0,1},{3,1},{2,3},{0,2}},
53
          {{2,3},{3,1},{0,1},{0,2}},
54
          {{1,2},{0,1},{0,3},{2,3}},
55
          {{1,2},{2,3},{0,3},{0,1}},
56
          {{0,3},{0,2},{1,2},{1,3}},
57
          {{1,2},{0,2},{0,3},{1,3}},
58
      };
59

  
46 60
  private ScrambleState[] mStates;
47 61
  private int[] mBasicAngle;
48 62
  private Static4D[] mQuats;
......
112 126
    {
113 127
    if( mQuats==null ) initializeQuats();
114 128
    int status = retCubitSolvedStatus(cubit,numLayers);
115
    return status<0 ? null : buildSolvedQuats(MovementCornerTwisting.FACE_AXIS[status],mQuats);
129
    return status<0 ? null : buildSolvedQuats(Movement6.FACE_AXIS[status],mQuats);
116 130
    }
117 131

  
118 132
///////////////////////////////////////////////////////////////////////////////////////////////////
......
416 430
      int numLayers = getNumLayers();
417 431
      if( mCuts==null ) getCuts(numLayers);
418 432
      getLayerRotatable(numLayers);
419

  
420
      mMovement = new MovementCornerTwisting(mCuts,mLayerRotatable,numLayers);
433
      mMovement = new Movement6(ROT_AXIS,mCuts,mLayerRotatable,numLayers,TYPE_SPLIT_CORNER,NUM_ENABLED,ENABLED);
421 434
      }
422 435
    return mMovement;
423 436
    }
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff