1 |
e844c116
|
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 |
1f9772f3
|
Leszek Koltunski
|
package org.distorted.objects;
|
21 |
e844c116
|
Leszek Koltunski
|
|
22 |
ccf9fec5
|
Leszek Koltunski
|
import android.content.res.Resources;
|
23 |
e844c116
|
Leszek Koltunski
|
|
24 |
045d8cbd
|
Leszek Koltunski
|
import org.distorted.helpers.ObjectShape;
|
25 |
9c06394a
|
Leszek Koltunski
|
import org.distorted.helpers.ObjectSticker;
|
26 |
bbbfb6af
|
Leszek Koltunski
|
import org.distorted.helpers.ScrambleState;
|
27 |
e844c116
|
Leszek Koltunski
|
import org.distorted.library.main.DistortedEffects;
|
28 |
|
|
import org.distorted.library.main.DistortedTexture;
|
29 |
efa8aa48
|
Leszek Koltunski
|
import org.distorted.library.mesh.MeshSquare;
|
30 |
e844c116
|
Leszek Koltunski
|
import org.distorted.library.type.Static3D;
|
31 |
|
|
import org.distorted.library.type.Static4D;
|
32 |
6fd4a72c
|
Leszek Koltunski
|
import org.distorted.main.R;
|
33 |
e844c116
|
Leszek Koltunski
|
|
34 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
35 |
|
|
|
36 |
9c2f0c91
|
Leszek Koltunski
|
public class TwistyPyraminx extends TwistyObject
|
37 |
e844c116
|
Leszek Koltunski
|
{
|
38 |
ad38d800
|
Leszek Koltunski
|
static final Static3D[] ROT_AXIS = new Static3D[]
|
39 |
e844c116
|
Leszek Koltunski
|
{
|
40 |
ac940e24
|
Leszek Koltunski
|
new Static3D( 0,-SQ3/3,-SQ6/3),
|
41 |
|
|
new Static3D( 0,-SQ3/3,+SQ6/3),
|
42 |
|
|
new Static3D(+SQ6/3,+SQ3/3, 0),
|
43 |
|
|
new Static3D(-SQ6/3,+SQ3/3, 0),
|
44 |
ad38d800
|
Leszek Koltunski
|
};
|
45 |
|
|
|
46 |
e844c116
|
Leszek Koltunski
|
private static final int[] FACE_COLORS = new int[]
|
47 |
|
|
{
|
48 |
ece1b58d
|
Leszek Koltunski
|
COLOR_GREEN , COLOR_YELLOW,
|
49 |
|
|
COLOR_BLUE , COLOR_RED
|
50 |
e844c116
|
Leszek Koltunski
|
};
|
51 |
|
|
|
52 |
bbbfb6af
|
Leszek Koltunski
|
private ScrambleState[] mStates;
|
53 |
48fec01e
|
Leszek Koltunski
|
private int[] mBasicAngle;
|
54 |
|
|
private Static4D[] mQuats;
|
55 |
|
|
private ObjectSticker[] mStickers;
|
56 |
bbbfb6af
|
Leszek Koltunski
|
|
57 |
e844c116
|
Leszek Koltunski
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
58 |
|
|
|
59 |
ac940e24
|
Leszek Koltunski
|
TwistyPyraminx(int size, Static4D quat, DistortedTexture texture, MeshSquare mesh,
|
60 |
|
|
DistortedEffects effects, int[][] moves, Resources res, int scrWidth)
|
61 |
e844c116
|
Leszek Koltunski
|
{
|
62 |
db875721
|
Leszek Koltunski
|
super(size, size, quat, texture, mesh, effects, moves, ObjectList.PYRA, res, scrWidth);
|
63 |
91792184
|
Leszek Koltunski
|
}
|
64 |
bbbfb6af
|
Leszek Koltunski
|
|
65 |
91792184
|
Leszek Koltunski
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
66 |
|
|
|
67 |
|
|
ScrambleState[] getScrambleStates()
|
68 |
|
|
{
|
69 |
|
|
if( mStates==null )
|
70 |
|
|
{
|
71 |
|
|
int numLayers = getNumLayers();
|
72 |
|
|
initializeScrambleStates(numLayers);
|
73 |
|
|
}
|
74 |
|
|
|
75 |
|
|
return mStates;
|
76 |
e844c116
|
Leszek Koltunski
|
}
|
77 |
|
|
|
78 |
48fec01e
|
Leszek Koltunski
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
79 |
|
|
|
80 |
|
|
private void initializeQuats()
|
81 |
|
|
{
|
82 |
|
|
mQuats = new Static4D[]
|
83 |
|
|
{
|
84 |
|
|
new Static4D( 0.0f, 0.0f, 0.0f, 1.0f),
|
85 |
|
|
new Static4D( 0.0f, 1.0f, 0.0f, 0.0f),
|
86 |
|
|
new Static4D( SQ2/2, 0.5f, 0.0f, 0.5f),
|
87 |
|
|
new Static4D(-SQ2/2, 0.5f, 0.0f, 0.5f),
|
88 |
|
|
new Static4D( 0.0f, -0.5f, -SQ2/2, 0.5f),
|
89 |
|
|
new Static4D( 0.0f, -0.5f, SQ2/2, 0.5f),
|
90 |
|
|
new Static4D( SQ2/2, 0.5f, 0.0f, -0.5f),
|
91 |
|
|
new Static4D(-SQ2/2, 0.5f, 0.0f, -0.5f),
|
92 |
|
|
new Static4D( 0.0f, -0.5f, -SQ2/2, -0.5f),
|
93 |
|
|
new Static4D( 0.0f, -0.5f, SQ2/2, -0.5f),
|
94 |
|
|
new Static4D( SQ2/2, 0.0f, SQ2/2, 0.0f),
|
95 |
|
|
new Static4D(-SQ2/2, 0.0f, SQ2/2, 0.0f)
|
96 |
|
|
};
|
97 |
|
|
}
|
98 |
|
|
|
99 |
a480ee80
|
Leszek Koltunski
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
100 |
|
|
|
101 |
bbbfb6af
|
Leszek Koltunski
|
private int[][] generateState(int start, int end)
|
102 |
a480ee80
|
Leszek Koltunski
|
{
|
103 |
bbbfb6af
|
Leszek Koltunski
|
int len = end-start+1;
|
104 |
|
|
int[] tmp = new int[6*len];
|
105 |
|
|
|
106 |
|
|
for(int i=0; i<len; i++)
|
107 |
|
|
{
|
108 |
|
|
tmp[6*i ] = start;
|
109 |
|
|
tmp[6*i+1] = -1;
|
110 |
|
|
tmp[6*i+2] = start;
|
111 |
|
|
tmp[6*i+3] = start;
|
112 |
|
|
tmp[6*i+4] = +1;
|
113 |
|
|
tmp[6*i+5] = start;
|
114 |
|
|
|
115 |
|
|
start++;
|
116 |
|
|
}
|
117 |
|
|
|
118 |
|
|
return new int[][] {tmp,tmp,tmp,tmp};
|
119 |
a480ee80
|
Leszek Koltunski
|
}
|
120 |
|
|
|
121 |
0203be88
|
Leszek Koltunski
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
122 |
|
|
|
123 |
bbbfb6af
|
Leszek Koltunski
|
private void initializeScrambleStates(int numLayers)
|
124 |
0203be88
|
Leszek Koltunski
|
{
|
125 |
bbbfb6af
|
Leszek Koltunski
|
mStates = new ScrambleState[numLayers];
|
126 |
0203be88
|
Leszek Koltunski
|
|
127 |
bbbfb6af
|
Leszek Koltunski
|
for(int i=0; i<numLayers-1; i++)
|
128 |
0203be88
|
Leszek Koltunski
|
{
|
129 |
bbbfb6af
|
Leszek Koltunski
|
mStates[i] = new ScrambleState( generateState(0,numLayers-1-i) );
|
130 |
0203be88
|
Leszek Koltunski
|
}
|
131 |
|
|
|
132 |
bbbfb6af
|
Leszek Koltunski
|
mStates[numLayers-1] = new ScrambleState( generateState(1,numLayers-2) );
|
133 |
|
|
}
|
134 |
|
|
|
135 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
136 |
|
|
|
137 |
|
|
int[] getSolvedQuats(int cubit, int numLayers)
|
138 |
|
|
{
|
139 |
48fec01e
|
Leszek Koltunski
|
if( mQuats==null ) initializeQuats();
|
140 |
bbbfb6af
|
Leszek Koltunski
|
int status = retCubitSolvedStatus(cubit,numLayers);
|
141 |
48fec01e
|
Leszek Koltunski
|
return status<0 ? null : buildSolvedQuats(MovementPyraminx.FACE_AXIS[status],mQuats);
|
142 |
0203be88
|
Leszek Koltunski
|
}
|
143 |
|
|
|
144 |
e844c116
|
Leszek Koltunski
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
145 |
|
|
|
146 |
e6cf7283
|
Leszek Koltunski
|
private void addTetrahedralLattice(int size, int index, float[][] pos)
|
147 |
49f67f9b
|
Leszek Koltunski
|
{
|
148 |
ac940e24
|
Leszek Koltunski
|
final float DX = 1.0f;
|
149 |
|
|
final float DY = SQ2/2;
|
150 |
|
|
final float DZ = 1.0f;
|
151 |
49f67f9b
|
Leszek Koltunski
|
|
152 |
ac940e24
|
Leszek Koltunski
|
float startX = 0.0f;
|
153 |
|
|
float startY =-DY*(size-1)/2;
|
154 |
|
|
float startZ = DZ*(size-1)/2;
|
155 |
769409d2
|
Leszek Koltunski
|
|
156 |
ac940e24
|
Leszek Koltunski
|
for(int layer=0; layer<size; layer++)
|
157 |
49f67f9b
|
Leszek Koltunski
|
{
|
158 |
ac940e24
|
Leszek Koltunski
|
float currX = startX;
|
159 |
|
|
float currY = startY;
|
160 |
|
|
|
161 |
|
|
for(int x=0; x<layer+1; x++)
|
162 |
|
|
{
|
163 |
|
|
float currZ = startZ;
|
164 |
|
|
|
165 |
|
|
for(int z=0; z<size-layer; z++)
|
166 |
|
|
{
|
167 |
e6cf7283
|
Leszek Koltunski
|
pos[index] = new float[] {currX,currY,currZ};
|
168 |
ac940e24
|
Leszek Koltunski
|
index++;
|
169 |
|
|
currZ -= DZ;
|
170 |
|
|
}
|
171 |
|
|
|
172 |
|
|
currX += DX;
|
173 |
|
|
}
|
174 |
|
|
|
175 |
|
|
startX-=DX/2;
|
176 |
|
|
startY+=DY;
|
177 |
|
|
startZ-=DZ/2;
|
178 |
49f67f9b
|
Leszek Koltunski
|
}
|
179 |
|
|
}
|
180 |
|
|
|
181 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
182 |
ac940e24
|
Leszek Koltunski
|
// there are (n^3-n)/6 octahedrons and ((n+1)^3 - (n+1))/6 tetrahedrons
|
183 |
49f67f9b
|
Leszek Koltunski
|
|
184 |
e6cf7283
|
Leszek Koltunski
|
float[][] getCubitPositions(int size)
|
185 |
e844c116
|
Leszek Koltunski
|
{
|
186 |
ac940e24
|
Leszek Koltunski
|
int numOcta = (size-1)*size*(size+1)/6;
|
187 |
|
|
int numTetra= size*(size+1)*(size+2)/6;
|
188 |
e6cf7283
|
Leszek Koltunski
|
float[][] ret = new float[numOcta+numTetra][];
|
189 |
49f67f9b
|
Leszek Koltunski
|
|
190 |
ac940e24
|
Leszek Koltunski
|
addTetrahedralLattice(size-1, 0,ret);
|
191 |
|
|
addTetrahedralLattice(size ,numOcta,ret);
|
192 |
49f67f9b
|
Leszek Koltunski
|
|
193 |
ac940e24
|
Leszek Koltunski
|
return ret;
|
194 |
e844c116
|
Leszek Koltunski
|
}
|
195 |
|
|
|
196 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
197 |
|
|
|
198 |
10585385
|
Leszek Koltunski
|
Static4D[] getQuats()
|
199 |
e844c116
|
Leszek Koltunski
|
{
|
200 |
48fec01e
|
Leszek Koltunski
|
if( mQuats==null ) initializeQuats();
|
201 |
|
|
return mQuats;
|
202 |
e844c116
|
Leszek Koltunski
|
}
|
203 |
|
|
|
204 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
205 |
|
|
|
206 |
abf36986
|
Leszek Koltunski
|
int getNumFaceColors()
|
207 |
e844c116
|
Leszek Koltunski
|
{
|
208 |
|
|
return FACE_COLORS.length;
|
209 |
|
|
}
|
210 |
|
|
|
211 |
169219a7
|
Leszek Koltunski
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
212 |
|
|
|
213 |
|
|
int getSolvedFunctionIndex()
|
214 |
|
|
{
|
215 |
|
|
return 0;
|
216 |
|
|
}
|
217 |
|
|
|
218 |
eab9d8f8
|
Leszek Koltunski
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
219 |
|
|
|
220 |
a64e07d0
|
Leszek Koltunski
|
int getNumStickerTypes(int numLayers)
|
221 |
eab9d8f8
|
Leszek Koltunski
|
{
|
222 |
48fec01e
|
Leszek Koltunski
|
return 1;
|
223 |
eab9d8f8
|
Leszek Koltunski
|
}
|
224 |
|
|
|
225 |
7403cdfa
|
Leszek Koltunski
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
226 |
|
|
|
227 |
e6734aa9
|
Leszek Koltunski
|
float[][] getCuts(int size)
|
228 |
7403cdfa
|
Leszek Koltunski
|
{
|
229 |
e6734aa9
|
Leszek Koltunski
|
float[][] cuts = new float[4][size-1];
|
230 |
a97e02b7
|
Leszek Koltunski
|
|
231 |
|
|
for(int i=0; i<size-1; i++)
|
232 |
|
|
{
|
233 |
e6734aa9
|
Leszek Koltunski
|
float cut = (1.0f-0.25f*size+i)*(SQ6/3);
|
234 |
|
|
cuts[0][i] = cut;
|
235 |
|
|
cuts[1][i] = cut;
|
236 |
|
|
cuts[2][i] = cut;
|
237 |
|
|
cuts[3][i] = cut;
|
238 |
a97e02b7
|
Leszek Koltunski
|
}
|
239 |
|
|
|
240 |
|
|
return cuts;
|
241 |
7403cdfa
|
Leszek Koltunski
|
}
|
242 |
|
|
|
243 |
8f53e513
|
Leszek Koltunski
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
244 |
|
|
|
245 |
|
|
int getNumCubitFaces()
|
246 |
|
|
{
|
247 |
ac940e24
|
Leszek Koltunski
|
return 8;
|
248 |
8f53e513
|
Leszek Koltunski
|
}
|
249 |
|
|
|
250 |
f0fa83ae
|
Leszek Koltunski
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
251 |
|
|
|
252 |
|
|
float getScreenRatio()
|
253 |
|
|
{
|
254 |
48fec01e
|
Leszek Koltunski
|
return 0.88f;
|
255 |
f0fa83ae
|
Leszek Koltunski
|
}
|
256 |
|
|
|
257 |
eaee1ddc
|
Leszek Koltunski
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
258 |
|
|
|
259 |
|
|
boolean shouldResetTextureMaps()
|
260 |
|
|
{
|
261 |
|
|
return false;
|
262 |
|
|
}
|
263 |
|
|
|
264 |
31cd7256
|
Leszek Koltunski
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
265 |
|
|
|
266 |
|
|
private int getNumOctahedrons(int numLayers)
|
267 |
|
|
{
|
268 |
|
|
return (numLayers-1)*numLayers*(numLayers+1)/6;
|
269 |
|
|
}
|
270 |
|
|
|
271 |
f6d06256
|
Leszek Koltunski
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
272 |
|
|
|
273 |
ac940e24
|
Leszek Koltunski
|
private int faceColor(int cubit, int axis)
|
274 |
f6d06256
|
Leszek Koltunski
|
{
|
275 |
abf36986
|
Leszek Koltunski
|
return CUBITS[cubit].mRotationRow[axis] == 1 ? axis : NUM_TEXTURES;
|
276 |
f6d06256
|
Leszek Koltunski
|
}
|
277 |
|
|
|
278 |
f0fa83ae
|
Leszek Koltunski
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
279 |
|
|
|
280 |
ac940e24
|
Leszek Koltunski
|
int getFaceColor(int cubit, int cubitface, int size)
|
281 |
e844c116
|
Leszek Koltunski
|
{
|
282 |
ac940e24
|
Leszek Koltunski
|
if( cubit< (size-1)*size*(size+1)/6 )
|
283 |
40ab026e
|
Leszek Koltunski
|
{
|
284 |
ac940e24
|
Leszek Koltunski
|
switch( cubitface )
|
285 |
|
|
{
|
286 |
|
|
case 0: return faceColor(cubit,0);
|
287 |
|
|
case 2: return faceColor(cubit,1);
|
288 |
|
|
case 5: return faceColor(cubit,3);
|
289 |
|
|
case 7: return faceColor(cubit,2);
|
290 |
abf36986
|
Leszek Koltunski
|
default:return NUM_TEXTURES;
|
291 |
ac940e24
|
Leszek Koltunski
|
}
|
292 |
40ab026e
|
Leszek Koltunski
|
}
|
293 |
ac940e24
|
Leszek Koltunski
|
else
|
294 |
89a11f7b
|
Leszek Koltunski
|
{
|
295 |
abf36986
|
Leszek Koltunski
|
return cubitface<NUM_TEXTURES ? faceColor(cubit,cubitface) : NUM_TEXTURES;
|
296 |
89a11f7b
|
Leszek Koltunski
|
}
|
297 |
e844c116
|
Leszek Koltunski
|
}
|
298 |
|
|
|
299 |
045d8cbd
|
Leszek Koltunski
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
300 |
|
|
|
301 |
|
|
ObjectShape getObjectShape(int cubit, int numLayers)
|
302 |
|
|
{
|
303 |
|
|
int variant = getCubitVariant(cubit,numLayers);
|
304 |
|
|
|
305 |
|
|
if( variant==0 )
|
306 |
|
|
{
|
307 |
48fec01e
|
Leszek Koltunski
|
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} };
|
308 |
|
|
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} };
|
309 |
045d8cbd
|
Leszek Koltunski
|
int N = numLayers==3? 6 : 5;
|
310 |
|
|
int E = numLayers==3? 2 : 1;
|
311 |
|
|
float[][] bands = new float[][] { {0.05f,35,0.5f,0.8f,N,E,E} };
|
312 |
|
|
int[] bandIndices = new int[] { 0,0,0,0,0,0,0,0 };
|
313 |
|
|
float[][] corners = new float[][] { {0.04f,0.20f} };
|
314 |
|
|
int[] cornerIndices = new int[] { 0,0,0,0,0,0 };
|
315 |
|
|
float[][] centers = new float[][] { {0.0f, 0.0f, 0.0f} };
|
316 |
|
|
int[] centerIndices = new int[] { 0,0,0,0,0,0 };
|
317 |
48fec01e
|
Leszek Koltunski
|
return new ObjectShape(vertices,vert_indices,bands,bandIndices,corners,cornerIndices,centers,centerIndices,getNumCubitFaces(), null);
|
318 |
045d8cbd
|
Leszek Koltunski
|
}
|
319 |
|
|
else
|
320 |
|
|
{
|
321 |
48fec01e
|
Leszek Koltunski
|
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} };
|
322 |
|
|
int[][] vert_indices = new int[][] { {2,1,0},{3,0,1},{3,2,0},{2,3,1} };
|
323 |
045d8cbd
|
Leszek Koltunski
|
int N = numLayers==3? 6 : 5;
|
324 |
|
|
int E = numLayers==3? 2 : 1;
|
325 |
|
|
float[][] bands = new float[][] { {0.05f,35,0.5f,0.8f,N,E,E} };
|
326 |
|
|
int[] bandIndices = new int[] { 0,0,0,0 };
|
327 |
|
|
float[][] corners = new float[][] { {0.06f,0.15f} };
|
328 |
|
|
int[] cornerIndices = new int[] { 0,0,0,0 };
|
329 |
|
|
float[][] centers = new float[][] { {0.0f, 0.0f, 0.0f} };
|
330 |
|
|
int[] centerIndices = new int[] { 0,0,0,0 };
|
331 |
48fec01e
|
Leszek Koltunski
|
return new ObjectShape(vertices,vert_indices,bands,bandIndices,corners,cornerIndices,centers,centerIndices,getNumCubitFaces(), null);
|
332 |
045d8cbd
|
Leszek Koltunski
|
}
|
333 |
|
|
}
|
334 |
|
|
|
335 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
336 |
|
|
|
337 |
3e605536
|
Leszek Koltunski
|
Static4D getQuat(int cubit, int numLayers)
|
338 |
045d8cbd
|
Leszek Koltunski
|
{
|
339 |
48fec01e
|
Leszek Koltunski
|
if( mQuats==null ) initializeQuats();
|
340 |
|
|
return mQuats[0];
|
341 |
045d8cbd
|
Leszek Koltunski
|
}
|
342 |
|
|
|
343 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
344 |
|
|
|
345 |
3e605536
|
Leszek Koltunski
|
int getNumCubitVariants(int numLayers)
|
346 |
045d8cbd
|
Leszek Koltunski
|
{
|
347 |
|
|
return 2;
|
348 |
|
|
}
|
349 |
|
|
|
350 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
351 |
|
|
|
352 |
|
|
int getCubitVariant(int cubit, int numLayers)
|
353 |
|
|
{
|
354 |
|
|
return cubit<getNumOctahedrons(numLayers) ? 0:1;
|
355 |
|
|
}
|
356 |
|
|
|
357 |
7289fd6c
|
Leszek Koltunski
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
358 |
|
|
|
359 |
9c06394a
|
Leszek Koltunski
|
int getColor(int face)
|
360 |
7289fd6c
|
Leszek Koltunski
|
{
|
361 |
9c06394a
|
Leszek Koltunski
|
return FACE_COLORS[face];
|
362 |
|
|
}
|
363 |
|
|
|
364 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
365 |
76c2bd07
|
Leszek Koltunski
|
|
366 |
9c06394a
|
Leszek Koltunski
|
ObjectSticker retSticker(int face)
|
367 |
|
|
{
|
368 |
48fec01e
|
Leszek Koltunski
|
if( mStickers==null )
|
369 |
|
|
{
|
370 |
|
|
float[][] STICKERS = new float[][] { { -0.4330127f, -0.25f, 0.4330127f, -0.25f, 0.0f, 0.5f } };
|
371 |
|
|
final float stroke = 0.08f;
|
372 |
|
|
final float radius = 0.06f;
|
373 |
|
|
final float[] radii= {radius,radius,radius};
|
374 |
|
|
mStickers = new ObjectSticker[STICKERS.length];
|
375 |
|
|
mStickers[0] = new ObjectSticker(STICKERS[0],null,radii,stroke);
|
376 |
|
|
}
|
377 |
|
|
|
378 |
abf36986
|
Leszek Koltunski
|
return mStickers[face/NUM_FACE_COLORS];
|
379 |
7289fd6c
|
Leszek Koltunski
|
}
|
380 |
|
|
|
381 |
fb377dae
|
Leszek Koltunski
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
382 |
7403cdfa
|
Leszek Koltunski
|
// SQ6/3 = height of the tetrahedron
|
383 |
fb377dae
|
Leszek Koltunski
|
|
384 |
|
|
float returnMultiplier()
|
385 |
|
|
{
|
386 |
d99f3a48
|
Leszek Koltunski
|
return getNumLayers()/(SQ6/3);
|
387 |
fb377dae
|
Leszek Koltunski
|
}
|
388 |
|
|
|
389 |
7c969a6d
|
Leszek Koltunski
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
390 |
91792184
|
Leszek Koltunski
|
// public API
|
391 |
bbbfb6af
|
Leszek Koltunski
|
|
392 |
|
|
public Static3D[] getRotationAxis()
|
393 |
|
|
{
|
394 |
|
|
return ROT_AXIS;
|
395 |
|
|
}
|
396 |
|
|
|
397 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
398 |
|
|
|
399 |
|
|
public int[] getBasicAngle()
|
400 |
|
|
{
|
401 |
48fec01e
|
Leszek Koltunski
|
if( mBasicAngle ==null ) mBasicAngle = new int[] { 3,3,3,3 };
|
402 |
|
|
return mBasicAngle;
|
403 |
e46e17fb
|
Leszek Koltunski
|
}
|
404 |
f0336037
|
Leszek Koltunski
|
|
405 |
6fd4a72c
|
Leszek Koltunski
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
406 |
|
|
|
407 |
|
|
public int getObjectName(int numLayers)
|
408 |
|
|
{
|
409 |
|
|
switch(numLayers)
|
410 |
|
|
{
|
411 |
|
|
case 3: return R.string.pyra3;
|
412 |
|
|
case 4: return R.string.pyra4;
|
413 |
|
|
case 5: return R.string.pyra5;
|
414 |
|
|
}
|
415 |
|
|
return R.string.pyra3;
|
416 |
|
|
}
|
417 |
|
|
|
418 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
419 |
|
|
|
420 |
|
|
public int getInventor(int numLayers)
|
421 |
|
|
{
|
422 |
|
|
switch(numLayers)
|
423 |
|
|
{
|
424 |
|
|
case 3: return R.string.pyra3_inventor;
|
425 |
|
|
case 4: return R.string.pyra4_inventor;
|
426 |
|
|
case 5: return R.string.pyra5_inventor;
|
427 |
|
|
}
|
428 |
|
|
return R.string.pyra3_inventor;
|
429 |
|
|
}
|
430 |
|
|
|
431 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
432 |
|
|
|
433 |
|
|
public int getComplexity(int numLayers)
|
434 |
|
|
{
|
435 |
|
|
switch(numLayers)
|
436 |
|
|
{
|
437 |
|
|
case 3: return 4;
|
438 |
|
|
case 4: return 6;
|
439 |
|
|
case 5: return 8;
|
440 |
|
|
}
|
441 |
|
|
return 4;
|
442 |
|
|
}
|
443 |
e844c116
|
Leszek Koltunski
|
}
|