1 |
29b82486
|
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.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.type.Static3D;
|
28 |
|
|
import org.distorted.library.type.Static4D;
|
29 |
|
|
|
30 |
|
|
import org.distorted.objectlib.R;
|
31 |
|
|
import org.distorted.objectlib.main.Movement4;
|
32 |
8592461c
|
Leszek Koltunski
|
import org.distorted.objectlib.main.ObjectControl;
|
33 |
8005e762
|
Leszek Koltunski
|
import org.distorted.objectlib.main.ObjectType;
|
34 |
198c5bf0
|
Leszek Koltunski
|
import org.distorted.objectlib.helpers.ObjectShape;
|
35 |
|
|
import org.distorted.objectlib.helpers.ObjectSticker;
|
36 |
|
|
import org.distorted.objectlib.helpers.ScrambleState;
|
37 |
29b82486
|
Leszek Koltunski
|
import org.distorted.objectlib.main.Twisty4;
|
38 |
|
|
|
39 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
40 |
|
|
|
41 |
|
|
public class TwistyPyraminx extends Twisty4
|
42 |
|
|
{
|
43 |
|
|
static final Static3D[] ROT_AXIS = new Static3D[]
|
44 |
|
|
{
|
45 |
|
|
new Static3D( 0,-SQ3/3,-SQ6/3),
|
46 |
|
|
new Static3D( 0,-SQ3/3,+SQ6/3),
|
47 |
|
|
new Static3D(+SQ6/3,+SQ3/3, 0),
|
48 |
|
|
new Static3D(-SQ6/3,+SQ3/3, 0),
|
49 |
|
|
};
|
50 |
|
|
|
51 |
|
|
private ScrambleState[] mStates;
|
52 |
|
|
private int[] mBasicAngle;
|
53 |
|
|
private Static4D[] mQuats;
|
54 |
|
|
private float[][] mCuts;
|
55 |
|
|
private ObjectSticker[] mStickers;
|
56 |
|
|
|
57 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
58 |
|
|
|
59 |
7ba38dd4
|
Leszek Koltunski
|
public TwistyPyraminx(int[] numL, Static4D quat, Static3D move, Resources res)
|
60 |
29b82486
|
Leszek Koltunski
|
{
|
61 |
7ba38dd4
|
Leszek Koltunski
|
super(numL, numL[0], quat, move, res);
|
62 |
29b82486
|
Leszek Koltunski
|
}
|
63 |
|
|
|
64 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
65 |
|
|
|
66 |
f9a81f52
|
Leszek Koltunski
|
public ScrambleState[] getScrambleStates()
|
67 |
29b82486
|
Leszek Koltunski
|
{
|
68 |
|
|
if( mStates==null )
|
69 |
|
|
{
|
70 |
a57e6870
|
Leszek Koltunski
|
int[] numLayers = getNumLayers();
|
71 |
|
|
initializeScrambleStates(numLayers[0]);
|
72 |
29b82486
|
Leszek Koltunski
|
}
|
73 |
|
|
|
74 |
|
|
return mStates;
|
75 |
|
|
}
|
76 |
|
|
|
77 |
4e1dc313
|
Leszek Koltunski
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
78 |
|
|
|
79 |
a57e6870
|
Leszek Koltunski
|
protected int getResource(int[] numLayers)
|
80 |
4e1dc313
|
Leszek Koltunski
|
{
|
81 |
a57e6870
|
Leszek Koltunski
|
switch(numLayers[0])
|
82 |
4e1dc313
|
Leszek Koltunski
|
{
|
83 |
55fa6993
|
Leszek Koltunski
|
case 3: return R.raw.pyra_3;
|
84 |
|
|
case 4: return R.raw.pyra_4;
|
85 |
|
|
case 5: return R.raw.pyra_5;
|
86 |
4e1dc313
|
Leszek Koltunski
|
}
|
87 |
|
|
|
88 |
|
|
return 0;
|
89 |
|
|
}
|
90 |
|
|
|
91 |
29b82486
|
Leszek Koltunski
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
92 |
|
|
|
93 |
|
|
private void initializeQuats()
|
94 |
|
|
{
|
95 |
|
|
mQuats = new Static4D[]
|
96 |
|
|
{
|
97 |
|
|
new Static4D( 0.0f, 0.0f, 0.0f, 1.0f),
|
98 |
|
|
new Static4D( 0.0f, 1.0f, 0.0f, 0.0f),
|
99 |
|
|
new Static4D( SQ2/2, 0.5f, 0.0f, 0.5f),
|
100 |
|
|
new Static4D(-SQ2/2, 0.5f, 0.0f, 0.5f),
|
101 |
|
|
new Static4D( 0.0f, -0.5f, -SQ2/2, 0.5f),
|
102 |
|
|
new Static4D( 0.0f, -0.5f, SQ2/2, 0.5f),
|
103 |
|
|
new Static4D( SQ2/2, 0.5f, 0.0f, -0.5f),
|
104 |
|
|
new Static4D(-SQ2/2, 0.5f, 0.0f, -0.5f),
|
105 |
|
|
new Static4D( 0.0f, -0.5f, -SQ2/2, -0.5f),
|
106 |
|
|
new Static4D( 0.0f, -0.5f, SQ2/2, -0.5f),
|
107 |
|
|
new Static4D( SQ2/2, 0.0f, SQ2/2, 0.0f),
|
108 |
|
|
new Static4D(-SQ2/2, 0.0f, SQ2/2, 0.0f)
|
109 |
|
|
};
|
110 |
|
|
}
|
111 |
|
|
|
112 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
113 |
|
|
|
114 |
|
|
private int[][] generateState(int start, int end)
|
115 |
|
|
{
|
116 |
|
|
int len = end-start+1;
|
117 |
|
|
int[] tmp = new int[6*len];
|
118 |
|
|
|
119 |
|
|
for(int i=0; i<len; i++)
|
120 |
|
|
{
|
121 |
|
|
tmp[6*i ] = start;
|
122 |
|
|
tmp[6*i+1] = -1;
|
123 |
|
|
tmp[6*i+2] = start;
|
124 |
|
|
tmp[6*i+3] = start;
|
125 |
|
|
tmp[6*i+4] = +1;
|
126 |
|
|
tmp[6*i+5] = start;
|
127 |
|
|
|
128 |
|
|
start++;
|
129 |
|
|
}
|
130 |
|
|
|
131 |
|
|
return new int[][] {tmp,tmp,tmp,tmp};
|
132 |
|
|
}
|
133 |
|
|
|
134 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
135 |
|
|
|
136 |
|
|
private void initializeScrambleStates(int numLayers)
|
137 |
|
|
{
|
138 |
|
|
mStates = new ScrambleState[numLayers];
|
139 |
|
|
|
140 |
|
|
for(int i=0; i<numLayers-1; i++)
|
141 |
|
|
{
|
142 |
|
|
mStates[i] = new ScrambleState( generateState(0,numLayers-1-i) );
|
143 |
|
|
}
|
144 |
|
|
|
145 |
|
|
mStates[numLayers-1] = new ScrambleState( generateState(1,numLayers-2) );
|
146 |
|
|
}
|
147 |
|
|
|
148 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
149 |
|
|
|
150 |
7b832206
|
Leszek Koltunski
|
public int[] getSolvedQuats(int cubit, int[] numLayers)
|
151 |
29b82486
|
Leszek Koltunski
|
{
|
152 |
|
|
if( mQuats==null ) initializeQuats();
|
153 |
|
|
int status = retCubitSolvedStatus(cubit,numLayers);
|
154 |
|
|
return status<0 ? null : buildSolvedQuats(Movement4.FACE_AXIS[status],mQuats);
|
155 |
|
|
}
|
156 |
|
|
|
157 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
158 |
|
|
|
159 |
|
|
private void addTetrahedralLattice(int size, int index, float[][] pos)
|
160 |
|
|
{
|
161 |
|
|
final float DX = 1.0f;
|
162 |
|
|
final float DY = SQ2/2;
|
163 |
|
|
final float DZ = 1.0f;
|
164 |
|
|
|
165 |
|
|
float startX = 0.0f;
|
166 |
|
|
float startY =-DY*(size-1)/2;
|
167 |
|
|
float startZ = DZ*(size-1)/2;
|
168 |
|
|
|
169 |
|
|
for(int layer=0; layer<size; layer++)
|
170 |
|
|
{
|
171 |
|
|
float currX = startX;
|
172 |
|
|
float currY = startY;
|
173 |
|
|
|
174 |
|
|
for(int x=0; x<layer+1; x++)
|
175 |
|
|
{
|
176 |
|
|
float currZ = startZ;
|
177 |
|
|
|
178 |
|
|
for(int z=0; z<size-layer; z++)
|
179 |
|
|
{
|
180 |
|
|
pos[index] = new float[] {currX,currY,currZ};
|
181 |
|
|
index++;
|
182 |
|
|
currZ -= DZ;
|
183 |
|
|
}
|
184 |
|
|
|
185 |
|
|
currX += DX;
|
186 |
|
|
}
|
187 |
|
|
|
188 |
|
|
startX-=DX/2;
|
189 |
|
|
startY+=DY;
|
190 |
|
|
startZ-=DZ/2;
|
191 |
|
|
}
|
192 |
|
|
}
|
193 |
|
|
|
194 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
195 |
|
|
// there are (n^3-n)/6 octahedrons and ((n+1)^3 - (n+1))/6 tetrahedrons
|
196 |
|
|
|
197 |
7b832206
|
Leszek Koltunski
|
public float[][] getCubitPositions(int[] numLayers)
|
198 |
29b82486
|
Leszek Koltunski
|
{
|
199 |
a57e6870
|
Leszek Koltunski
|
int numL = numLayers[0];
|
200 |
|
|
int numOcta = (numL-1)*numL*(numL+1)/6;
|
201 |
|
|
int numTetra= numL*(numL+1)*(numL+2)/6;
|
202 |
29b82486
|
Leszek Koltunski
|
float[][] ret = new float[numOcta+numTetra][];
|
203 |
|
|
|
204 |
a57e6870
|
Leszek Koltunski
|
addTetrahedralLattice(numL-1, 0,ret);
|
205 |
|
|
addTetrahedralLattice(numL ,numOcta,ret);
|
206 |
29b82486
|
Leszek Koltunski
|
|
207 |
|
|
return ret;
|
208 |
|
|
}
|
209 |
|
|
|
210 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
211 |
|
|
|
212 |
1bb09f88
|
Leszek Koltunski
|
public Static4D[] getQuats()
|
213 |
29b82486
|
Leszek Koltunski
|
{
|
214 |
|
|
if( mQuats==null ) initializeQuats();
|
215 |
|
|
return mQuats;
|
216 |
|
|
}
|
217 |
|
|
|
218 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
219 |
|
|
|
220 |
59c20632
|
Leszek Koltunski
|
public int getSolvedFunctionIndex()
|
221 |
29b82486
|
Leszek Koltunski
|
{
|
222 |
|
|
return 0;
|
223 |
|
|
}
|
224 |
|
|
|
225 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
226 |
|
|
|
227 |
1bb09f88
|
Leszek Koltunski
|
public int getNumStickerTypes(int[] numLayers)
|
228 |
29b82486
|
Leszek Koltunski
|
{
|
229 |
|
|
return 1;
|
230 |
|
|
}
|
231 |
|
|
|
232 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
233 |
|
|
|
234 |
7bbfc84f
|
Leszek Koltunski
|
public float[][] getCuts(int[] numLayers)
|
235 |
29b82486
|
Leszek Koltunski
|
{
|
236 |
|
|
if( mCuts==null )
|
237 |
|
|
{
|
238 |
a57e6870
|
Leszek Koltunski
|
int numL = numLayers[0];
|
239 |
|
|
mCuts = new float[4][numL-1];
|
240 |
29b82486
|
Leszek Koltunski
|
|
241 |
a57e6870
|
Leszek Koltunski
|
for(int i=0; i<numL-1; i++)
|
242 |
29b82486
|
Leszek Koltunski
|
{
|
243 |
a57e6870
|
Leszek Koltunski
|
float cut = (1.0f+i-numL/4.0f)*(SQ6/3);
|
244 |
29b82486
|
Leszek Koltunski
|
mCuts[0][i] = cut;
|
245 |
|
|
mCuts[1][i] = cut;
|
246 |
|
|
mCuts[2][i] = cut;
|
247 |
|
|
mCuts[3][i] = cut;
|
248 |
|
|
}
|
249 |
|
|
}
|
250 |
|
|
|
251 |
|
|
return mCuts;
|
252 |
|
|
}
|
253 |
|
|
|
254 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
255 |
|
|
|
256 |
59c20632
|
Leszek Koltunski
|
public boolean[][] getLayerRotatable(int[] numLayers)
|
257 |
29b82486
|
Leszek Koltunski
|
{
|
258 |
59c20632
|
Leszek Koltunski
|
int numAxis = ROT_AXIS.length;
|
259 |
|
|
boolean[][] layerRotatable = new boolean[numAxis][];
|
260 |
a57e6870
|
Leszek Koltunski
|
|
261 |
59c20632
|
Leszek Koltunski
|
for(int i=0; i<numAxis; i++)
|
262 |
|
|
{
|
263 |
|
|
layerRotatable[i] = new boolean[numLayers[i]];
|
264 |
|
|
for(int j=0; j<numLayers[i]; j++) layerRotatable[i][j] = true;
|
265 |
29b82486
|
Leszek Koltunski
|
}
|
266 |
59c20632
|
Leszek Koltunski
|
|
267 |
|
|
return layerRotatable;
|
268 |
|
|
}
|
269 |
|
|
|
270 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
271 |
|
|
|
272 |
|
|
public int getMovementType()
|
273 |
|
|
{
|
274 |
|
|
return MOVEMENT_TETRAHEDRON;
|
275 |
|
|
}
|
276 |
|
|
|
277 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
278 |
|
|
|
279 |
|
|
public int getMovementSplit()
|
280 |
|
|
{
|
281 |
|
|
return TYPE_NOT_SPLIT;
|
282 |
|
|
}
|
283 |
|
|
|
284 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
285 |
|
|
|
286 |
|
|
public int[][][] getEnabled()
|
287 |
|
|
{
|
288 |
|
|
return new int[][][] { {{1,2,3}},{{0,2,3}},{{0,1,3}},{{0,1,2}} };
|
289 |
|
|
}
|
290 |
|
|
|
291 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
292 |
|
|
|
293 |
|
|
public float[] getDist3D(int[] numLayers)
|
294 |
|
|
{
|
295 |
|
|
return null;
|
296 |
29b82486
|
Leszek Koltunski
|
}
|
297 |
|
|
|
298 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
299 |
|
|
|
300 |
a75ae1ee
|
Leszek Koltunski
|
public int getNumCubitFaces()
|
301 |
29b82486
|
Leszek Koltunski
|
{
|
302 |
|
|
return 8;
|
303 |
|
|
}
|
304 |
|
|
|
305 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
306 |
|
|
|
307 |
|
|
private int getNumOctahedrons(int numLayers)
|
308 |
|
|
{
|
309 |
|
|
return (numLayers-1)*numLayers*(numLayers+1)/6;
|
310 |
|
|
}
|
311 |
|
|
|
312 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
313 |
|
|
|
314 |
a75ae1ee
|
Leszek Koltunski
|
private int faceColor(int cubit, int face)
|
315 |
29b82486
|
Leszek Koltunski
|
{
|
316 |
a75ae1ee
|
Leszek Koltunski
|
return CUBITS[cubit].getRotRow(face) == 1 ? face : -1;
|
317 |
29b82486
|
Leszek Koltunski
|
}
|
318 |
|
|
|
319 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
320 |
|
|
|
321 |
a75ae1ee
|
Leszek Koltunski
|
public int getVariantFaceColor(int variant, int face, int[] numLayers)
|
322 |
29b82486
|
Leszek Koltunski
|
{
|
323 |
a75ae1ee
|
Leszek Koltunski
|
return 0;
|
324 |
|
|
}
|
325 |
a57e6870
|
Leszek Koltunski
|
|
326 |
a75ae1ee
|
Leszek Koltunski
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
327 |
|
|
|
328 |
|
|
public int getCubitFaceColor(int cubit, int face, int[] numLayers)
|
329 |
|
|
{
|
330 |
|
|
if( cubit < getNumOctahedrons(numLayers[0]) )
|
331 |
29b82486
|
Leszek Koltunski
|
{
|
332 |
a75ae1ee
|
Leszek Koltunski
|
switch( face )
|
333 |
29b82486
|
Leszek Koltunski
|
{
|
334 |
|
|
case 0: return faceColor(cubit,0);
|
335 |
|
|
case 2: return faceColor(cubit,1);
|
336 |
|
|
case 5: return faceColor(cubit,3);
|
337 |
|
|
case 7: return faceColor(cubit,2);
|
338 |
a75ae1ee
|
Leszek Koltunski
|
default:return -1;
|
339 |
29b82486
|
Leszek Koltunski
|
}
|
340 |
|
|
}
|
341 |
|
|
else
|
342 |
|
|
{
|
343 |
a75ae1ee
|
Leszek Koltunski
|
return face<NUM_FACE_COLORS ? faceColor(cubit,face) : -1;
|
344 |
29b82486
|
Leszek Koltunski
|
}
|
345 |
|
|
}
|
346 |
|
|
|
347 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
348 |
|
|
|
349 |
e30c522a
|
Leszek Koltunski
|
public ObjectShape getObjectShape(int variant)
|
350 |
29b82486
|
Leszek Koltunski
|
{
|
351 |
e30c522a
|
Leszek Koltunski
|
int numL = getNumLayers()[0];
|
352 |
29b82486
|
Leszek Koltunski
|
|
353 |
|
|
if( variant==0 )
|
354 |
|
|
{
|
355 |
|
|
double[][] vertices = new double[][] { { 0.5,0.0,0.5},{ 0.5,0.0,-0.5},{-0.5,0.0,-0.5},{-0.5,0.0,0.5},{ 0.0,SQ2/2,0.0},{ 0.0,-SQ2/2,0.0} };
|
356 |
|
|
int[][] vert_indices = new int[][] { {3,0,4},{0,1,4},{1,2,4},{2,3,4},{5,0,3},{5,1,0},{5,2,1},{5,3,2} };
|
357 |
a57e6870
|
Leszek Koltunski
|
int N = numL==3? 6 : 5;
|
358 |
|
|
int E = numL==3? 2 : 1;
|
359 |
29b82486
|
Leszek Koltunski
|
float[][] bands = new float[][] { {0.05f,35,0.5f,0.8f,N,E,E} };
|
360 |
|
|
int[] bandIndices = new int[] { 0,0,0,0,0,0,0,0 };
|
361 |
|
|
float[][] corners = new float[][] { {0.04f,0.20f} };
|
362 |
|
|
int[] cornerIndices = new int[] { 0,0,0,0,0,0 };
|
363 |
|
|
float[][] centers = new float[][] { {0.0f, 0.0f, 0.0f} };
|
364 |
|
|
int[] centerIndices = new int[] { 0,0,0,0,0,0 };
|
365 |
|
|
return new ObjectShape(vertices,vert_indices,bands,bandIndices,corners,cornerIndices,centers,centerIndices,getNumCubitFaces(), null);
|
366 |
|
|
}
|
367 |
|
|
else
|
368 |
|
|
{
|
369 |
|
|
double[][] vertices = new double[][] { {-0.5, SQ2/4, 0.0},{ 0.5, SQ2/4, 0.0},{ 0.0,-SQ2/4, 0.5},{ 0.0,-SQ2/4,-0.5} };
|
370 |
|
|
int[][] vert_indices = new int[][] { {2,1,0},{3,0,1},{3,2,0},{2,3,1} };
|
371 |
a57e6870
|
Leszek Koltunski
|
int N = numL==3? 6 : 5;
|
372 |
|
|
int E = numL==3? 2 : 1;
|
373 |
29b82486
|
Leszek Koltunski
|
float[][] bands = new float[][] { {0.05f,35,0.5f,0.8f,N,E,E} };
|
374 |
|
|
int[] bandIndices = new int[] { 0,0,0,0 };
|
375 |
|
|
float[][] corners = new float[][] { {0.06f,0.15f} };
|
376 |
|
|
int[] cornerIndices = new int[] { 0,0,0,0 };
|
377 |
|
|
float[][] centers = new float[][] { {0.0f, 0.0f, 0.0f} };
|
378 |
|
|
int[] centerIndices = new int[] { 0,0,0,0 };
|
379 |
|
|
return new ObjectShape(vertices,vert_indices,bands,bandIndices,corners,cornerIndices,centers,centerIndices,getNumCubitFaces(), null);
|
380 |
|
|
}
|
381 |
|
|
}
|
382 |
|
|
|
383 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
384 |
|
|
|
385 |
7b832206
|
Leszek Koltunski
|
public Static4D getQuat(int cubit, int[] numLayers)
|
386 |
29b82486
|
Leszek Koltunski
|
{
|
387 |
|
|
if( mQuats==null ) initializeQuats();
|
388 |
|
|
return mQuats[0];
|
389 |
|
|
}
|
390 |
|
|
|
391 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
392 |
|
|
|
393 |
e30c522a
|
Leszek Koltunski
|
public int getNumCubitVariants(int[] numLayers)
|
394 |
29b82486
|
Leszek Koltunski
|
{
|
395 |
|
|
return 2;
|
396 |
|
|
}
|
397 |
|
|
|
398 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
399 |
|
|
|
400 |
e30c522a
|
Leszek Koltunski
|
public int getCubitVariant(int cubit, int[] numLayers)
|
401 |
29b82486
|
Leszek Koltunski
|
{
|
402 |
a57e6870
|
Leszek Koltunski
|
return cubit<getNumOctahedrons(numLayers[0]) ? 0:1;
|
403 |
29b82486
|
Leszek Koltunski
|
}
|
404 |
|
|
|
405 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
406 |
|
|
|
407 |
1bb09f88
|
Leszek Koltunski
|
public ObjectSticker retSticker(int sticker)
|
408 |
29b82486
|
Leszek Koltunski
|
{
|
409 |
|
|
if( mStickers==null )
|
410 |
|
|
{
|
411 |
|
|
float[][] STICKERS = new float[][] { { -0.4330127f, -0.25f, 0.4330127f, -0.25f, 0.0f, 0.5f } };
|
412 |
|
|
final float radius = 0.06f;
|
413 |
|
|
final float[] radii= {radius,radius,radius};
|
414 |
|
|
mStickers = new ObjectSticker[STICKERS.length];
|
415 |
8592461c
|
Leszek Koltunski
|
|
416 |
|
|
float stroke = 0.08f;
|
417 |
|
|
|
418 |
|
|
if( ObjectControl.isInIconMode() )
|
419 |
|
|
{
|
420 |
a57e6870
|
Leszek Koltunski
|
int[] numLayers = getNumLayers();
|
421 |
|
|
|
422 |
|
|
switch(numLayers[0])
|
423 |
8592461c
|
Leszek Koltunski
|
{
|
424 |
|
|
case 2: stroke*=1.0f; break;
|
425 |
|
|
case 3: stroke*=1.4f; break;
|
426 |
|
|
case 4: stroke*=1.7f; break;
|
427 |
|
|
default:stroke*=1.9f; break;
|
428 |
|
|
}
|
429 |
|
|
}
|
430 |
|
|
|
431 |
29b82486
|
Leszek Koltunski
|
mStickers[0] = new ObjectSticker(STICKERS[0],null,radii,stroke);
|
432 |
|
|
}
|
433 |
|
|
|
434 |
1bb09f88
|
Leszek Koltunski
|
return mStickers[sticker];
|
435 |
|
|
}
|
436 |
|
|
|
437 |
29b82486
|
Leszek Koltunski
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
438 |
|
|
// public API
|
439 |
|
|
|
440 |
|
|
public Static3D[] getRotationAxis()
|
441 |
|
|
{
|
442 |
|
|
return ROT_AXIS;
|
443 |
|
|
}
|
444 |
|
|
|
445 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
446 |
|
|
|
447 |
|
|
public int[] getBasicAngle()
|
448 |
|
|
{
|
449 |
|
|
if( mBasicAngle ==null ) mBasicAngle = new int[] { 3,3,3,3 };
|
450 |
|
|
return mBasicAngle;
|
451 |
|
|
}
|
452 |
|
|
|
453 |
61aa85e4
|
Leszek Koltunski
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
454 |
|
|
|
455 |
a57e6870
|
Leszek Koltunski
|
public ObjectType intGetObjectType(int[] numLayers)
|
456 |
61aa85e4
|
Leszek Koltunski
|
{
|
457 |
a57e6870
|
Leszek Koltunski
|
switch(numLayers[0])
|
458 |
61aa85e4
|
Leszek Koltunski
|
{
|
459 |
8005e762
|
Leszek Koltunski
|
case 3: return ObjectType.PYRA_3;
|
460 |
|
|
case 4: return ObjectType.PYRA_4;
|
461 |
|
|
case 5: return ObjectType.PYRA_5;
|
462 |
61aa85e4
|
Leszek Koltunski
|
}
|
463 |
|
|
|
464 |
8005e762
|
Leszek Koltunski
|
return ObjectType.PYRA_3;
|
465 |
61aa85e4
|
Leszek Koltunski
|
}
|
466 |
|
|
|
467 |
29b82486
|
Leszek Koltunski
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
468 |
|
|
|
469 |
a57e6870
|
Leszek Koltunski
|
public int getObjectName(int[] numLayers)
|
470 |
29b82486
|
Leszek Koltunski
|
{
|
471 |
a57e6870
|
Leszek Koltunski
|
switch(numLayers[0])
|
472 |
29b82486
|
Leszek Koltunski
|
{
|
473 |
|
|
case 3: return R.string.pyra3;
|
474 |
|
|
case 4: return R.string.pyra4;
|
475 |
|
|
case 5: return R.string.pyra5;
|
476 |
|
|
}
|
477 |
|
|
return R.string.pyra3;
|
478 |
|
|
}
|
479 |
|
|
|
480 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
481 |
|
|
|
482 |
a57e6870
|
Leszek Koltunski
|
public int getInventor(int[] numLayers)
|
483 |
29b82486
|
Leszek Koltunski
|
{
|
484 |
a57e6870
|
Leszek Koltunski
|
switch(numLayers[0])
|
485 |
29b82486
|
Leszek Koltunski
|
{
|
486 |
|
|
case 3: return R.string.pyra3_inventor;
|
487 |
|
|
case 4: return R.string.pyra4_inventor;
|
488 |
|
|
case 5: return R.string.pyra5_inventor;
|
489 |
|
|
}
|
490 |
|
|
return R.string.pyra3_inventor;
|
491 |
|
|
}
|
492 |
|
|
|
493 |
59c20632
|
Leszek Koltunski
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
494 |
|
|
|
495 |
|
|
public int getYearOfInvention(int[] numLayers)
|
496 |
|
|
{
|
497 |
|
|
switch(numLayers[0])
|
498 |
|
|
{
|
499 |
|
|
case 3: return 1970;
|
500 |
|
|
case 4: return 2002;
|
501 |
|
|
case 5: return 2011;
|
502 |
|
|
}
|
503 |
|
|
return 1970;
|
504 |
|
|
}
|
505 |
|
|
|
506 |
29b82486
|
Leszek Koltunski
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
507 |
|
|
|
508 |
a57e6870
|
Leszek Koltunski
|
public int getComplexity(int[] numLayers)
|
509 |
29b82486
|
Leszek Koltunski
|
{
|
510 |
a57e6870
|
Leszek Koltunski
|
switch(numLayers[0])
|
511 |
29b82486
|
Leszek Koltunski
|
{
|
512 |
|
|
case 3: return 4;
|
513 |
|
|
case 4: return 6;
|
514 |
|
|
case 5: return 8;
|
515 |
|
|
}
|
516 |
|
|
return 4;
|
517 |
|
|
}
|
518 |
|
|
}
|