1 |
bc649d9a
|
Leszek Koltunski
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
2 |
|
|
// Copyright 2019 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 |
|
|
import android.content.res.Resources;
|
23 |
|
|
|
24 |
acf165d9
|
Leszek Koltunski
|
import org.distorted.helpers.ObjectShape;
|
25 |
9c06394a
|
Leszek Koltunski
|
import org.distorted.helpers.ObjectSticker;
|
26 |
6cf89a3e
|
Leszek Koltunski
|
import org.distorted.helpers.ScrambleState;
|
27 |
bc649d9a
|
Leszek Koltunski
|
import org.distorted.library.main.DistortedEffects;
|
28 |
|
|
import org.distorted.library.main.DistortedTexture;
|
29 |
|
|
import org.distorted.library.mesh.MeshSquare;
|
30 |
|
|
import org.distorted.library.type.Static3D;
|
31 |
|
|
import org.distorted.library.type.Static4D;
|
32 |
|
|
import org.distorted.main.R;
|
33 |
|
|
|
34 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
35 |
|
|
|
36 |
efa81f0c
|
Leszek Koltunski
|
class TwistyUltimate extends Twisty12
|
37 |
bc649d9a
|
Leszek Koltunski
|
{
|
38 |
|
|
private static final float A = (float)Math.sqrt(21*SQ5+47);
|
39 |
|
|
private static final float B = SQ6*(5*SQ5+11)/(6*A);
|
40 |
|
|
private static final float C = SQ6*( SQ5+ 2)/(3*A);
|
41 |
|
|
private static final float D = SQ3/3;
|
42 |
|
|
private static final float E = (SQ5+1)/4;
|
43 |
|
|
private static final float F = (SQ5-1)/4;
|
44 |
74ffd68e
|
Leszek Koltunski
|
private static final float G = (SQ5+3)/4;
|
45 |
bc649d9a
|
Leszek Koltunski
|
|
46 |
|
|
static final Static3D[] ROT_AXIS = new Static3D[]
|
47 |
|
|
{
|
48 |
|
|
new Static3D( B,0,C ),
|
49 |
|
|
new Static3D( C,B,0 ),
|
50 |
|
|
new Static3D(-D,D,D ),
|
51 |
|
|
new Static3D( 0,C,-B)
|
52 |
|
|
};
|
53 |
|
|
|
54 |
91792184
|
Leszek Koltunski
|
private ScrambleState[] mStates;
|
55 |
963921af
|
Leszek Koltunski
|
private int[] mBasicAngle;
|
56 |
|
|
private Static4D[] mQuats;
|
57 |
ef018c1b
|
Leszek Koltunski
|
private float[][] mCuts;
|
58 |
|
|
private boolean[][] mLayerRotatable;
|
59 |
963921af
|
Leszek Koltunski
|
private int[][] mFaceMap;
|
60 |
|
|
private float[][] mCenters;
|
61 |
|
|
private int[] mQuatIndex;
|
62 |
|
|
private ObjectSticker[] mStickers;
|
63 |
e9a87113
|
Leszek Koltunski
|
private Movement mMovement;
|
64 |
0ad6b867
|
Leszek Koltunski
|
|
65 |
bc649d9a
|
Leszek Koltunski
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
66 |
|
|
|
67 |
|
|
TwistyUltimate(int size, Static4D quat, DistortedTexture texture,
|
68 |
|
|
MeshSquare mesh, DistortedEffects effects, int[][] moves, Resources res, int scrWidth)
|
69 |
|
|
{
|
70 |
|
|
super(size, size, quat, texture, mesh, effects, moves, ObjectList.ULTI, res, scrWidth);
|
71 |
91792184
|
Leszek Koltunski
|
}
|
72 |
0ad6b867
|
Leszek Koltunski
|
|
73 |
91792184
|
Leszek Koltunski
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
74 |
0ad6b867
|
Leszek Koltunski
|
|
75 |
91792184
|
Leszek Koltunski
|
ScrambleState[] getScrambleStates()
|
76 |
|
|
{
|
77 |
|
|
if( mStates==null )
|
78 |
0ad6b867
|
Leszek Koltunski
|
{
|
79 |
91792184
|
Leszek Koltunski
|
int[] tmp = {0,-1,0, 0,1,0, 1,-1,0, 1,1,0 };
|
80 |
|
|
|
81 |
|
|
mStates = new ScrambleState[]
|
82 |
|
|
{
|
83 |
|
|
new ScrambleState( new int[][] {tmp,tmp,tmp,tmp} )
|
84 |
|
|
};
|
85 |
|
|
}
|
86 |
|
|
|
87 |
|
|
return mStates;
|
88 |
bc649d9a
|
Leszek Koltunski
|
}
|
89 |
|
|
|
90 |
963921af
|
Leszek Koltunski
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
91 |
|
|
|
92 |
|
|
private void initializeQuats()
|
93 |
|
|
{
|
94 |
|
|
mQuats = new Static4D[]
|
95 |
|
|
{
|
96 |
|
|
new Static4D( 0.0f, 0.0f, 0.0f, 1.0f ),
|
97 |
|
|
new Static4D(-0.5f, 0.5f, 0.5f, 0.5f ),
|
98 |
|
|
new Static4D( 0.5f,-0.5f,-0.5f, 0.5f ),
|
99 |
|
|
new Static4D( 0.0f, F, -E, 0.5f ),
|
100 |
|
|
new Static4D( 0.0f, -F, E, 0.5f ),
|
101 |
|
|
new Static4D( E, 0.0f, F, 0.5f ),
|
102 |
|
|
new Static4D( -E, 0.0f, -F, 0.5f ),
|
103 |
|
|
new Static4D( F, E, 0.0f, 0.5f ),
|
104 |
|
|
new Static4D( -F, -E, 0.0f, 0.5f ),
|
105 |
|
|
new Static4D( E, F,-0.5f, 0.0f ),
|
106 |
|
|
new Static4D( 0.5f, -E, F, 0.0f ),
|
107 |
|
|
new Static4D( F, 0.5f, E, 0.0f )
|
108 |
|
|
};
|
109 |
|
|
}
|
110 |
|
|
|
111 |
a480ee80
|
Leszek Koltunski
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
112 |
|
|
|
113 |
|
|
int[] getSolvedQuats(int cubit, int numLayers)
|
114 |
|
|
{
|
115 |
963921af
|
Leszek Koltunski
|
if( mQuats==null ) initializeQuats();
|
116 |
a480ee80
|
Leszek Koltunski
|
int status = retCubitSolvedStatus(cubit,numLayers);
|
117 |
963921af
|
Leszek Koltunski
|
return status<0 ? null : buildSolvedQuats(MovementUltimate.FACE_AXIS[status],mQuats);
|
118 |
a480ee80
|
Leszek Koltunski
|
}
|
119 |
|
|
|
120 |
bc649d9a
|
Leszek Koltunski
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
121 |
|
|
|
122 |
acf165d9
|
Leszek Koltunski
|
ObjectShape getObjectShape(int cubit, int numLayers)
|
123 |
bc649d9a
|
Leszek Koltunski
|
{
|
124 |
acf165d9
|
Leszek Koltunski
|
int variant = getCubitVariant(cubit,numLayers);
|
125 |
bc649d9a
|
Leszek Koltunski
|
|
126 |
acf165d9
|
Leszek Koltunski
|
if( variant==0 )
|
127 |
bc649d9a
|
Leszek Koltunski
|
{
|
128 |
963921af
|
Leszek Koltunski
|
double[][] vertices = new double[][]
|
129 |
|
|
{
|
130 |
1b32d001
|
Leszek Koltunski
|
{ 0.0 , 0.0 , 0.0 },
|
131 |
|
|
{ -E , E+0.5, -0.5 },
|
132 |
|
|
{-0.5 , -E , -E-0.5},
|
133 |
|
|
{ E+0.5, 0.5 , -E },
|
134 |
|
|
{ 0.0 , 1 , -2*E-1},
|
135 |
|
|
{ 0.0 , 1 , 0.0 },
|
136 |
|
|
{ -E ,-E+0.5, -0.5 },
|
137 |
|
|
{ E ,-E+0.5, -0.5 }
|
138 |
963921af
|
Leszek Koltunski
|
};
|
139 |
|
|
int[][] vert_indices = new int[][]
|
140 |
|
|
{
|
141 |
|
|
{6,0,5,1},
|
142 |
|
|
{0,7,3,5},
|
143 |
|
|
{0,6,2,7},
|
144 |
|
|
{4,3,5,1},
|
145 |
|
|
{4,2,7,3},
|
146 |
|
|
{4,1,6,2},
|
147 |
|
|
};
|
148 |
|
|
|
149 |
acf165d9
|
Leszek Koltunski
|
float[][] bands = new float[][] { {0.03f,17,0.5f,0.2f,5,2,2}, {0.01f, 1,0.5f,0.2f,5,2,2} };
|
150 |
|
|
int[] bandIndices = new int[] { 0,0,0,1,1,1 };
|
151 |
1b32d001
|
Leszek Koltunski
|
float[][] corners = new float[][] { { 0.013f, 0.16f } };
|
152 |
acf165d9
|
Leszek Koltunski
|
int[] cornerIndices = new int[] { 0, 0, 0, 0,-1, 0, 0, 0 };
|
153 |
1b32d001
|
Leszek Koltunski
|
float[][] centers = new float[][] { { 0.0f,-1.0f, -(SQ5+3)/2 } };
|
154 |
acf165d9
|
Leszek Koltunski
|
int[] centerIndices = new int[] { 0,0,0,0,0,0,0,0 };
|
155 |
963921af
|
Leszek Koltunski
|
return new ObjectShape(vertices,vert_indices,bands,bandIndices,corners,cornerIndices,centers,centerIndices,getNumCubitFaces(), null);
|
156 |
bc649d9a
|
Leszek Koltunski
|
}
|
157 |
acf165d9
|
Leszek Koltunski
|
else if( variant==1 )
|
158 |
bc649d9a
|
Leszek Koltunski
|
{
|
159 |
963921af
|
Leszek Koltunski
|
double[][] vertices = new double[][]
|
160 |
|
|
{
|
161 |
1b32d001
|
Leszek Koltunski
|
{ 0.00, 0.00, 0.00},
|
162 |
|
|
{ - 0.50,-SQ5/4 - 0.25,-SQ5/4 - 0.75},
|
163 |
|
|
{ SQ5/4 + 0.25,-SQ5/4 - 0.75, + 0.50},
|
164 |
|
|
{ SQ5/4 + 0.75, + 0.50,-SQ5/4 - 0.25},
|
165 |
|
|
{ SQ5/2 + 0.50,-SQ5/2 - 0.50,-SQ5/2 - 0.50},
|
166 |
|
|
{ SQ5/4 - 0.25, + 0.50,-SQ5/4 - 0.25},
|
167 |
|
|
{ - 0.50,-SQ5/4 - 0.25,-SQ5/4 + 0.25},
|
168 |
|
|
{ SQ5/4 + 0.25,-SQ5/4 + 0.25, + 0.50}
|
169 |
963921af
|
Leszek Koltunski
|
};
|
170 |
|
|
int[][] vert_indices = new int[][]
|
171 |
|
|
{
|
172 |
|
|
{6,0,5,1},
|
173 |
|
|
{0,7,3,5},
|
174 |
|
|
{0,6,2,7},
|
175 |
|
|
{1,5,3,4},
|
176 |
|
|
{3,7,2,4},
|
177 |
|
|
{2,6,1,4},
|
178 |
|
|
};
|
179 |
|
|
|
180 |
acf165d9
|
Leszek Koltunski
|
float[][] bands = new float[][] { {0.03f,17,0.5f,0.2f,5,2,2}, {0.01f, 1,0.5f,0.2f,5,2,2} };
|
181 |
|
|
int[] bandIndices = new int[] { 0,0,0,1,1,1 };
|
182 |
1b32d001
|
Leszek Koltunski
|
float[][] corners = new float[][] { { 0.013f, 0.16f } };
|
183 |
acf165d9
|
Leszek Koltunski
|
int[] cornerIndices = new int[] { 0, 0, 0, 0,-1, 0, 0, 0 };
|
184 |
1b32d001
|
Leszek Koltunski
|
float[][] centers = new float[][] { { 0.0f,-1.0f, -(SQ5+3)/2 } };
|
185 |
acf165d9
|
Leszek Koltunski
|
int[] centerIndices = new int[] { 0,0,0,0,0,0,0,0 };
|
186 |
963921af
|
Leszek Koltunski
|
return new ObjectShape(vertices,vert_indices,bands,bandIndices,corners,cornerIndices,centers,centerIndices,getNumCubitFaces(), null);
|
187 |
62efeeae
|
Leszek Koltunski
|
}
|
188 |
|
|
else
|
189 |
|
|
{
|
190 |
963921af
|
Leszek Koltunski
|
double[][] vertices = new double[][]
|
191 |
|
|
{
|
192 |
1b32d001
|
Leszek Koltunski
|
{ -E ,-E+0.5, 0.5},
|
193 |
|
|
{ E , E-0.5, -0.5},
|
194 |
|
|
{-2*E , 0.0, 0.0},
|
195 |
|
|
{ 0.5, E , -E-0.5},
|
196 |
|
|
{ -E ,-E-0.5, 0.5},
|
197 |
|
|
{ E+0.5, -0.5, -E },
|
198 |
|
|
{-2*E , -1.0, 0.0},
|
199 |
|
|
{ 1.0, 0.0,-2*E },
|
200 |
|
|
{-2*E+0.5, E , -E-0.5},
|
201 |
|
|
{ 0.5,-E-1.0, -E+0.5},
|
202 |
|
|
{ -E ,-E-0.5,-2*E-0.5}
|
203 |
963921af
|
Leszek Koltunski
|
};
|
204 |
|
|
int[][] vert_indices = new int[][]
|
205 |
|
|
{
|
206 |
|
|
{0,1,3,8,2}, // counterclockwise!
|
207 |
|
|
{0,4,9,5,1},
|
208 |
|
|
{ 0,2,6,4},
|
209 |
|
|
{ 1,5,7,3},
|
210 |
|
|
{10,9,4,6},
|
211 |
|
|
{10,9,5,7},
|
212 |
|
|
{10,8,3,7},
|
213 |
|
|
{10,8,2,6}
|
214 |
|
|
};
|
215 |
|
|
|
216 |
acf165d9
|
Leszek Koltunski
|
float[][] bands = new float[][] { {0.04f,17,0.5f,0.2f,5,2,2}, {0.03f,17,0.5f,0.2f,5,2,2}, {0.01f, 1,0.5f,0.2f,5,2,2} };
|
217 |
|
|
int[] bandIndices = new int[] { 0,0,1,1,2,2,2,2 };
|
218 |
1b32d001
|
Leszek Koltunski
|
float[][] corners = new float[][] { { 0.013f, 0.16f } };
|
219 |
acf165d9
|
Leszek Koltunski
|
int[] cornerIndices = new int[] { 0,0,0,0,0,0,0,0,0,0,-1 };
|
220 |
1b32d001
|
Leszek Koltunski
|
float[][] centers = new float[][] { { -(SQ5+1)/4, 0.5f, -(SQ5+5)/4 } };
|
221 |
acf165d9
|
Leszek Koltunski
|
int[] centerIndices = new int[] { 0,0,0,0,0,0,0,0,0,0,0 };
|
222 |
963921af
|
Leszek Koltunski
|
return new ObjectShape(vertices,vert_indices,bands,bandIndices,corners,cornerIndices,centers,centerIndices,getNumCubitFaces(), null);
|
223 |
bc649d9a
|
Leszek Koltunski
|
}
|
224 |
acf165d9
|
Leszek Koltunski
|
}
|
225 |
bc649d9a
|
Leszek Koltunski
|
|
226 |
acf165d9
|
Leszek Koltunski
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
227 |
bc649d9a
|
Leszek Koltunski
|
|
228 |
3e605536
|
Leszek Koltunski
|
Static4D getQuat(int cubit, int numLayers)
|
229 |
acf165d9
|
Leszek Koltunski
|
{
|
230 |
963921af
|
Leszek Koltunski
|
if( mQuats ==null ) initializeQuats();
|
231 |
|
|
if( mQuatIndex ==null ) mQuatIndex = new int[] { 0,6,1,2,0,4,6,5,0,1,4,9,5,2 };
|
232 |
|
|
return mQuats[mQuatIndex[cubit]];
|
233 |
bc649d9a
|
Leszek Koltunski
|
}
|
234 |
|
|
|
235 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
236 |
|
|
|
237 |
3e605536
|
Leszek Koltunski
|
int getNumCubitVariants(int numLayers)
|
238 |
bc649d9a
|
Leszek Koltunski
|
{
|
239 |
acf165d9
|
Leszek Koltunski
|
return 3;
|
240 |
|
|
}
|
241 |
|
|
|
242 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
243 |
|
|
|
244 |
|
|
int getCubitVariant(int cubit, int numLayers)
|
245 |
|
|
{
|
246 |
|
|
return cubit<4 ? 0 : (cubit<8 ? 1:2);
|
247 |
bc649d9a
|
Leszek Koltunski
|
}
|
248 |
|
|
|
249 |
acf165d9
|
Leszek Koltunski
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
250 |
|
|
|
251 |
|
|
float[][] getCubitPositions(int numLayers)
|
252 |
|
|
{
|
253 |
963921af
|
Leszek Koltunski
|
if( mCenters==null )
|
254 |
|
|
{
|
255 |
|
|
mCenters = new float[][]
|
256 |
|
|
{
|
257 |
1b32d001
|
Leszek Koltunski
|
{ 0, -1, 2*G },
|
258 |
|
|
{ 2*E,-2*E,-2*E },
|
259 |
|
|
{-2*G, 0, -1 },
|
260 |
|
|
{ 1, 2*G, 0 },
|
261 |
|
|
|
262 |
|
|
{-2*E, 2*E, 2*E },
|
263 |
|
|
{ 2*G, 0, 1 },
|
264 |
|
|
{ -1, -2*G, 0 },
|
265 |
|
|
{ 0, 1,-2*G },
|
266 |
|
|
|
267 |
|
|
{ E, (E+0.5f), (E+G) },
|
268 |
|
|
{ -(E+G), -E, (E+0.5f) },
|
269 |
|
|
{ (E+0.5f), -(E+G), E },
|
270 |
|
|
{ -E,-(E+0.5f), -(E+G) },
|
271 |
|
|
{ (E+G), E,-(E+0.5f) },
|
272 |
|
|
{-(E+0.5f), (E+G), -E }
|
273 |
963921af
|
Leszek Koltunski
|
};
|
274 |
|
|
}
|
275 |
|
|
|
276 |
|
|
return mCenters;
|
277 |
bc649d9a
|
Leszek Koltunski
|
}
|
278 |
|
|
|
279 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
280 |
|
|
|
281 |
9c06394a
|
Leszek Koltunski
|
int getFaceColor(int cubit, int cubitface, int size)
|
282 |
bc649d9a
|
Leszek Koltunski
|
{
|
283 |
963921af
|
Leszek Koltunski
|
if( mFaceMap==null )
|
284 |
|
|
{
|
285 |
|
|
mFaceMap = new int[][]
|
286 |
|
|
{
|
287 |
|
|
{ 25,24,35, 36,36,36,36,36 },
|
288 |
|
|
{ 27,28,29, 36,36,36,36,36 },
|
289 |
|
|
{ 31,26,30, 36,36,36,36,36 },
|
290 |
|
|
{ 32,34,33, 36,36,36,36,36 },
|
291 |
|
|
|
292 |
|
|
{ 31,32,25, 36,36,36,36,36 },
|
293 |
|
|
{ 33,28,24, 36,36,36,36,36 },
|
294 |
|
|
{ 26,35,27, 36,36,36,36,36 },
|
295 |
|
|
{ 30,29,34, 36,36,36,36,36 },
|
296 |
|
|
|
297 |
|
|
{ 8, 0,13,21, 36,36,36,36 },
|
298 |
|
|
{ 1, 2,19,23, 36,36,36,36 },
|
299 |
|
|
{ 4,11,12,15, 36,36,36,36 },
|
300 |
|
|
{ 3, 6,14,17, 36,36,36,36 },
|
301 |
|
|
{ 5, 9,22,16, 36,36,36,36 },
|
302 |
|
|
{ 7,10,20,18, 36,36,36,36 }
|
303 |
|
|
};
|
304 |
|
|
}
|
305 |
|
|
|
306 |
9c06394a
|
Leszek Koltunski
|
return mFaceMap[cubit][cubitface];
|
307 |
|
|
}
|
308 |
74ffd68e
|
Leszek Koltunski
|
|
309 |
bc649d9a
|
Leszek Koltunski
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
310 |
|
|
|
311 |
9c06394a
|
Leszek Koltunski
|
ObjectSticker retSticker(int face)
|
312 |
bc649d9a
|
Leszek Koltunski
|
{
|
313 |
963921af
|
Leszek Koltunski
|
if( mStickers==null )
|
314 |
|
|
{
|
315 |
|
|
float[][] STICKERS = new float[][]
|
316 |
|
|
{
|
317 |
|
|
{ -0.14400357f, -0.47894150f, 0.50000000f,-0.011045523f, 0.37700626f, 0.36749030f,-0.26699730f, 0.36749026f, -0.46600536f, -0.24499352f }, // Big cubit 1st
|
318 |
|
|
{ 0.36327127f, 0.26393202f,-0.36327127f, 0.500000000f,-0.36327127f,-0.26393202f, 0.36327127f,-0.50000000f }, // Big cubit 2nd
|
319 |
|
|
{ -0.29389262f, -0.50000000f, 0.29389262f,-0.309017000f, 0.29389262f, 0.30901700f,-0.29389262f, 0.50000000f }, // Small cubit 1st
|
320 |
|
|
};
|
321 |
|
|
|
322 |
|
|
final float R1 = 0.08f;
|
323 |
|
|
final float R2 = 0.13f;
|
324 |
|
|
final float R3 = 0.11f;
|
325 |
|
|
final float[][] radii = { {R1,R1,R1,R1,R1},{R2,R2,R2,R2},{R3,R3,R3,R3} };
|
326 |
|
|
final float[] strokes = { 0.07f, 0.09f, 0.08f };
|
327 |
|
|
|
328 |
|
|
mStickers = new ObjectSticker[STICKERS.length];
|
329 |
|
|
|
330 |
|
|
for(int s=0; s<STICKERS.length; s++)
|
331 |
|
|
{
|
332 |
|
|
mStickers[s] = new ObjectSticker(STICKERS[s],null,radii[s],strokes[s]);
|
333 |
|
|
}
|
334 |
|
|
}
|
335 |
|
|
|
336 |
abf36986
|
Leszek Koltunski
|
return mStickers[face/NUM_FACE_COLORS];
|
337 |
bc649d9a
|
Leszek Koltunski
|
}
|
338 |
|
|
|
339 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
340 |
|
|
|
341 |
|
|
Static4D[] getQuats()
|
342 |
|
|
{
|
343 |
963921af
|
Leszek Koltunski
|
if( mQuats==null ) initializeQuats();
|
344 |
|
|
return mQuats;
|
345 |
bc649d9a
|
Leszek Koltunski
|
}
|
346 |
|
|
|
347 |
169219a7
|
Leszek Koltunski
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
348 |
|
|
|
349 |
|
|
int getSolvedFunctionIndex()
|
350 |
|
|
{
|
351 |
|
|
return 0;
|
352 |
|
|
}
|
353 |
|
|
|
354 |
bc649d9a
|
Leszek Koltunski
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
355 |
|
|
|
356 |
e6734aa9
|
Leszek Koltunski
|
float[][] getCuts(int numLayers)
|
357 |
bc649d9a
|
Leszek Koltunski
|
{
|
358 |
ef018c1b
|
Leszek Koltunski
|
if( mCuts==null )
|
359 |
|
|
{
|
360 |
|
|
float[] cut = new float[] {0.0f};
|
361 |
|
|
mCuts = new float[][] { cut,cut,cut,cut };
|
362 |
|
|
}
|
363 |
|
|
|
364 |
|
|
return mCuts;
|
365 |
|
|
}
|
366 |
|
|
|
367 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
368 |
|
|
|
369 |
|
|
private void getLayerRotatable(int numLayers)
|
370 |
|
|
{
|
371 |
|
|
if( mLayerRotatable==null )
|
372 |
|
|
{
|
373 |
|
|
int numAxis = ROT_AXIS.length;
|
374 |
|
|
boolean[] tmp = new boolean[numLayers];
|
375 |
|
|
for(int i=0; i<numLayers; i++) tmp[i] = true;
|
376 |
|
|
mLayerRotatable = new boolean[numAxis][];
|
377 |
|
|
for(int i=0; i<numAxis; i++) mLayerRotatable[i] = tmp;
|
378 |
|
|
}
|
379 |
bc649d9a
|
Leszek Koltunski
|
}
|
380 |
|
|
|
381 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
382 |
|
|
|
383 |
|
|
int getNumStickerTypes(int numLayers)
|
384 |
|
|
{
|
385 |
963921af
|
Leszek Koltunski
|
return 3;
|
386 |
bc649d9a
|
Leszek Koltunski
|
}
|
387 |
|
|
|
388 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
389 |
|
|
|
390 |
|
|
int getNumCubitFaces()
|
391 |
|
|
{
|
392 |
|
|
return 8;
|
393 |
|
|
}
|
394 |
|
|
|
395 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
396 |
e1dc3366
|
Leszek Koltunski
|
// PUBLIC API
|
397 |
bc649d9a
|
Leszek Koltunski
|
|
398 |
e1dc3366
|
Leszek Koltunski
|
public Static3D[] getRotationAxis()
|
399 |
|
|
{
|
400 |
|
|
return ROT_AXIS;
|
401 |
|
|
}
|
402 |
|
|
|
403 |
e9a87113
|
Leszek Koltunski
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
404 |
|
|
|
405 |
|
|
public Movement getMovement()
|
406 |
|
|
{
|
407 |
ef018c1b
|
Leszek Koltunski
|
if( mMovement==null )
|
408 |
|
|
{
|
409 |
|
|
int numLayers = getNumLayers();
|
410 |
|
|
if( mCuts==null ) getCuts(numLayers);
|
411 |
|
|
getLayerRotatable(numLayers);
|
412 |
|
|
|
413 |
|
|
mMovement = new MovementUltimate(mCuts,mLayerRotatable,numLayers);
|
414 |
|
|
}
|
415 |
e9a87113
|
Leszek Koltunski
|
return mMovement;
|
416 |
|
|
}
|
417 |
|
|
|
418 |
e1dc3366
|
Leszek Koltunski
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
419 |
|
|
|
420 |
|
|
public int[] getBasicAngle()
|
421 |
|
|
{
|
422 |
963921af
|
Leszek Koltunski
|
if( mBasicAngle ==null ) mBasicAngle = new int[] { 3,3,3,3 };
|
423 |
|
|
return mBasicAngle;
|
424 |
e1dc3366
|
Leszek Koltunski
|
}
|
425 |
|
|
|
426 |
bc649d9a
|
Leszek Koltunski
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
427 |
|
|
|
428 |
|
|
public int getObjectName(int numLayers)
|
429 |
|
|
{
|
430 |
|
|
return R.string.ulti2;
|
431 |
|
|
}
|
432 |
|
|
|
433 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
434 |
|
|
|
435 |
|
|
public int getInventor(int numLayers)
|
436 |
|
|
{
|
437 |
|
|
return R.string.ulti2_inventor;
|
438 |
|
|
}
|
439 |
|
|
|
440 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
441 |
|
|
|
442 |
|
|
public int getComplexity(int numLayers)
|
443 |
|
|
{
|
444 |
|
|
return 6;
|
445 |
|
|
}
|
446 |
|
|
}
|