Revision acf2a9e1
Added by Leszek Koltunski 12 months ago
src/main/java/org/distorted/objectlib/main/ObjectType.java | ||
---|---|---|
112 | 112 |
COIH_3 ( TwistyCoinHexahedron.class , 25, R.drawable.coin_3, true, 50, new InitData(new int[] {3,3,3,3,3,3,3})), |
113 | 113 |
|
114 | 114 |
COIN_3 ( TwistyCoinTetrahedron.class, 15, R.drawable.coin_3, true, 40, new InitData(new int[] {3,3,3,3})), |
115 |
TINS_5 ( TwistyTins.class , 28, R.drawable.coin_3, false, 60, new InitData(new int[] {5,5,5,5})),
|
|
115 |
TINS_5 ( TwistyTins.class , 28, R.drawable.coin_3, true, 60, new InitData(new int[] {5,5,5,5})),
|
|
116 | 116 |
; |
117 | 117 |
|
118 | 118 |
public static int NUM_OBJECTS; |
src/main/java/org/distorted/objectlib/objects/TwistyCoinHexahedron.java | ||
---|---|---|
52 | 52 |
private float[][] mCuts; |
53 | 53 |
private float[][] mPosition; |
54 | 54 |
private int[] mQuatIndex; |
55 |
private boolean[][] mRotatable; |
|
55 | 56 |
|
56 | 57 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
57 | 58 |
|
... | ... | |
64 | 65 |
|
65 | 66 |
public int[][] getScrambleEdges() |
66 | 67 |
{ |
67 |
if( mEdges==null ) mEdges = ScrambleEdgeGenerator.getScrambleEdgesSingle(mBasicAngle); |
|
68 |
if( mEdges==null ) |
|
69 |
{ |
|
70 |
setUpRotatable(); |
|
71 |
mEdges = ScrambleEdgeGenerator.getScrambleEdgesSingle(mBasicAngle, mRotatable); |
|
72 |
} |
|
73 |
|
|
68 | 74 |
return mEdges; |
69 | 75 |
} |
70 | 76 |
|
77 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
78 |
|
|
79 |
@Override |
|
80 |
public int[][] getScrambleAlgorithms() |
|
81 |
{ |
|
82 |
setUpRotatable(); |
|
83 |
return ScrambleEdgeGenerator.getScramblingAlgorithms(mBasicAngle, mRotatable); |
|
84 |
} |
|
85 |
|
|
71 | 86 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
72 | 87 |
|
73 | 88 |
public float[][] getCuts(int[] numLayers) |
... | ... | |
84 | 99 |
return mCuts; |
85 | 100 |
} |
86 | 101 |
|
102 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
103 |
|
|
104 |
private void setUpRotatable() |
|
105 |
{ |
|
106 |
if( mRotatable==null ) |
|
107 |
{ |
|
108 |
boolean[] tmp = new boolean[] {true,false,true}; |
|
109 |
mRotatable = new boolean[][] { tmp,tmp,tmp,tmp,tmp,tmp,tmp }; |
|
110 |
} |
|
111 |
} |
|
112 |
|
|
87 | 113 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
88 | 114 |
|
89 | 115 |
public boolean[][] getLayerRotatable(int[] numLayers) |
90 | 116 |
{ |
91 |
boolean[] tmp = new boolean[] {true,false,true};
|
|
92 |
return new boolean[][] { tmp,tmp,tmp,tmp,tmp,tmp,tmp };
|
|
117 |
setUpRotatable();
|
|
118 |
return mRotatable;
|
|
93 | 119 |
} |
94 | 120 |
|
95 | 121 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
... | ... | |
402 | 428 |
int[][] ret = new int[1+4*N][]; |
403 | 429 |
|
404 | 430 |
ret[0] = new int[4*N]; |
405 |
for(int i=0; i<4*N; i++) ret[0][i] = i; |
|
431 |
for(int i=0; i<4*N; i++) ret[0][i] = 4*N-1-i;
|
|
406 | 432 |
|
407 | 433 |
for(int i=0; i<N; i++) |
408 | 434 |
{ |
... | ... | |
497 | 523 |
} |
498 | 524 |
else if( variant==1 ) |
499 | 525 |
{ |
500 |
float h1 = isInIconMode() ? 0.0001f : 0.005f;
|
|
526 |
float h1 = isInIconMode() ? 0.0001f : 0.0001f;
|
|
501 | 527 |
float h2 = 0.0001f; |
502 | 528 |
float[][] bands = { {h1,15,0.2f,0.4f,5,0,0}, {h2,15,0.05f,0.1f,2,0,0} }; |
503 | 529 |
int num = 1+4*N; |
src/main/java/org/distorted/objectlib/objects/TwistyCoinTetrahedron.java | ||
---|---|---|
48 | 48 |
private float[][] mCuts; |
49 | 49 |
private float[][] mPosition; |
50 | 50 |
private int[] mQuatIndex; |
51 |
private boolean[][] mRotatable; |
|
51 | 52 |
|
52 | 53 |
private float[][] V,M,L; |
53 | 54 |
|
... | ... | |
62 | 63 |
|
63 | 64 |
public int[][] getScrambleEdges() |
64 | 65 |
{ |
65 |
if( mEdges==null ) mEdges = ScrambleEdgeGenerator.getScrambleEdgesSingle(mBasicAngle); |
|
66 |
if( mEdges==null ) |
|
67 |
{ |
|
68 |
setUpRotatable(); |
|
69 |
mEdges = ScrambleEdgeGenerator.getScrambleEdgesSingle(mBasicAngle, mRotatable); |
|
70 |
} |
|
71 |
|
|
66 | 72 |
return mEdges; |
67 | 73 |
} |
68 | 74 |
|
75 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
76 |
|
|
77 |
@Override |
|
78 |
public int[][] getScrambleAlgorithms() |
|
79 |
{ |
|
80 |
setUpRotatable(); |
|
81 |
return ScrambleEdgeGenerator.getScramblingAlgorithms(mBasicAngle, mRotatable); |
|
82 |
} |
|
83 |
|
|
69 | 84 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
70 | 85 |
|
71 | 86 |
public float[][] getCuts(int[] numLayers) |
... | ... | |
79 | 94 |
return mCuts; |
80 | 95 |
} |
81 | 96 |
|
97 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
98 |
|
|
99 |
private void setUpRotatable() |
|
100 |
{ |
|
101 |
if( mRotatable==null ) |
|
102 |
{ |
|
103 |
boolean[] tmp = new boolean[] {true,false,true}; |
|
104 |
mRotatable = new boolean[][] { tmp,tmp,tmp,tmp }; |
|
105 |
} |
|
106 |
} |
|
107 |
|
|
82 | 108 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
83 | 109 |
|
84 | 110 |
public boolean[][] getLayerRotatable(int[] numLayers) |
85 | 111 |
{ |
86 |
boolean[] tmp = new boolean[] {true,false,true};
|
|
87 |
return new boolean[][] { tmp,tmp,tmp,tmp };
|
|
112 |
setUpRotatable();
|
|
113 |
return mRotatable;
|
|
88 | 114 |
} |
89 | 115 |
|
90 | 116 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
src/main/java/org/distorted/objectlib/objects/TwistyTins.java | ||
---|---|---|
44 | 44 |
private float[][] mCuts; |
45 | 45 |
private float[][] mPosition; |
46 | 46 |
private int[] mQuatIndex; |
47 |
private boolean[][] mRotatable; |
|
47 | 48 |
|
48 | 49 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
49 | 50 |
|
... | ... | |
56 | 57 |
|
57 | 58 |
public int[][] getScrambleEdges() |
58 | 59 |
{ |
59 |
if( mEdges==null ) mEdges = ScrambleEdgeGenerator.getScrambleEdgesSingle(mBasicAngle); |
|
60 |
if( mEdges==null ) |
|
61 |
{ |
|
62 |
setUpRotatable(); |
|
63 |
mEdges = ScrambleEdgeGenerator.getScrambleEdgesSingle(mBasicAngle, mRotatable); |
|
64 |
} |
|
65 |
|
|
60 | 66 |
return mEdges; |
61 | 67 |
} |
62 | 68 |
|
69 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
70 |
|
|
71 |
@Override |
|
72 |
public int[][] getScrambleAlgorithms() |
|
73 |
{ |
|
74 |
setUpRotatable(); |
|
75 |
return ScrambleEdgeGenerator.getScramblingAlgorithms(mBasicAngle, mRotatable); |
|
76 |
} |
|
77 |
|
|
63 | 78 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
64 | 79 |
|
65 | 80 |
public float[][] getCuts(int[] numLayers) |
... | ... | |
80 | 95 |
return mCuts; |
81 | 96 |
} |
82 | 97 |
|
98 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
99 |
|
|
100 |
private void setUpRotatable() |
|
101 |
{ |
|
102 |
if( mRotatable==null ) |
|
103 |
{ |
|
104 |
boolean[] tmp = new boolean[] {true,true,false,true,true}; |
|
105 |
mRotatable = new boolean[][] { tmp,tmp,tmp,tmp }; |
|
106 |
} |
|
107 |
} |
|
108 |
|
|
83 | 109 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
84 | 110 |
|
85 | 111 |
public boolean[][] getLayerRotatable(int[] numLayers) |
86 | 112 |
{ |
87 |
boolean[] tmp = new boolean[] {true,true,false,true,true};
|
|
88 |
return new boolean[][] { tmp,tmp,tmp,tmp };
|
|
113 |
setUpRotatable();
|
|
114 |
return mRotatable;
|
|
89 | 115 |
} |
90 | 116 |
|
91 | 117 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
src/main/java/org/distorted/objectlib/scrambling/ScrambleEdgeGenerator.java | ||
---|---|---|
92 | 92 |
return new int[][] { edge }; |
93 | 93 |
} |
94 | 94 |
|
95 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
96 |
|
|
97 |
public static int[][] getScrambleEdgesSingle(int[][] basicAngles, boolean[][] rotatable) |
|
98 |
{ |
|
99 |
int num=0; |
|
100 |
int numAxis= basicAngles.length; |
|
101 |
|
|
102 |
for(int a=0; a<numAxis; a++) |
|
103 |
{ |
|
104 |
int[] angles = basicAngles[a]; |
|
105 |
int numLayers = angles.length; |
|
106 |
|
|
107 |
for(int l=0; l<numLayers; l++) |
|
108 |
if( rotatable[a][l] ) |
|
109 |
num += (angles[l]-1); |
|
110 |
} |
|
111 |
|
|
112 |
int[] edge = new int[2*num]; |
|
113 |
for(int i=0; i<num; i++) |
|
114 |
{ |
|
115 |
edge[2*i ] = i; |
|
116 |
edge[2*i+1] = 0; |
|
117 |
} |
|
118 |
|
|
119 |
return new int[][] { edge }; |
|
120 |
} |
|
121 |
|
|
95 | 122 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
96 | 123 |
|
97 | 124 |
public static int[][] getScramblingAlgorithms(int[][] basicAngles) |
... | ... | |
135 | 162 |
|
136 | 163 |
return ret; |
137 | 164 |
} |
165 |
|
|
166 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
167 |
|
|
168 |
public static int[][] getScramblingAlgorithms(int[][] basicAngles, boolean[][] rotatable) |
|
169 |
{ |
|
170 |
int numAxis= basicAngles.length; |
|
171 |
int num=0; |
|
172 |
|
|
173 |
for(int a=0; a<numAxis; a++) |
|
174 |
{ |
|
175 |
int[] angles = basicAngles[a]; |
|
176 |
int numLayers = angles.length; |
|
177 |
|
|
178 |
for(int l=0; l<numLayers; l++) |
|
179 |
if( rotatable[a][l] ) |
|
180 |
num += (angles[l]-1); |
|
181 |
} |
|
182 |
|
|
183 |
int[][] ret = new int[num][3]; |
|
184 |
int index = 0; |
|
185 |
|
|
186 |
for(int a=0; a<numAxis; a++) |
|
187 |
{ |
|
188 |
int numLayers = basicAngles[a].length; |
|
189 |
|
|
190 |
for(int l=0; l<numLayers; l++) |
|
191 |
{ |
|
192 |
if( rotatable[a][l] ) |
|
193 |
{ |
|
194 |
int N = basicAngles[a][l]; |
|
195 |
int NEG = (1-N)/2; |
|
196 |
int POS = N/2; |
|
197 |
|
|
198 |
for(int k=NEG; k<=-1; k++) |
|
199 |
{ |
|
200 |
ret[index][0] = a; |
|
201 |
ret[index][1] = l; |
|
202 |
ret[index][2] = k; |
|
203 |
index++; |
|
204 |
} |
|
205 |
|
|
206 |
for(int k=1; k<=POS; k++) |
|
207 |
{ |
|
208 |
ret[index][0] = a; |
|
209 |
ret[index][1] = l; |
|
210 |
ret[index][2] = k; |
|
211 |
index++; |
|
212 |
} |
|
213 |
} |
|
214 |
} |
|
215 |
} |
|
216 |
|
|
217 |
return ret; |
|
218 |
} |
|
138 | 219 |
} |
139 | 220 |
|
Also available in: Unified diff
Support for automatic creation of Scramble Algorithms and Edges which ignore the 'non-rotatable' layers.
Implement this to the Coin Tetrahedron, Ancient Coin Cube & Tins Cube.