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