1 |
29b82486
|
Leszek Koltunski
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
2 |
|
|
// Copyright 2021 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.objectlib.objects;
|
21 |
|
|
|
22 |
59c20632
|
Leszek Koltunski
|
import static org.distorted.objectlib.main.Movement.MOVEMENT_TETRAHEDRON;
|
23 |
29b82486
|
Leszek Koltunski
|
import static org.distorted.objectlib.main.Movement.TYPE_NOT_SPLIT;
|
24 |
|
|
|
25 |
|
|
import android.content.res.Resources;
|
26 |
|
|
|
27 |
|
|
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 |
|
|
|
33 |
|
|
import org.distorted.objectlib.R;
|
34 |
|
|
import org.distorted.objectlib.main.Movement4;
|
35 |
8592461c
|
Leszek Koltunski
|
import org.distorted.objectlib.main.ObjectControl;
|
36 |
8005e762
|
Leszek Koltunski
|
import org.distorted.objectlib.main.ObjectType;
|
37 |
198c5bf0
|
Leszek Koltunski
|
import org.distorted.objectlib.helpers.ObjectShape;
|
38 |
|
|
import org.distorted.objectlib.helpers.ObjectSticker;
|
39 |
|
|
import org.distorted.objectlib.helpers.ScrambleState;
|
40 |
29b82486
|
Leszek Koltunski
|
import org.distorted.objectlib.main.Twisty4;
|
41 |
|
|
|
42 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
43 |
|
|
|
44 |
|
|
public class TwistyJing extends Twisty4
|
45 |
|
|
{
|
46 |
|
|
static final Static3D[] ROT_AXIS = new Static3D[]
|
47 |
|
|
{
|
48 |
|
|
new Static3D( 0,-SQ3/3,-SQ6/3),
|
49 |
|
|
new Static3D( 0,-SQ3/3,+SQ6/3),
|
50 |
|
|
new Static3D(+SQ6/3,+SQ3/3, 0),
|
51 |
|
|
new Static3D(-SQ6/3,+SQ3/3, 0),
|
52 |
|
|
};
|
53 |
|
|
|
54 |
|
|
static final float F = 0.48f; // length of the edge of the corner cubit. Keep<0.5
|
55 |
|
|
// Assuming the length of the edge of the whole
|
56 |
|
|
// tetrahedron is 2.0 (ie standard, equal to numLayers
|
57 |
|
|
|
58 |
|
|
private ScrambleState[] mStates;
|
59 |
|
|
private int[] mBasicAngle;
|
60 |
|
|
private int[] mRotQuat;
|
61 |
|
|
private Static4D[] mQuats;
|
62 |
|
|
private float[][] mCuts;
|
63 |
|
|
private float[][] mCenters;
|
64 |
|
|
private int[][] mFaceMap;
|
65 |
|
|
private ObjectSticker[] mStickers;
|
66 |
|
|
|
67 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
68 |
|
|
|
69 |
a57e6870
|
Leszek Koltunski
|
public TwistyJing(int[] numL, Static4D quat, Static3D move, DistortedTexture texture,
|
70 |
e7daa161
|
Leszek Koltunski
|
MeshSquare mesh, DistortedEffects effects, Resources res, int surfaceW, int surfaceH)
|
71 |
29b82486
|
Leszek Koltunski
|
{
|
72 |
e7daa161
|
Leszek Koltunski
|
super(numL, numL[0], quat, move, texture, mesh, effects, res, surfaceW, surfaceH);
|
73 |
29b82486
|
Leszek Koltunski
|
}
|
74 |
|
|
|
75 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
76 |
|
|
|
77 |
f9a81f52
|
Leszek Koltunski
|
public ScrambleState[] getScrambleStates()
|
78 |
29b82486
|
Leszek Koltunski
|
{
|
79 |
|
|
if( mStates==null )
|
80 |
|
|
{
|
81 |
|
|
int[] tmp = {0,-1,0, 0,1,0, 1,-1,0, 1,1,0 };
|
82 |
|
|
|
83 |
|
|
mStates = new ScrambleState[]
|
84 |
|
|
{
|
85 |
|
|
new ScrambleState( new int[][] {tmp,tmp,tmp,tmp} )
|
86 |
|
|
};
|
87 |
|
|
}
|
88 |
|
|
|
89 |
|
|
return mStates;
|
90 |
|
|
}
|
91 |
|
|
|
92 |
4e1dc313
|
Leszek Koltunski
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
93 |
|
|
|
94 |
a57e6870
|
Leszek Koltunski
|
protected int getResource(int[] numLayers)
|
95 |
4e1dc313
|
Leszek Koltunski
|
{
|
96 |
|
|
return R.raw.jing;
|
97 |
|
|
}
|
98 |
|
|
|
99 |
29b82486
|
Leszek Koltunski
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
100 |
|
|
|
101 |
|
|
private void initializeQuats()
|
102 |
|
|
{
|
103 |
|
|
mQuats = new Static4D[]
|
104 |
|
|
{
|
105 |
|
|
new Static4D( 0.0f, 0.0f, 0.0f, 1.0f),
|
106 |
|
|
new Static4D( 0.0f, 1.0f, 0.0f, 0.0f),
|
107 |
|
|
new Static4D( SQ2/2, 0.5f, 0.0f, 0.5f),
|
108 |
|
|
new Static4D(-SQ2/2, 0.5f, 0.0f, 0.5f),
|
109 |
|
|
new Static4D( 0.0f, -0.5f, -SQ2/2, 0.5f),
|
110 |
|
|
new Static4D( 0.0f, -0.5f, SQ2/2, 0.5f),
|
111 |
|
|
new Static4D( SQ2/2, 0.5f, 0.0f, -0.5f),
|
112 |
|
|
new Static4D(-SQ2/2, 0.5f, 0.0f, -0.5f),
|
113 |
|
|
new Static4D( 0.0f, -0.5f, -SQ2/2, -0.5f),
|
114 |
|
|
new Static4D( 0.0f, -0.5f, SQ2/2, -0.5f),
|
115 |
|
|
new Static4D( SQ2/2, 0.0f, SQ2/2, 0.0f),
|
116 |
|
|
new Static4D(-SQ2/2, 0.0f, SQ2/2, 0.0f)
|
117 |
|
|
};
|
118 |
|
|
}
|
119 |
|
|
|
120 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
121 |
|
|
|
122 |
a57e6870
|
Leszek Koltunski
|
protected int[] getSolvedQuats(int cubit, int[] numLayers)
|
123 |
29b82486
|
Leszek Koltunski
|
{
|
124 |
|
|
if( mQuats==null ) initializeQuats();
|
125 |
|
|
int status = retCubitSolvedStatus(cubit,numLayers);
|
126 |
|
|
return status<0 ? null : buildSolvedQuats(Movement4.FACE_AXIS[status],mQuats);
|
127 |
|
|
}
|
128 |
|
|
|
129 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
130 |
|
|
|
131 |
a57e6870
|
Leszek Koltunski
|
protected float[][] getCubitPositions(int[] numLayers)
|
132 |
29b82486
|
Leszek Koltunski
|
{
|
133 |
|
|
if( mCenters==null )
|
134 |
|
|
{
|
135 |
|
|
mCenters = new float[][]
|
136 |
|
|
{
|
137 |
|
|
{ 0.000f, -SQ2/2, 1.000f },
|
138 |
|
|
{ 0.000f, -SQ2/2,-1.000f },
|
139 |
|
|
{-1.000f, SQ2/2, 0.000f },
|
140 |
|
|
{ 1.000f, SQ2/2, 0.000f },
|
141 |
|
|
|
142 |
|
|
{ 0.000f, -SQ2/2, 0.000f },
|
143 |
|
|
{-0.500f, 0.000f, 0.500f },
|
144 |
|
|
{ 0.500f, 0.000f, 0.500f },
|
145 |
|
|
{-0.500f, 0.000f,-0.500f },
|
146 |
|
|
{ 0.500f, 0.000f,-0.500f },
|
147 |
|
|
{ 0.000f, SQ2/2, 0.000f },
|
148 |
|
|
|
149 |
|
|
{ 0.000f, SQ2/6, 1.0f/3 },
|
150 |
|
|
{ 0.000f, SQ2/6,-1.0f/3 },
|
151 |
|
|
{-1.0f/3, -SQ2/6, 0.000f },
|
152 |
|
|
{ 1.0f/3, -SQ2/6, 0.000f },
|
153 |
|
|
};
|
154 |
|
|
}
|
155 |
|
|
|
156 |
|
|
return mCenters;
|
157 |
|
|
}
|
158 |
|
|
|
159 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
160 |
|
|
|
161 |
|
|
protected Static4D[] getQuats()
|
162 |
|
|
{
|
163 |
|
|
if( mQuats==null ) initializeQuats();
|
164 |
|
|
return mQuats;
|
165 |
|
|
}
|
166 |
|
|
|
167 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
168 |
|
|
|
169 |
59c20632
|
Leszek Koltunski
|
public int getSolvedFunctionIndex()
|
170 |
29b82486
|
Leszek Koltunski
|
{
|
171 |
|
|
return 0;
|
172 |
|
|
}
|
173 |
|
|
|
174 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
175 |
|
|
|
176 |
a57e6870
|
Leszek Koltunski
|
protected int getNumStickerTypes(int[] numLayers)
|
177 |
29b82486
|
Leszek Koltunski
|
{
|
178 |
|
|
return 3;
|
179 |
|
|
}
|
180 |
|
|
|
181 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
182 |
|
|
|
183 |
a57e6870
|
Leszek Koltunski
|
protected float[][] getCuts(int[] numLayers)
|
184 |
29b82486
|
Leszek Koltunski
|
{
|
185 |
|
|
if( mCuts==null )
|
186 |
|
|
{
|
187 |
|
|
float[] cut = { (F-0.5f)*(SQ6/3) };
|
188 |
|
|
mCuts = new float[][] { cut,cut,cut,cut };
|
189 |
|
|
}
|
190 |
|
|
|
191 |
|
|
return mCuts;
|
192 |
|
|
}
|
193 |
|
|
|
194 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
195 |
|
|
|
196 |
59c20632
|
Leszek Koltunski
|
public boolean[][] getLayerRotatable(int[] numLayers)
|
197 |
29b82486
|
Leszek Koltunski
|
{
|
198 |
59c20632
|
Leszek Koltunski
|
int numAxis = ROT_AXIS.length;
|
199 |
|
|
boolean[][] layerRotatable = new boolean[numAxis][];
|
200 |
a57e6870
|
Leszek Koltunski
|
|
201 |
59c20632
|
Leszek Koltunski
|
for(int i=0; i<numAxis; i++)
|
202 |
|
|
{
|
203 |
|
|
layerRotatable[i] = new boolean[numLayers[i]];
|
204 |
|
|
for(int j=0; j<numLayers[i]; j++) layerRotatable[i][j] = true;
|
205 |
29b82486
|
Leszek Koltunski
|
}
|
206 |
59c20632
|
Leszek Koltunski
|
|
207 |
|
|
return layerRotatable;
|
208 |
|
|
}
|
209 |
|
|
|
210 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
211 |
|
|
|
212 |
|
|
public int getMovementType()
|
213 |
|
|
{
|
214 |
|
|
return MOVEMENT_TETRAHEDRON;
|
215 |
|
|
}
|
216 |
|
|
|
217 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
218 |
|
|
|
219 |
|
|
public int getMovementSplit()
|
220 |
|
|
{
|
221 |
|
|
return TYPE_NOT_SPLIT;
|
222 |
|
|
}
|
223 |
|
|
|
224 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
225 |
|
|
|
226 |
|
|
public int[][][] getEnabled()
|
227 |
|
|
{
|
228 |
|
|
return new int[][][]
|
229 |
|
|
{
|
230 |
|
|
{{1,2,3}},{{0,2,3}},{{0,1,3}},{{0,1,2}}
|
231 |
|
|
};
|
232 |
|
|
}
|
233 |
|
|
|
234 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
235 |
|
|
|
236 |
|
|
public float[] getDist3D(int[] numLayers)
|
237 |
|
|
{
|
238 |
|
|
return null;
|
239 |
29b82486
|
Leszek Koltunski
|
}
|
240 |
|
|
|
241 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
242 |
|
|
|
243 |
|
|
protected int getNumCubitFaces()
|
244 |
|
|
{
|
245 |
|
|
return 6;
|
246 |
|
|
}
|
247 |
|
|
|
248 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
249 |
|
|
|
250 |
a57e6870
|
Leszek Koltunski
|
protected int getFaceColor(int cubit, int cubitface, int[] numLayers)
|
251 |
29b82486
|
Leszek Koltunski
|
{
|
252 |
|
|
if( mFaceMap==null )
|
253 |
|
|
{
|
254 |
|
|
// Colors of the faces of cubits.
|
255 |
|
|
// GREEN 0 YELLOW 1 BLUE 2 RED 3
|
256 |
|
|
// GREEN 4 YELLOW 5 BLUE 6 RED 7
|
257 |
|
|
// GREEN 8 YELLOW 9 BLUE 10 RED 11
|
258 |
|
|
mFaceMap = new int[][]
|
259 |
|
|
{
|
260 |
|
|
{ 0, 3, 2, 12, 12, 12 },
|
261 |
|
|
{ 1, 2, 3, 12, 12, 12 },
|
262 |
|
|
{ 1, 0, 2, 12, 12, 12 },
|
263 |
|
|
{ 1, 3, 0, 12, 12, 12 },
|
264 |
|
|
|
265 |
|
|
{ 7, 6, 12, 12, 12, 12 },
|
266 |
|
|
{ 4, 6, 12, 12, 12, 12 },
|
267 |
|
|
{ 7, 4, 12, 12, 12, 12 },
|
268 |
|
|
{ 5, 6, 12, 12, 12, 12 },
|
269 |
|
|
{ 7, 5, 12, 12, 12, 12 },
|
270 |
|
|
{ 4, 5, 12, 12, 12, 12 },
|
271 |
|
|
|
272 |
|
|
{ 8, 12, 12, 12, 12, 12 },
|
273 |
|
|
{ 9, 12, 12, 12, 12, 12 },
|
274 |
|
|
{ 10, 12, 12, 12, 12, 12 },
|
275 |
|
|
{ 11, 12, 12, 12, 12, 12 },
|
276 |
|
|
};
|
277 |
|
|
}
|
278 |
|
|
|
279 |
|
|
return mFaceMap[cubit][cubitface];
|
280 |
|
|
}
|
281 |
|
|
|
282 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
283 |
|
|
|
284 |
a57e6870
|
Leszek Koltunski
|
protected ObjectShape getObjectShape(int cubit, int[] numLayers)
|
285 |
29b82486
|
Leszek Koltunski
|
{
|
286 |
|
|
int variant = getCubitVariant(cubit,numLayers);
|
287 |
|
|
|
288 |
|
|
final float X = F/2;
|
289 |
|
|
final float Y = F*SQ2/2;
|
290 |
|
|
final float Z =-F/2;
|
291 |
|
|
final float L = (2.0f-3*F);
|
292 |
|
|
final float X2= L/2;
|
293 |
|
|
final float Y2= L*SQ2/2;
|
294 |
|
|
final float Z2=-L/2;
|
295 |
|
|
final float D = F/L;
|
296 |
|
|
final float G = 1.0f-F;
|
297 |
|
|
|
298 |
|
|
if( variant==0 )
|
299 |
|
|
{
|
300 |
|
|
double[][] vertices = new double[][]
|
301 |
|
|
{
|
302 |
|
|
{ 0.0, 0.0, 0.0 },
|
303 |
|
|
{ X, Y, Z },
|
304 |
|
|
{ 0.0, 2*Y, 2*Z },
|
305 |
|
|
{ -X, Y, Z },
|
306 |
|
|
{ 0.0, 0.0, -F },
|
307 |
|
|
{ X, Y, Z-F },
|
308 |
|
|
{ 0.0, 2*Y, 2*Z-F },
|
309 |
|
|
{ -X, Y, Z-F },
|
310 |
|
|
};
|
311 |
|
|
int[][] vert_indices = new int[][]
|
312 |
|
|
{
|
313 |
|
|
{0,1,2,3},
|
314 |
|
|
{1,0,4,5},
|
315 |
|
|
{7,4,0,3},
|
316 |
|
|
{1,5,6,2},
|
317 |
|
|
{7,3,2,6},
|
318 |
|
|
{4,7,6,5}
|
319 |
|
|
};
|
320 |
|
|
|
321 |
2289cab1
|
Leszek Koltunski
|
float[][] bands = new float[][] { {0.015f,35,0.25f*F,0.5f*F,5,1,1},{0.001f,35,0.25f*F,0.5f*F,5,1,1} };
|
322 |
29b82486
|
Leszek Koltunski
|
int[] bandIndices = new int[] { 0,0,0,1,1,1 };
|
323 |
|
|
float[][] corners = new float[][] { {0.08f,0.20f*F},{0.07f,0.20f*F} };
|
324 |
|
|
int[] cornerIndices = new int[] { 0,1,1,-1,1,-1,-1,-1 };
|
325 |
854b09be
|
Leszek Koltunski
|
float[][] centers = new float[][] { { 0.0f, Y, Z-F/2} };
|
326 |
29b82486
|
Leszek Koltunski
|
int[] centerIndices = new int[] { 0,0,0,-1,0,-1,-1,-1 };
|
327 |
|
|
return new ObjectShape(vertices,vert_indices,bands,bandIndices,corners,cornerIndices,centers,centerIndices,getNumCubitFaces(), null);
|
328 |
|
|
}
|
329 |
|
|
else if( variant==1 )
|
330 |
|
|
{
|
331 |
|
|
double[][] vertices = new double[][]
|
332 |
|
|
{
|
333 |
|
|
{ 0.0, 0.0, G },
|
334 |
|
|
{ X, Y, Z+G },
|
335 |
|
|
{ 0.0, 2*Y, 2*Z+G },
|
336 |
|
|
{ -X, Y, Z+G },
|
337 |
|
|
{ 0.0, 0.0, -G },
|
338 |
|
|
{ X, Y, -Z-G },
|
339 |
|
|
{ 0.0, 2*Y,-2*Z-G },
|
340 |
|
|
{ -X, Y, -Z-G },
|
341 |
|
|
};
|
342 |
|
|
int[][] vert_indices = new int[][]
|
343 |
|
|
{
|
344 |
|
|
{0,4,5,1},
|
345 |
|
|
{3,7,4,0},
|
346 |
|
|
{0,1,2,3},
|
347 |
|
|
{4,7,6,5},
|
348 |
|
|
{1,5,6,2},
|
349 |
|
|
{2,6,7,3}
|
350 |
|
|
};
|
351 |
|
|
|
352 |
|
|
float[][] bands = new float[][] { {0.015f,35,0.5f*F,F,5,1,1},{0.001f,35,0.5f*F,F,5,1,1} };
|
353 |
|
|
int[] bandIndices = new int[] { 0,0,1,1,1,1 };
|
354 |
|
|
float[][] corners = new float[][] { {0.07f,0.20f*F} };
|
355 |
|
|
int[] cornerIndices = new int[] { 0,0,-1,0,0,0,-1,0 };
|
356 |
|
|
float[][] centers = new float[][] { { 0, F*SQ2/2, 0 } };
|
357 |
|
|
int[] centerIndices = new int[] { 0,0,-1,0,0,0,-1,0 };
|
358 |
|
|
return new ObjectShape(vertices,vert_indices,bands,bandIndices,corners,cornerIndices,centers,centerIndices,getNumCubitFaces(), null);
|
359 |
|
|
}
|
360 |
|
|
else
|
361 |
|
|
{
|
362 |
|
|
double[][] vertices = new double[][]
|
363 |
|
|
{
|
364 |
|
|
{ 0.0, -2*Y2/3, -2*Z2/3 },
|
365 |
|
|
{ X2, Y2/3, Z2/3 },
|
366 |
|
|
{ -X2, Y2/3, Z2/3 },
|
367 |
|
|
{ 0.0, -2*Y2/3,-2*Z2/3+2*D*Z2 },
|
368 |
|
|
{ X2-D*X2, Y2/3-D*Y2, Z2/3+D*Z2 },
|
369 |
|
|
{ -X2+D*X2, Y2/3-D*Y2, Z2/3+D*Z2 },
|
370 |
|
|
};
|
371 |
|
|
int[][] vert_indices = new int[][]
|
372 |
|
|
{
|
373 |
|
|
{0,1,2},
|
374 |
|
|
{3,5,4},
|
375 |
|
|
{0,3,4,1},
|
376 |
|
|
{5,3,0,2},
|
377 |
|
|
{4,5,2,1}
|
378 |
|
|
};
|
379 |
|
|
|
380 |
|
|
float[][] bands = new float[][] { {0.020f,35,0.20f*L,0.6f*L,5,1,1}, {0.001f,35,0.05f*L,0.1f*L,5,1,1} };
|
381 |
|
|
int[] bandIndices = new int[] { 0,1,1,1,1,1 };
|
382 |
|
|
float[][] corners = new float[][] { {0.04f,0.6f*F} };
|
383 |
|
|
int[] cornerIndices = new int[] { 0,0,0,-1,-1,-1 };
|
384 |
|
|
float[][] centers = new float[][] { { 0, -2*Y/3, 4*Z/3 } };
|
385 |
|
|
int[] centerIndices = new int[] { 0,0,0,-1,-1,-1 };
|
386 |
|
|
return new ObjectShape(vertices,vert_indices,bands,bandIndices,corners,cornerIndices,centers,centerIndices,getNumCubitFaces(), null);
|
387 |
|
|
}
|
388 |
|
|
}
|
389 |
|
|
|
390 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
391 |
|
|
|
392 |
a57e6870
|
Leszek Koltunski
|
protected Static4D getQuat(int cubit, int[] numLayers)
|
393 |
29b82486
|
Leszek Koltunski
|
{
|
394 |
|
|
if( mQuats==null ) initializeQuats();
|
395 |
|
|
if( mRotQuat ==null ) mRotQuat = new int[] {0,1,2,7,0,2,7,6,3,10,0,1,3,5};
|
396 |
|
|
return mQuats[mRotQuat[cubit]];
|
397 |
|
|
}
|
398 |
|
|
|
399 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
400 |
|
|
|
401 |
a57e6870
|
Leszek Koltunski
|
protected int getNumCubitVariants(int[] numLayers)
|
402 |
29b82486
|
Leszek Koltunski
|
{
|
403 |
|
|
return 3;
|
404 |
|
|
}
|
405 |
|
|
|
406 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
407 |
|
|
|
408 |
a57e6870
|
Leszek Koltunski
|
protected int getCubitVariant(int cubit, int[] numLayers)
|
409 |
29b82486
|
Leszek Koltunski
|
{
|
410 |
|
|
return cubit<4 ? 0 : (cubit<10?1:2);
|
411 |
|
|
}
|
412 |
|
|
|
413 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
414 |
|
|
|
415 |
|
|
protected ObjectSticker retSticker(int face)
|
416 |
|
|
{
|
417 |
|
|
if( mStickers==null )
|
418 |
|
|
{
|
419 |
|
|
float[][] STICKERS = new float[][]
|
420 |
|
|
{
|
421 |
|
|
{ 0.0f, -0.5f, 0.28867516f, 0.0f, 0.0f, 0.5f, -0.28867516f, 0.0f },
|
422 |
|
|
{ -0.5f, 0.11983269f, 0.27964598f, -0.43146032f, 0.3200817f, 0.007388768f, -0.09972769f, 0.30423886f },
|
423 |
|
|
{ 0.0f, -0.5f, 0.43301272f, 0.25f, -0.43301272f, 0.25f },
|
424 |
|
|
};
|
425 |
|
|
|
426 |
|
|
mStickers = new ObjectSticker[STICKERS.length];
|
427 |
|
|
final float R1 = 0.05f;
|
428 |
|
|
final float R2 = 0.10f;
|
429 |
|
|
final float R3 = 0.03f;
|
430 |
|
|
final float[][] radii = { { R1,R1,R1,R1 },{ R3,R3,R2,R2 },{ R1,R1,R1 } };
|
431 |
8592461c
|
Leszek Koltunski
|
float[] strokes = { 0.06f, 0.03f, 0.05f };
|
432 |
|
|
|
433 |
|
|
if( ObjectControl.isInIconMode() )
|
434 |
|
|
{
|
435 |
|
|
strokes[0]*=2.0f;
|
436 |
|
|
strokes[1]*=2.0f;
|
437 |
|
|
strokes[2]*=2.0f;
|
438 |
|
|
}
|
439 |
29b82486
|
Leszek Koltunski
|
|
440 |
|
|
for(int s=0; s<STICKERS.length; s++)
|
441 |
|
|
{
|
442 |
|
|
mStickers[s] = new ObjectSticker(STICKERS[s],null,radii[s],strokes[s]);
|
443 |
|
|
}
|
444 |
|
|
}
|
445 |
|
|
|
446 |
|
|
return mStickers[face/NUM_FACE_COLORS];
|
447 |
|
|
}
|
448 |
|
|
|
449 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
450 |
|
|
// PUBLIC API
|
451 |
|
|
|
452 |
|
|
public Static3D[] getRotationAxis()
|
453 |
|
|
{
|
454 |
|
|
return ROT_AXIS;
|
455 |
|
|
}
|
456 |
|
|
|
457 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
458 |
|
|
|
459 |
|
|
public int[] getBasicAngle()
|
460 |
|
|
{
|
461 |
|
|
if( mBasicAngle ==null ) mBasicAngle = new int[] { 3,3,3,3 };
|
462 |
|
|
return mBasicAngle;
|
463 |
|
|
}
|
464 |
|
|
|
465 |
61aa85e4
|
Leszek Koltunski
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
466 |
|
|
|
467 |
a57e6870
|
Leszek Koltunski
|
public ObjectType intGetObjectType(int[] numLayers)
|
468 |
61aa85e4
|
Leszek Koltunski
|
{
|
469 |
8005e762
|
Leszek Koltunski
|
return ObjectType.JING_2;
|
470 |
61aa85e4
|
Leszek Koltunski
|
}
|
471 |
|
|
|
472 |
29b82486
|
Leszek Koltunski
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
473 |
|
|
|
474 |
a57e6870
|
Leszek Koltunski
|
public int getObjectName(int[] numLayers)
|
475 |
29b82486
|
Leszek Koltunski
|
{
|
476 |
|
|
return R.string.jing;
|
477 |
|
|
}
|
478 |
|
|
|
479 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
480 |
|
|
|
481 |
a57e6870
|
Leszek Koltunski
|
public int getInventor(int[] numLayers)
|
482 |
29b82486
|
Leszek Koltunski
|
{
|
483 |
|
|
return R.string.jing_inventor;
|
484 |
|
|
}
|
485 |
|
|
|
486 |
59c20632
|
Leszek Koltunski
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
487 |
|
|
|
488 |
|
|
public int getYearOfInvention(int[] numLayers)
|
489 |
|
|
{
|
490 |
|
|
return 1991;
|
491 |
|
|
}
|
492 |
|
|
|
493 |
29b82486
|
Leszek Koltunski
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
494 |
|
|
|
495 |
a57e6870
|
Leszek Koltunski
|
public int getComplexity(int[] numLayers)
|
496 |
29b82486
|
Leszek Koltunski
|
{
|
497 |
|
|
return 4;
|
498 |
|
|
}
|
499 |
|
|
}
|