Revision 74c9af0d
Added by Leszek Koltunski about 3 years ago
src/main/java/org/distorted/objects/MovementCornerTwisting.java | ||
---|---|---|
23 | 23 |
|
24 | 24 |
class MovementCornerTwisting extends Movement6 |
25 | 25 |
{ |
26 |
private static final int[] NUM_ENABLED = {2,2,2,2,2,2}; |
|
27 |
|
|
26 | 28 |
private static final int[][][] ENABLED = new int[][][] |
27 | 29 |
{ |
28 |
{{2,0,1},{2,3,1},{2,2,3},{2,0,2}},
|
|
29 |
{{2,2,3},{2,3,1},{2,0,1},{2,0,2}},
|
|
30 |
{{2,1,2},{2,0,1},{2,0,3},{2,2,3}},
|
|
31 |
{{2,1,2},{2,2,3},{2,0,3},{2,0,1}},
|
|
32 |
{{2,0,3},{2,0,2},{2,1,2},{2,1,3}},
|
|
33 |
{{2,1,2},{2,0,2},{2,0,3},{2,1,3}},
|
|
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}},
|
|
34 | 36 |
}; |
35 | 37 |
|
36 | 38 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
... | ... | |
41 | 43 |
} |
42 | 44 |
|
43 | 45 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
44 |
// _____________ |
|
45 |
// | \ 0 / | |
|
46 |
// | \ / | |
|
47 |
// | 3 | | 1 | |
|
48 |
// | / \ | |
|
49 |
// | / 2 \ | |
|
50 |
// ------------- |
|
51 | 46 |
|
52 | 47 |
void computeEnabledAxis(int face, float[] touchPoint, int[] enabled) |
53 | 48 |
{ |
54 | 49 |
boolean p0 = touchPoint[1] >= touchPoint[0]; |
55 | 50 |
boolean p1 = touchPoint[1] >=-touchPoint[0]; |
56 |
int quarter = p0 ? (p1 ? 0:3) : (p1 ? 1:2);
|
|
51 |
int part = p0 ? (p1 ? 0:3) : (p1 ? 1:2);
|
|
57 | 52 |
|
58 |
enabled[0] = ENABLED[face][quarter][0];
|
|
59 |
enabled[1] = ENABLED[face][quarter][1];
|
|
60 |
enabled[2] = ENABLED[face][quarter][2];
|
|
53 |
int num = NUM_ENABLED[face];
|
|
54 |
enabled[0] = num;
|
|
55 |
System.arraycopy(ENABLED[face][part], 0, enabled, 1, num);
|
|
61 | 56 |
} |
62 | 57 |
} |
63 | 58 |
|
src/main/java/org/distorted/objects/MovementCube.java | ||
---|---|---|
23 | 23 |
|
24 | 24 |
class MovementCube extends Movement6 |
25 | 25 |
{ |
26 |
private static final int[] NUM_ENABLED = {2,2,2,2,2,2}; |
|
27 |
|
|
26 | 28 |
private static final int[][][] ENABLED = new int[][][] |
27 | 29 |
{ |
28 |
{{2,1,2}},{{2,1,2}},{{2,0,2}},{{2,0,2}},{{2,0,1}},{{2,0,1}},
|
|
30 |
{{1,2}},{{1,2}},{{0,2}},{{0,2}},{{0,1}},{{0,1}},
|
|
29 | 31 |
}; |
30 | 32 |
|
31 | 33 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
... | ... | |
39 | 41 |
|
40 | 42 |
void computeEnabledAxis(int face, float[] touchPoint, int[] enabled) |
41 | 43 |
{ |
42 |
enabled[0] = ENABLED[face][0][0];
|
|
43 |
enabled[1] = ENABLED[face][0][1];
|
|
44 |
enabled[2] = ENABLED[face][0][2];
|
|
44 |
int num = NUM_ENABLED[face];
|
|
45 |
enabled[0] = num;
|
|
46 |
System.arraycopy(ENABLED[face][0], 0, enabled, 1, num);
|
|
45 | 47 |
} |
46 | 48 |
} |
src/main/java/org/distorted/objects/MovementDiamond.java | ||
---|---|---|
23 | 23 |
|
24 | 24 |
class MovementDiamond extends Movement8 |
25 | 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 |
|
|
26 | 35 |
MovementDiamond(float[][] cuts, boolean[][] rotatable, int size) |
27 | 36 |
{ |
28 | 37 |
super(TwistyDiamond.ROT_AXIS,cuts,rotatable,size); |
... | ... | |
32 | 41 |
|
33 | 42 |
void computeEnabledAxis(int face, float[] touchPoint, int[] enabled) |
34 | 43 |
{ |
35 |
enabled[0] = 3; |
|
36 |
|
|
37 |
switch(face/2) |
|
38 |
{ |
|
39 |
case 0: enabled[1]=1; enabled[2]=2; enabled[3]=3; break; |
|
40 |
case 1: enabled[1]=0; enabled[2]=2; enabled[3]=3; break; |
|
41 |
case 2: enabled[1]=0; enabled[2]=1; enabled[3]=3; break; |
|
42 |
case 3: enabled[1]=0; enabled[2]=1; enabled[3]=2; break; |
|
43 |
} |
|
44 |
int num = NUM_ENABLED[face]; |
|
45 |
enabled[0] = num; |
|
46 |
System.arraycopy(ENABLED[face][0], 0, enabled, 1, num); |
|
44 | 47 |
} |
45 | 48 |
} |
src/main/java/org/distorted/objects/MovementHelicopter.java | ||
---|---|---|
23 | 23 |
|
24 | 24 |
class MovementHelicopter extends Movement6 |
25 | 25 |
{ |
26 |
MovementHelicopter(float[][] cuts, boolean[][] rotatable, int size) |
|
27 |
{ |
|
28 |
super(TwistyHelicopter.ROT_AXIS,cuts,rotatable,size); |
|
29 |
} |
|
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 |
}; |
|
30 | 37 |
|
31 | 38 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
32 |
// _____________ |
|
33 |
// | | | |
|
34 |
// | 3 | 0 | |
|
35 |
// |-----------| |
|
36 |
// | | | |
|
37 |
// | 2 | 1 | |
|
38 |
// ------------- |
|
39 | 39 |
|
40 |
private int getQuarter(float[] touchPoint)
|
|
40 |
MovementHelicopter(float[][] cuts, boolean[][] rotatable, int size)
|
|
41 | 41 |
{ |
42 |
boolean p0 = touchPoint[0] > 0; |
|
43 |
boolean p1 = touchPoint[1] > 0; |
|
44 |
return p0 ? (p1 ? 0:1) : (p1 ? 3:2); |
|
42 |
super(TwistyHelicopter.ROT_AXIS,cuts,rotatable,size); |
|
45 | 43 |
} |
46 | 44 |
|
47 | 45 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
48 | 46 |
|
49 | 47 |
void computeEnabledAxis(int face, float[] touchPoint, int[] enabled) |
50 | 48 |
{ |
51 |
enabled[0] = 2;
|
|
52 |
|
|
53 |
int quarter = getQuarter(touchPoint);
|
|
49 |
boolean p0 = touchPoint[0] > 0;
|
|
50 |
boolean p1 = touchPoint[1] > 0; |
|
51 |
int part = p0 ? (p1 ? 0:1) : (p1 ? 3:2);
|
|
54 | 52 |
|
55 |
switch(face) |
|
56 |
{ |
|
57 |
case 0: switch(quarter) |
|
58 |
{ |
|
59 |
case 0: enabled[1]=2; enabled[2]=5; break; |
|
60 |
case 1: enabled[1]=2; enabled[2]=4; break; |
|
61 |
case 2: enabled[1]=3; enabled[2]=4; break; |
|
62 |
case 3: enabled[1]=3; enabled[2]=5; break; |
|
63 |
} |
|
64 |
break; |
|
65 |
case 1: switch(quarter) |
|
66 |
{ |
|
67 |
case 0: enabled[1]=2; enabled[2]=4; break; |
|
68 |
case 1: enabled[1]=2; enabled[2]=5; break; |
|
69 |
case 2: enabled[1]=5; enabled[2]=3; break; |
|
70 |
case 3: enabled[1]=3; enabled[2]=4; break; |
|
71 |
} |
|
72 |
break; |
|
73 |
case 2: switch(quarter) |
|
74 |
{ |
|
75 |
case 0: enabled[1]=0; enabled[2]=5; break; |
|
76 |
case 1: enabled[1]=1; enabled[2]=5; break; |
|
77 |
case 2: enabled[1]=1; enabled[2]=4; break; |
|
78 |
case 3: enabled[1]=0; enabled[2]=4; break; |
|
79 |
} |
|
80 |
break; |
|
81 |
case 3: switch(quarter) |
|
82 |
{ |
|
83 |
case 0: enabled[1]=0; enabled[2]=4; break; |
|
84 |
case 1: enabled[1]=1; enabled[2]=4; break; |
|
85 |
case 2: enabled[1]=1; enabled[2]=5; break; |
|
86 |
case 3: enabled[1]=0; enabled[2]=5; break; |
|
87 |
} |
|
88 |
break; |
|
89 |
case 4: switch(quarter) |
|
90 |
{ |
|
91 |
case 0: enabled[1]=1; enabled[2]=3; break; |
|
92 |
case 1: enabled[1]=0; enabled[2]=3; break; |
|
93 |
case 2: enabled[1]=0; enabled[2]=2; break; |
|
94 |
case 3: enabled[1]=1; enabled[2]=2; break; |
|
95 |
} |
|
96 |
break; |
|
97 |
case 5: switch(quarter) |
|
98 |
{ |
|
99 |
case 0: enabled[1]=0; enabled[2]=3; break; |
|
100 |
case 1: enabled[1]=1; enabled[2]=3; break; |
|
101 |
case 2: enabled[1]=1; enabled[2]=2; break; |
|
102 |
case 3: enabled[1]=0; enabled[2]=2; break; |
|
103 |
} |
|
104 |
break; |
|
105 |
} |
|
53 |
int num = NUM_ENABLED[face]; |
|
54 |
enabled[0] = num; |
|
55 |
System.arraycopy(ENABLED[face][part], 0, enabled, 1, num); |
|
106 | 56 |
} |
107 | 57 |
} |
src/main/java/org/distorted/objects/MovementIvy.java | ||
---|---|---|
23 | 23 |
|
24 | 24 |
class MovementIvy extends Movement6 |
25 | 25 |
{ |
26 |
MovementIvy(float[][] cuts, boolean[][] rotatable, int size) |
|
27 |
{ |
|
28 |
super(TwistyIvy.ROT_AXIS,cuts,rotatable,size); |
|
29 |
} |
|
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 |
}; |
|
30 | 37 |
|
31 | 38 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
32 |
// faces 0,1,2,3 --> / |
|
33 |
// faces 4,5 --> \ |
|
34 | 39 |
|
35 |
private boolean isTopHalf(int face, float[] touchPoint)
|
|
40 |
MovementIvy(float[][] cuts, boolean[][] rotatable, int size)
|
|
36 | 41 |
{ |
37 |
if( face==4 || face==5 ) return touchPoint[1] >=-touchPoint[0]; |
|
38 |
else return touchPoint[1] >= touchPoint[0]; |
|
42 |
super(TwistyIvy.ROT_AXIS,cuts,rotatable,size); |
|
39 | 43 |
} |
40 | 44 |
|
41 | 45 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
42 |
// 0 +++ |
|
43 |
// 1 ++- |
|
44 |
// 2 +-+ |
|
45 |
// 3 +-- |
|
46 | 46 |
|
47 | 47 |
void computeEnabledAxis(int face, float[] touchPoint, int[] enabled) |
48 | 48 |
{ |
49 |
enabled[0] = 1; |
|
49 |
boolean p0 = touchPoint[1] >= touchPoint[0]; |
|
50 |
boolean p1 = touchPoint[1] >=-touchPoint[0]; |
|
51 |
int part = p0 ? (p1 ? 0:3) : (p1 ? 1:2); |
|
50 | 52 |
|
51 |
boolean isTop = isTopHalf(face,touchPoint); |
|
52 |
|
|
53 |
switch(face) |
|
54 |
{ |
|
55 |
case 0: enabled[1] = isTop ? 0:3; break; |
|
56 |
case 1: enabled[1] = isTop ? 2:1; break; |
|
57 |
case 2: enabled[1] = isTop ? 2:0; break; |
|
58 |
case 3: enabled[1] = isTop ? 1:3; break; |
|
59 |
case 4: enabled[1] = isTop ? 0:1; break; |
|
60 |
case 5: enabled[1] = isTop ? 2:3; break; |
|
61 |
} |
|
53 |
int num = NUM_ENABLED[face]; |
|
54 |
enabled[0] = num; |
|
55 |
System.arraycopy(ENABLED[face][part], 0, enabled, 1, num); |
|
62 | 56 |
} |
63 | 57 |
} |
src/main/java/org/distorted/objects/MovementJing.java | ||
---|---|---|
23 | 23 |
|
24 | 24 |
class MovementJing extends Movement4 |
25 | 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 |
|
|
26 | 35 |
MovementJing(float[][] cuts, boolean[][] rotatable, int size) |
27 | 36 |
{ |
28 | 37 |
super(TwistyJing.ROT_AXIS,cuts,rotatable,size); |
... | ... | |
32 | 41 |
|
33 | 42 |
void computeEnabledAxis(int face, float[] touchPoint, int[] enabled) |
34 | 43 |
{ |
35 |
enabled[0] = 3; |
|
36 |
|
|
37 |
switch(face) |
|
38 |
{ |
|
39 |
case 0: enabled[1]=1; enabled[2]=2; enabled[3]=3; break; |
|
40 |
case 1: enabled[1]=0; enabled[2]=2; enabled[3]=3; break; |
|
41 |
case 2: enabled[1]=0; enabled[2]=1; enabled[3]=3; break; |
|
42 |
case 3: enabled[1]=0; enabled[2]=1; enabled[3]=2; break; |
|
43 |
} |
|
44 |
int num = NUM_ENABLED[face]; |
|
45 |
enabled[0] = num; |
|
46 |
System.arraycopy(ENABLED[face][0], 0, enabled, 1, num); |
|
44 | 47 |
} |
45 | 48 |
} |
src/main/java/org/distorted/objects/MovementMinx.java | ||
---|---|---|
23 | 23 |
|
24 | 24 |
class MovementMinx extends Movement12 |
25 | 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 |
|
|
26 | 46 |
MovementMinx(float[][] cuts, boolean[][] rotatable, int size) |
27 | 47 |
{ |
28 | 48 |
super(TwistyMinx.ROT_AXIS,cuts,rotatable,size); |
... | ... | |
36 | 56 |
|
37 | 57 |
if( part>0 ) |
38 | 58 |
{ |
39 |
enabled[0] = 2; |
|
40 |
|
|
41 |
switch(face) |
|
42 |
{ |
|
43 |
case 0: switch(part) |
|
44 |
{ |
|
45 |
case 1: enabled[1]=2; enabled[2]=3; break; |
|
46 |
case 2: enabled[1]=3; enabled[2]=5; break; |
|
47 |
case 3: enabled[1]=5; enabled[2]=1; break; |
|
48 |
case 4: enabled[1]=1; enabled[2]=4; break; |
|
49 |
case 5: enabled[1]=4; enabled[2]=2; break; |
|
50 |
} |
|
51 |
break; |
|
52 |
|
|
53 |
case 1: switch(part) |
|
54 |
{ |
|
55 |
case 1: enabled[1]=0; enabled[2]=5; break; |
|
56 |
case 2: enabled[1]=5; enabled[2]=2; break; |
|
57 |
case 3: enabled[1]=2; enabled[2]=3; break; |
|
58 |
case 4: enabled[1]=3; enabled[2]=4; break; |
|
59 |
case 5: enabled[1]=4; enabled[2]=0; break; |
|
60 |
} |
|
61 |
break; |
|
62 |
|
|
63 |
case 2: switch(part) |
|
64 |
{ |
|
65 |
case 1: enabled[1]=3; enabled[2]=2; break; |
|
66 |
case 2: enabled[1]=2; enabled[2]=5; break; |
|
67 |
case 3: enabled[1]=5; enabled[2]=0; break; |
|
68 |
case 4: enabled[1]=0; enabled[2]=4; break; |
|
69 |
case 5: enabled[1]=4; enabled[2]=3; break; |
|
70 |
} |
|
71 |
break; |
|
72 |
|
|
73 |
case 3: switch(part) |
|
74 |
{ |
|
75 |
case 1: enabled[1]=1; enabled[2]=5; break; |
|
76 |
case 2: enabled[1]=5; enabled[2]=3; break; |
|
77 |
case 3: enabled[1]=3; enabled[2]=2; break; |
|
78 |
case 4: enabled[1]=2; enabled[2]=4; break; |
|
79 |
case 5: enabled[1]=4; enabled[2]=1; break; |
|
80 |
} |
|
81 |
break; |
|
82 |
|
|
83 |
case 4: switch(part) |
|
84 |
{ |
|
85 |
case 1: enabled[1]=3; enabled[2]=0; break; |
|
86 |
case 2: enabled[1]=0; enabled[2]=4; break; |
|
87 |
case 3: enabled[1]=4; enabled[2]=5; break; |
|
88 |
case 4: enabled[1]=5; enabled[2]=1; break; |
|
89 |
case 5: enabled[1]=1; enabled[2]=3; break; |
|
90 |
} |
|
91 |
break; |
|
92 |
|
|
93 |
case 5: switch(part) |
|
94 |
{ |
|
95 |
case 1: enabled[1]=2; enabled[2]=1; break; |
|
96 |
case 2: enabled[1]=1; enabled[2]=4; break; |
|
97 |
case 3: enabled[1]=4; enabled[2]=5; break; |
|
98 |
case 4: enabled[1]=5; enabled[2]=0; break; |
|
99 |
case 5: enabled[1]=0; enabled[2]=2; break; |
|
100 |
} |
|
101 |
break; |
|
102 |
|
|
103 |
case 6: switch(part) |
|
104 |
{ |
|
105 |
case 1: enabled[1]=5; enabled[2]=4; break; |
|
106 |
case 2: enabled[1]=4; enabled[2]=1; break; |
|
107 |
case 3: enabled[1]=1; enabled[2]=2; break; |
|
108 |
case 4: enabled[1]=2; enabled[2]=0; break; |
|
109 |
case 5: enabled[1]=0; enabled[2]=5; break; |
|
110 |
} |
|
111 |
break; |
|
112 |
|
|
113 |
case 7: switch(part) |
|
114 |
{ |
|
115 |
case 1: enabled[1]=5; enabled[2]=4; break; |
|
116 |
case 2: enabled[1]=4; enabled[2]=0; break; |
|
117 |
case 3: enabled[1]=0; enabled[2]=3; break; |
|
118 |
case 4: enabled[1]=3; enabled[2]=1; break; |
|
119 |
case 5: enabled[1]=1; enabled[2]=5; break; |
|
120 |
} |
|
121 |
break; |
|
122 |
|
|
123 |
case 8: switch(part) |
|
124 |
{ |
|
125 |
case 1: enabled[1]=2; enabled[2]=0; break; |
|
126 |
case 2: enabled[1]=0; enabled[2]=1; break; |
|
127 |
case 3: enabled[1]=1; enabled[2]=3; break; |
|
128 |
case 4: enabled[1]=3; enabled[2]=5; break; |
|
129 |
case 5: enabled[1]=5; enabled[2]=2; break; |
|
130 |
} |
|
131 |
break; |
|
132 |
|
|
133 |
case 9: switch(part) |
|
134 |
{ |
|
135 |
case 1: enabled[1]=3; enabled[2]=4; break; |
|
136 |
case 2: enabled[1]=4; enabled[2]=2; break; |
|
137 |
case 3: enabled[1]=2; enabled[2]=1; break; |
|
138 |
case 4: enabled[1]=1; enabled[2]=0; break; |
|
139 |
case 5: enabled[1]=0; enabled[2]=3; break; |
|
140 |
} |
|
141 |
break; |
|
142 |
|
|
143 |
case 10: switch(part) |
|
144 |
{ |
|
145 |
case 1: enabled[1]=2; enabled[2]=4; break; |
|
146 |
case 2: enabled[1]=4; enabled[2]=3; break; |
|
147 |
case 3: enabled[1]=3; enabled[2]=0; break; |
|
148 |
case 4: enabled[1]=0; enabled[2]=1; break; |
|
149 |
case 5: enabled[1]=1; enabled[2]=2; break; |
|
150 |
} |
|
151 |
break; |
|
152 |
|
|
153 |
case 11: switch(part) |
|
154 |
{ |
|
155 |
case 1: enabled[1]=3; enabled[2]=1; break; |
|
156 |
case 2: enabled[1]=1; enabled[2]=0; break; |
|
157 |
case 3: enabled[1]=0; enabled[2]=2; break; |
|
158 |
case 4: enabled[1]=2; enabled[2]=5; break; |
|
159 |
case 5: enabled[1]=5; enabled[2]=3; break; |
|
160 |
} |
|
161 |
break; |
|
162 |
} |
|
163 |
} |
|
164 |
else |
|
165 |
{ |
|
166 |
enabled[0] = 0; |
|
59 |
int num = NUM_ENABLED[face]; |
|
60 |
enabled[0] = num; |
|
61 |
System.arraycopy(ENABLED[face][part-1], 0, enabled, 1, num); |
|
167 | 62 |
} |
63 |
else enabled[0] = 0; |
|
168 | 64 |
} |
169 | 65 |
} |
src/main/java/org/distorted/objects/MovementPyraminx.java | ||
---|---|---|
23 | 23 |
|
24 | 24 |
class MovementPyraminx extends Movement4 |
25 | 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 |
|
|
26 | 35 |
MovementPyraminx(float[][] cuts, boolean[][] rotatable, int size) |
27 | 36 |
{ |
28 | 37 |
super(TwistyPyraminx.ROT_AXIS,cuts,rotatable,size); |
... | ... | |
32 | 41 |
|
33 | 42 |
void computeEnabledAxis(int face, float[] touchPoint, int[] enabled) |
34 | 43 |
{ |
35 |
enabled[0] = 3; |
|
36 |
|
|
37 |
switch(face) |
|
38 |
{ |
|
39 |
case 0: enabled[1]=1; enabled[2]=2; enabled[3]=3; break; |
|
40 |
case 1: enabled[1]=0; enabled[2]=2; enabled[3]=3; break; |
|
41 |
case 2: enabled[1]=0; enabled[2]=1; enabled[3]=3; break; |
|
42 |
case 3: enabled[1]=0; enabled[2]=1; enabled[3]=2; break; |
|
43 |
} |
|
44 |
int num = NUM_ENABLED[face]; |
|
45 |
enabled[0] = num; |
|
46 |
System.arraycopy(ENABLED[face][0], 0, enabled, 1, num); |
|
44 | 47 |
} |
45 | 48 |
} |
src/main/java/org/distorted/objects/MovementSquare.java | ||
---|---|---|
23 | 23 |
|
24 | 24 |
class MovementSquare extends Movement6 |
25 | 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 |
|
|
26 | 35 |
MovementSquare(float[][] cuts, boolean[][] rotatable, int size) |
27 | 36 |
{ |
28 | 37 |
super(TwistySquare.ROT_AXIS,cuts,rotatable,size); |
... | ... | |
32 | 41 |
|
33 | 42 |
void computeEnabledAxis(int face, float[] touchPoint, int[] enabled) |
34 | 43 |
{ |
35 |
switch(face/2) |
|
36 |
{ |
|
37 |
case 0: enabled[0]=1; enabled[1]=0; break; |
|
38 |
case 1: enabled[0]=1; enabled[1]=1; break; |
|
39 |
case 2: enabled[0]=2; enabled[1]=0; enabled[2]=1; break; |
|
40 |
} |
|
44 |
int num = NUM_ENABLED[face]; |
|
45 |
enabled[0] = num; |
|
46 |
System.arraycopy(ENABLED[face][0], 0, enabled, 1, num); |
|
41 | 47 |
} |
42 | 48 |
} |
src/main/java/org/distorted/objects/MovementUltimate.java | ||
---|---|---|
23 | 23 |
|
24 | 24 |
class MovementUltimate extends Movement12 |
25 | 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 |
|
|
26 | 35 |
MovementUltimate(float[][] cuts, boolean[][] rotatable, int size) |
27 | 36 |
{ |
28 | 37 |
super(TwistyUltimate.ROT_AXIS,cuts,rotatable,size); |
... | ... | |
32 | 41 |
|
33 | 42 |
void computeEnabledAxis(int face, float[] touchPoint, int[] enabled) |
34 | 43 |
{ |
35 |
enabled[0] = 2; |
|
36 |
|
|
37 |
switch(face) |
|
38 |
{ |
|
39 |
case 0: case 3: enabled[1] = 2; enabled[2] = 3; break; |
|
40 |
case 1: case 2: enabled[1] = 1; enabled[2] = 3; break; |
|
41 |
case 4: case 7: enabled[1] = 0; enabled[2] = 3; break; |
|
42 |
case 5: case 6: enabled[1] = 0; enabled[2] = 2; break; |
|
43 |
case 8: case 11:enabled[1] = 1; enabled[2] = 2; break; |
|
44 |
case 9: case 10:enabled[1] = 0; enabled[2] = 1; break; |
|
45 |
} |
|
44 |
int num = NUM_ENABLED[face]; |
|
45 |
enabled[0] = num; |
|
46 |
System.arraycopy(ENABLED[face][0], 0, enabled, 1, num); |
|
46 | 47 |
} |
47 | 48 |
} |
Also available in: Unified diff
Next step on the way to completely do away with object Movement classes.