40 |
40 |
new Static3D(-SQ6/3, SQ3/3, 0),
|
41 |
41 |
};
|
42 |
42 |
|
43 |
|
public static final float F = 0.48f; // length of the edge of the corner cubit. Keep<0.5
|
44 |
|
// Assuming the length of the edge of the whole
|
45 |
|
// tetrahedron is 2.0 (ie standard, equal to numLayers)
|
|
43 |
// Length of the edge of the corner cubit -
|
|
44 |
// assuming the length of the edge of the whole tetrahedron is numLayers[0]
|
|
45 |
public static final float[] JING_F = { 0.00f, 0.00f, 0.48f, 0.66f, 0.57f, 0.66f };
|
46 |
46 |
|
47 |
47 |
private int[][] mEdges;
|
48 |
48 |
private int[][] mBasicAngle;
|
... | ... | |
57 |
57 |
super(meshState, iconMode, data.getNumLayers()[0], quat, move, scale, data, asset);
|
58 |
58 |
}
|
59 |
59 |
|
|
60 |
///////////////////////////////////////////////////////////////////////////////////////////////////
|
|
61 |
// make the 'center' sticker artificially smaller, so that we paint over the area in the center of the face.
|
|
62 |
|
|
63 |
@Override
|
|
64 |
public void adjustStickerCoords()
|
|
65 |
{
|
|
66 |
int[] numLayers = getNumLayers();
|
|
67 |
float CENTER_CORR = 0.85f;
|
|
68 |
|
|
69 |
if( numLayers[0]==3 || numLayers[0]==5 )
|
|
70 |
{
|
|
71 |
mStickerCoords[3][0][2][0] *= CENTER_CORR;
|
|
72 |
mStickerCoords[3][0][2][1] *= CENTER_CORR;
|
|
73 |
}
|
|
74 |
}
|
|
75 |
|
60 |
76 |
///////////////////////////////////////////////////////////////////////////////////////////////////
|
61 |
77 |
|
62 |
78 |
@Override
|
... | ... | |
90 |
106 |
{
|
91 |
107 |
if( mCuts==null )
|
92 |
108 |
{
|
93 |
|
float[] cut = { (F-0.5f)*(SQ6/3) };
|
|
109 |
float[] cut=null;
|
|
110 |
int numL = numLayers[0];
|
|
111 |
final float F = JING_F[numL];
|
|
112 |
|
|
113 |
switch( numL )
|
|
114 |
{
|
|
115 |
case 2: cut = new float[] { (F-numL*0.25f-0.01f)*(SQ6/3) };
|
|
116 |
break;
|
|
117 |
case 3: cut = new float[] { (F-numL*0.25f-0.01f)*(SQ6/3), numL*SQ6/18 };
|
|
118 |
break;
|
|
119 |
case 4: cut = new float[] { (F-numL*0.25f-0.01f)*(SQ6/3), (2*F-numL*0.25f-0.01f)*(SQ6/3) };
|
|
120 |
break;
|
|
121 |
case 5: cut = new float[] { (F-numL*0.25f-0.01f)*(SQ6/3), (2*F-numL*0.25f-0.01f)*(SQ6/3), numL*SQ6/18 };
|
|
122 |
break;
|
|
123 |
}
|
|
124 |
|
94 |
125 |
mCuts = new float[][] { cut,cut,cut,cut };
|
95 |
126 |
}
|
96 |
127 |
|
... | ... | |
101 |
132 |
|
102 |
133 |
public boolean[][] getLayerRotatable(int[] numLayers)
|
103 |
134 |
{
|
104 |
|
boolean[] tmp = {true,true};
|
|
135 |
int numL = numLayers[0];
|
|
136 |
boolean[] tmp = new boolean[numL];
|
|
137 |
for(int i=0; i<numL; i++) tmp[i] = true;
|
105 |
138 |
return new boolean[][] { tmp,tmp,tmp,tmp };
|
106 |
139 |
}
|
107 |
140 |
|
... | ... | |
146 |
179 |
{
|
147 |
180 |
if( mCenters==null )
|
148 |
181 |
{
|
149 |
|
mCenters = new float[][]
|
150 |
|
{
|
151 |
|
{ 0.000f, -SQ2/2, 1.000f },
|
152 |
|
{ 0.000f, -SQ2/2,-1.000f },
|
153 |
|
{-1.000f, SQ2/2, 0.000f },
|
154 |
|
{ 1.000f, SQ2/2, 0.000f },
|
155 |
|
|
156 |
|
{ 0.000f, -SQ2/2, 0.000f },
|
157 |
|
{-0.500f, 0.000f, 0.500f },
|
158 |
|
{ 0.500f, 0.000f, 0.500f },
|
159 |
|
{-0.500f, 0.000f,-0.500f },
|
160 |
|
{ 0.500f, 0.000f,-0.500f },
|
161 |
|
{ 0.000f, SQ2/2, 0.000f },
|
162 |
|
|
163 |
|
{ 0.000f, SQ2/6, 1.0f/3 },
|
164 |
|
{ 0.000f, SQ2/6,-1.0f/3 },
|
165 |
|
{-1.0f/3, -SQ2/6, 0.000f },
|
166 |
|
{ 1.0f/3, -SQ2/6, 0.000f },
|
167 |
|
};
|
|
182 |
int numL = numLayers[0];
|
|
183 |
|
|
184 |
if( numL==2 )
|
|
185 |
{
|
|
186 |
mCenters = new float[][]
|
|
187 |
{
|
|
188 |
{ 0.000f, -SQ2/2, 1.000f },
|
|
189 |
{ 0.000f, -SQ2/2, -1.000f },
|
|
190 |
{-1.000f, SQ2/2, 0.000f },
|
|
191 |
{ 1.000f, SQ2/2, 0.000f },
|
|
192 |
|
|
193 |
{ 0.000f, -SQ2/2, 0.000f },
|
|
194 |
{-0.500f, 0.000f, 0.500f },
|
|
195 |
{ 0.500f, 0.000f, 0.500f },
|
|
196 |
{-0.500f, 0.000f, -0.500f },
|
|
197 |
{ 0.500f, 0.000f, -0.500f },
|
|
198 |
{ 0.000f, SQ2/2, 0.000f },
|
|
199 |
|
|
200 |
{ 0.000f, SQ2/6, 1.0f/3 },
|
|
201 |
{ 0.000f, SQ2/6, -1.0f/3 },
|
|
202 |
{-1.0f/3, -SQ2/6, 0.000f },
|
|
203 |
{ 1.0f/3, -SQ2/6, 0.000f },
|
|
204 |
};
|
|
205 |
}
|
|
206 |
else if( numL==3 )
|
|
207 |
{
|
|
208 |
final float F = JING_F[numL];
|
|
209 |
final float A = numL*0.25f;
|
|
210 |
final float B = numL*0.50f;
|
|
211 |
final float X = F/2;
|
|
212 |
final float Y = F*SQ2/2;
|
|
213 |
final float Z = -F/2;
|
|
214 |
|
|
215 |
mCenters = new float[][]
|
|
216 |
{
|
|
217 |
{ 0, -SQ2*A, B },
|
|
218 |
{ 0, -SQ2*A, -B },
|
|
219 |
{ -B, SQ2*A, 0 },
|
|
220 |
{ B, SQ2*A, 0 },
|
|
221 |
|
|
222 |
{ X, -SQ2*A +Y, B+Z },
|
|
223 |
{ -X, -SQ2*A +Y, B+Z },
|
|
224 |
{ 0, -SQ2*A , B-F },
|
|
225 |
{ X, -SQ2*A +Y,-B-Z },
|
|
226 |
{ -X, -SQ2*A +Y,-B-Z },
|
|
227 |
{ 0, -SQ2*A ,-B+F },
|
|
228 |
|
|
229 |
{-B-Z, SQ2*A -Y, X },
|
|
230 |
{-B-Z, SQ2*A -Y, -X },
|
|
231 |
{-B+F, SQ2*A , 0 },
|
|
232 |
{ B+Z, SQ2*A -Y, X },
|
|
233 |
{ B+Z, SQ2*A -Y, -X },
|
|
234 |
{ B-F, SQ2*A , 0 },
|
|
235 |
|
|
236 |
{ 0, -SQ2*A +2*Y, B +2*Z },
|
|
237 |
{ X, -SQ2*A + Y, B +Z-F },
|
|
238 |
{ -X, -SQ2*A + Y, B +Z-F },
|
|
239 |
{ 0, -SQ2*A +2*Y, -B -2*Z },
|
|
240 |
{ X, -SQ2*A + Y, -B -Z+F },
|
|
241 |
{ -X, -SQ2*A + Y, -B -Z+F },
|
|
242 |
{-B -2*Z, SQ2*A -2*Y, 0 },
|
|
243 |
{-B -Z+F, SQ2*A - Y, -X },
|
|
244 |
{-B -Z+F, SQ2*A - Y, X },
|
|
245 |
{ B +2*Z, SQ2*A -2*Y, 0 },
|
|
246 |
{ B +Z-F, SQ2*A - Y, -X },
|
|
247 |
{ B +Z-F, SQ2*A - Y, X },
|
|
248 |
};
|
|
249 |
}
|
|
250 |
else if( numL==4 )
|
|
251 |
{
|
|
252 |
final float A = numL*0.25f;
|
|
253 |
final float B = numL*0.50f;
|
|
254 |
final float C = numL*(1.0f/6);
|
|
255 |
final float D = numL*(SQ2/12);
|
|
256 |
final float F = JING_F[numL];
|
|
257 |
final float X = F/2;
|
|
258 |
final float Y = F*SQ2/2;
|
|
259 |
final float Z = -F/2;
|
|
260 |
|
|
261 |
mCenters = new float[][]
|
|
262 |
{
|
|
263 |
{ 0, -SQ2*A , B },
|
|
264 |
{ X, -SQ2*A + Y, B + Z },
|
|
265 |
{ -X, -SQ2*A + Y, B + Z },
|
|
266 |
{ 0, -SQ2*A , B - F },
|
|
267 |
{ 0, -SQ2*A +2*Y, B +2*Z },
|
|
268 |
{ X, -SQ2*A + Y, B +Z-F },
|
|
269 |
{ -X, -SQ2*A + Y, B +Z-F },
|
|
270 |
|
|
271 |
{ 0, -SQ2*A , -B },
|
|
272 |
{ X, -SQ2*A + Y, -B - Z },
|
|
273 |
{ -X, -SQ2*A + Y, -B - Z },
|
|
274 |
{ 0, -SQ2*A , -B + F },
|
|
275 |
{ 0, -SQ2*A +2*Y, -B -2*Z },
|
|
276 |
{ X, -SQ2*A + Y, -B -Z+F },
|
|
277 |
{ -X, -SQ2*A + Y, -B -Z+F },
|
|
278 |
|
|
279 |
{-B , SQ2*A , 0 },
|
|
280 |
{-B - Z, SQ2*A - Y, X },
|
|
281 |
{-B - Z, SQ2*A - Y, -X },
|
|
282 |
{-B + F, SQ2*A , 0 },
|
|
283 |
{-B -2*Z, SQ2*A -2*Y, 0 },
|
|
284 |
{-B -Z+F, SQ2*A - Y, -X },
|
|
285 |
{-B -Z+F, SQ2*A - Y, X },
|
|
286 |
|
|
287 |
{ B , SQ2*A , 0 },
|
|
288 |
{ B + Z, SQ2*A - Y, X },
|
|
289 |
{ B + Z, SQ2*A - Y, -X },
|
|
290 |
{ B - F, SQ2*A , 0 },
|
|
291 |
{ B +2*Z, SQ2*A -2*Y, 0 },
|
|
292 |
{ B +Z-F, SQ2*A - Y, -X },
|
|
293 |
{ B +Z-F, SQ2*A - Y, X },
|
|
294 |
|
|
295 |
{ 0,-SQ2*A, 0 },
|
|
296 |
{-A, 0, A },
|
|
297 |
{ A, 0, A },
|
|
298 |
{-A, 0, -A },
|
|
299 |
{ A, 0, -A },
|
|
300 |
{ 0, SQ2*A, 0 },
|
|
301 |
|
|
302 |
{ 0.50f*F, -SQ2*A +F*SQ2/2, 0 },
|
|
303 |
{ -0.50f*F, -SQ2*A +F*SQ2/2, 0 },
|
|
304 |
{-A +0.75f*F, F*SQ2/4, A -0.25f*F },
|
|
305 |
{-A +0.25f*F, -F*SQ2/4, A -0.75f*F },
|
|
306 |
{ A -0.75f*F, F*SQ2/4, A -0.25f*F },
|
|
307 |
{ A -0.25f*F, -F*SQ2/4, A -0.75f*F },
|
|
308 |
{-A +0.75f*F, F*SQ2/4,-A +0.25f*F },
|
|
309 |
{-A +0.25f*F, -F*SQ2/4,-A +0.75f*F },
|
|
310 |
{ A -0.75f*F, F*SQ2/4,-A +0.25f*F },
|
|
311 |
{ A -0.25f*F, -F*SQ2/4,-A +0.75f*F },
|
|
312 |
{ 0 , SQ2*A -F*SQ2/2, 0.50f*F },
|
|
313 |
{ 0 , SQ2*A -F*SQ2/2, -0.50f*F },
|
|
314 |
|
|
315 |
{ 0, D, C},
|
|
316 |
{ 0, D, -C},
|
|
317 |
{-C, -D, 0},
|
|
318 |
{ C, -D, 0},
|
|
319 |
};
|
|
320 |
}
|
|
321 |
else if( numL==5 )
|
|
322 |
{
|
|
323 |
mCenters = new float[][]
|
|
324 |
{
|
|
325 |
// TODO
|
|
326 |
};
|
|
327 |
}
|
168 |
328 |
}
|
169 |
329 |
|
170 |
330 |
return mCenters;
|
... | ... | |
174 |
334 |
|
175 |
335 |
public Static4D getCubitQuats(int cubit, int[] numLayers)
|
176 |
336 |
{
|
177 |
|
if( mQuatIndex==null ) mQuatIndex = new int[] {0,10,5,8,
|
178 |
|
0,5,8,6,7,9,
|
179 |
|
0,10,7,3};
|
|
337 |
if( mQuatIndex==null )
|
|
338 |
{
|
|
339 |
int numL = numLayers[0];
|
|
340 |
|
|
341 |
if( numL==2 )
|
|
342 |
mQuatIndex = new int[] { 0,10,5,8,
|
|
343 |
0,5,8,6,7,9,
|
|
344 |
0,10,7,3 };
|
|
345 |
else if( numL==3 )
|
|
346 |
mQuatIndex = new int[] { 0,10,5,8,
|
|
347 |
4,3,0, 7,6,10, 5,2,11, 8,1,9,
|
|
348 |
0,3,4, 10,6,7, 11,5,2, 9,8,1
|
|
349 |
};
|
|
350 |
else if( numL==4 )
|
|
351 |
mQuatIndex = new int[] { 0,0,0,0,0,0,0,10,10,10,10,10,10,10,5,5,5,5,5,5,5,8,8,8,8,8,8,8,
|
|
352 |
0,5,8,6,7,9,
|
|
353 |
0,0,5,5,8,8,6,6,7,7,9,9,
|
|
354 |
0,10,7,3 };
|
|
355 |
else
|
|
356 |
mQuatIndex = new int[] { }; // TODO
|
|
357 |
}
|
|
358 |
|
180 |
359 |
return mObjectQuats[mQuatIndex[cubit]];
|
181 |
360 |
}
|
182 |
361 |
|
... | ... | |
184 |
363 |
|
185 |
364 |
private float[][] getVertices(int variant)
|
186 |
365 |
{
|
|
366 |
int[] numLayers = getNumLayers();
|
|
367 |
int numL = numLayers[0];
|
|
368 |
|
|
369 |
final float F = JING_F[numL];
|
187 |
370 |
final float X = F/2;
|
188 |
371 |
final float Y = F*SQ2/2;
|
189 |
372 |
final float Z =-F/2;
|
190 |
|
final float L = (2.0f-3*F);
|
191 |
|
final float X2= L/2;
|
192 |
|
final float Y2= L*SQ2/2;
|
193 |
|
final float Z2=-L/2;
|
|
373 |
|
|
374 |
final float L = (numL-1.5f*numL*F);
|
|
375 |
final float X2 = L/2;
|
|
376 |
final float Y2 = L*SQ2/2;
|
|
377 |
final float Z2 =-L/2;
|
194 |
378 |
final float D = F/L;
|
195 |
|
final float G = 1.0f-F;
|
|
379 |
final float G1 = 0.5f*numL -(numL/2)*F;
|
|
380 |
final float G2 = G1 - F/2;
|
|
381 |
final float X3 = G2/2;
|
|
382 |
final float Y3 = G2*SQ2/2;
|
|
383 |
final float Z3 =-G2/2;
|
|
384 |
final float K = 0.2f*(1 - F/(2*G2));
|
196 |
385 |
|
197 |
386 |
if( variant==0 )
|
198 |
387 |
{
|
199 |
388 |
return new float[][]
|
200 |
|
{
|
201 |
|
{ 0, 0, 0 },
|
202 |
|
{ X, Y, Z },
|
203 |
|
{ 0, 2*Y, 2*Z },
|
204 |
|
{ -X, Y, Z },
|
205 |
|
{ 0, 0, -F },
|
206 |
|
{ X, Y, Z-F },
|
207 |
|
{ 0, 2*Y, 2*Z-F },
|
208 |
|
{ -X, Y, Z-F },
|
209 |
|
};
|
|
389 |
{
|
|
390 |
{ 0, 0, 0},
|
|
391 |
{ X, Y, Z },
|
|
392 |
{ 0, 2*Y, 2*Z },
|
|
393 |
{-X, Y, Z },
|
|
394 |
{ 0, 0, -F},
|
|
395 |
{ X, Y, Z-F},
|
|
396 |
{ 0, 2*Y, 2*Z-F},
|
|
397 |
{-X, Y, Z-F},
|
|
398 |
};
|
210 |
399 |
}
|
211 |
|
else if( variant==1 )
|
|
400 |
else if( variant==1 && (numL==2 || numL==4) )
|
212 |
401 |
{
|
213 |
402 |
return new float[][]
|
214 |
|
{
|
215 |
|
{ 0, 0, G },
|
216 |
|
{ X, Y, Z+G },
|
217 |
|
{ 0, 2*Y, 2*Z+G },
|
218 |
|
{ -X, Y, Z+G },
|
219 |
|
{ 0, 0, -G },
|
220 |
|
{ X, Y, -Z-G },
|
221 |
|
{ 0, 2*Y,-2*Z-G },
|
222 |
|
{ -X, Y, -Z-G },
|
223 |
|
};
|
|
403 |
{
|
|
404 |
{ 0, 0, G1 },
|
|
405 |
{ X, Y, Z+G1 },
|
|
406 |
{ 0, 2*Y, 2*Z+G1 },
|
|
407 |
{-X, Y, Z+G1 },
|
|
408 |
{ 0, 0, -G1 },
|
|
409 |
{ X, Y, -Z-G1 },
|
|
410 |
{ 0, 2*Y,-2*Z-G1 },
|
|
411 |
{-X, Y, -Z-G1 },
|
|
412 |
};
|
|
413 |
}
|
|
414 |
else if( variant==1 && (numL==3 || numL==5) )
|
|
415 |
{
|
|
416 |
return new float[][]
|
|
417 |
{
|
|
418 |
{ 0, 0, 0 },
|
|
419 |
{ X, Y, Z },
|
|
420 |
{ 0, 2*Y, 2*Z },
|
|
421 |
{-X, Y, Z },
|
|
422 |
{ 0, 0, -G1 },
|
|
423 |
{ X, Y, -G1 },
|
|
424 |
{-X, Y, -G1 },
|
|
425 |
};
|
|
426 |
}
|
|
427 |
else if( variant==2 && numL==4 )
|
|
428 |
{
|
|
429 |
return new float[][]
|
|
430 |
{
|
|
431 |
{ 0, 0, G2},
|
|
432 |
{ X, Y, Z+G2},
|
|
433 |
{ 0, 2*Y, 2*Z+G2},
|
|
434 |
{-X, Y, Z+G2},
|
|
435 |
{ 0, 0, -G2},
|
|
436 |
{ X, Y, -Z-G2},
|
|
437 |
{ 0, 2*Y,-2*Z-G2},
|
|
438 |
{-X, Y, -Z-G2},
|
|
439 |
};
|
|
440 |
}
|
|
441 |
else if( variant==2 && (numL==3 || numL==5) )
|
|
442 |
{
|
|
443 |
return new float[][]
|
|
444 |
{
|
|
445 |
{ 0, 0, 0 },
|
|
446 |
{ X3, Y3, Z3 },
|
|
447 |
{ 0, (2*SQ2/3)*G2, (-2.0f/3)*G2 },
|
|
448 |
{-X3, Y3, Z3 },
|
|
449 |
{ 0, 0, -G2 },
|
|
450 |
{ K*X3, K*Y3, K*Z3-G2 },
|
|
451 |
{ 0, K*(2*SQ2/3)*G2, K*(-2.0f/3)*G2 - G2 },
|
|
452 |
{-K*X3, K*Y3, K*Z3-G2 },
|
|
453 |
};
|
224 |
454 |
}
|
225 |
455 |
else
|
226 |
456 |
{
|
227 |
457 |
return new float[][]
|
228 |
|
{
|
229 |
|
{ 0, -2*Y2/3, -2*Z2/3 },
|
230 |
|
{ X2, Y2/3, Z2/3 },
|
231 |
|
{ -X2, Y2/3, Z2/3 },
|
232 |
|
{ 0, -2*Y2/3,-2*Z2/3+2*D*Z2 },
|
233 |
|
{ X2-D*X2, Y2/3-D*Y2, Z2/3+D*Z2 },
|
234 |
|
{ -X2+D*X2, Y2/3-D*Y2, Z2/3+D*Z2 },
|
235 |
|
};
|
|
458 |
{
|
|
459 |
{ 0 , -2*Y2/3 , -2*Z2/3 },
|
|
460 |
{ X2 , Y2/3 , Z2/3 },
|
|
461 |
{-X2 , Y2/3 , Z2/3 },
|
|
462 |
{ 0 , -2*Y2/3 , -2*Z2/3+2*D*Z2},
|
|
463 |
{ X2-D*X2, Y2/3-D*Y2, Z2/3+ D*Z2},
|
|
464 |
{-X2+D*X2, Y2/3-D*Y2, Z2/3+ D*Z2},
|
|
465 |
};
|
236 |
466 |
}
|
237 |
467 |
}
|
238 |
468 |
|
... | ... | |
240 |
470 |
|
241 |
471 |
public ObjectShape getObjectShape(int variant)
|
242 |
472 |
{
|
|
473 |
int[] numLayers = getNumLayers();
|
|
474 |
int numL = numLayers[0];
|
|
475 |
|
243 |
476 |
if( variant==0 )
|
244 |
477 |
{
|
245 |
478 |
int[][] indices =
|
... | ... | |
254 |
487 |
|
255 |
488 |
return new ObjectShape(getVertices(variant), indices);
|
256 |
489 |
}
|
257 |
|
else if( variant==1 )
|
|
490 |
else if( (variant==1 && (numL==2 || numL==4)) || (numL>3 && variant==2) )
|
258 |
491 |
{
|
259 |
492 |
int[][] indices =
|
260 |
493 |
{
|
... | ... | |
266 |
499 |
{2,6,7,3}
|
267 |
500 |
};
|
268 |
501 |
|
|
502 |
return new ObjectShape(getVertices(variant), indices);
|
|
503 |
}
|
|
504 |
else if( (numL==3 && variant==2) || (numL==5 && variant==3) )
|
|
505 |
{
|
|
506 |
int[][] indices =
|
|
507 |
{
|
|
508 |
{0,1,2,3},
|
|
509 |
{0,4,5,1},
|
|
510 |
{3,7,4,0},
|
|
511 |
{4,7,6,5},
|
|
512 |
{1,5,6,2},
|
|
513 |
{2,6,7,3}
|
|
514 |
};
|
|
515 |
|
|
516 |
return new ObjectShape(getVertices(variant), indices);
|
|
517 |
}
|
|
518 |
else if( variant==1 && (numL==3 || numL==5) )
|
|
519 |
{
|
|
520 |
int[][] indices =
|
|
521 |
{
|
|
522 |
{0,4,5,1},
|
|
523 |
{3,6,4,0},
|
|
524 |
{0,1,2,3},
|
|
525 |
{1,5,2},
|
|
526 |
{2,6,3},
|
|
527 |
{4,2,5},
|
|
528 |
{4,6,2}
|
|
529 |
};
|
|
530 |
|
269 |
531 |
return new ObjectShape(getVertices(variant), indices);
|
270 |
532 |
}
|
271 |
533 |
else
|
... | ... | |
287 |
549 |
|
288 |
550 |
public ObjectFaceShape getObjectFaceShape(int variant)
|
289 |
551 |
{
|
|
552 |
int[] numLayers = getNumLayers();
|
|
553 |
int numL = numLayers[0];
|
|
554 |
float R = 0.3f;
|
|
555 |
float S = 0.5f;
|
|
556 |
float H = 0.015f;
|
|
557 |
|
290 |
558 |
if( variant==0 )
|
291 |
559 |
{
|
292 |
|
float height = isInIconMode() ? 0.001f : 0.015f;
|
293 |
|
float[][] bands = { {height,35,0.25f*F,0.5f*F,5,1,1},{0.001f,35,0.25f*F,0.5f*F,5,1,1} };
|
|
560 |
float height = isInIconMode() ? 0.001f : H;
|
|
561 |
float[][] bands = { {height,35,R,S,5,1,1},{0.001f,1,R,S,5,1,1} };
|
294 |
562 |
int[] indices = { 0,0,0,1,1,1 };
|
295 |
563 |
return new ObjectFaceShape(bands,indices,null);
|
296 |
564 |
}
|
297 |
|
else if( variant==1 )
|
|
565 |
else if( variant==1 && (numL==2 || numL==4) )
|
298 |
566 |
{
|
299 |
|
float height = isInIconMode() ? 0.001f : 0.015f;
|
300 |
|
float[][] bands = { {height,35,0.2f*F,0.3f*F,7,0,0},{0.001f,35,0.2f*F,0.3f*F,7,0,0} };
|
|
567 |
int N1 = numL==2 ? 9:7;
|
|
568 |
int N2 = numL==2 ? 9:4;
|
|
569 |
float height = isInIconMode() ? 0.001f : H;
|
|
570 |
float[][] bands = { {height,35,R,S,N1,0,0},{0.001f,1,R,S,N2,0,0} };
|
|
571 |
int[] indices = { 0,0,1,1,1,1 };
|
|
572 |
return new ObjectFaceShape(bands,indices,null);
|
|
573 |
}
|
|
574 |
else if( variant==1 && (numL==3 || numL==5) )
|
|
575 |
{
|
|
576 |
int N = numL==3 ? 7:6;
|
|
577 |
float height = isInIconMode() ? 0.001f : H;
|
|
578 |
float[][] bands = { {height,35,R,S,N,0,0},{0.001f,1,R,S,4,0,0} };
|
|
579 |
int[] indices = { 0,0,1,1,1,1,1 };
|
|
580 |
return new ObjectFaceShape(bands,indices,null);
|
|
581 |
}
|
|
582 |
else if( variant==2 && numL==4 )
|
|
583 |
{
|
|
584 |
float height = isInIconMode() ? 0.001f : H;
|
|
585 |
float[][] bands = { {height,35,R,S,6,0,0},{0.001f,1,R,S,4,0,0} };
|
301 |
586 |
int[] indices = { 0,0,1,1,1,1 };
|
302 |
587 |
return new ObjectFaceShape(bands,indices,null);
|
303 |
588 |
}
|
304 |
589 |
else
|
305 |
590 |
{
|
306 |
|
final float L = (2.0f-3*F);
|
307 |
|
float height = isInIconMode() ? 0.001f : 0.020f;
|
308 |
|
float[][] bands = { {height,35,0.20f*L,0.6f*L,5,1,1}, {0.001f,35,0.05f*L,0.1f*L,5,1,1} };
|
|
591 |
int N = numL==2 ? 5:4;
|
|
592 |
float height = isInIconMode() ? 0.001f : H;
|
|
593 |
float[][] bands = { {height,35,R,S,N,0,0}, {0.001f,1,R,S,N,0,0} };
|
309 |
594 |
int[] indices = { 0,1,1,1,1,1 };
|
310 |
595 |
return new ObjectFaceShape(bands,indices,null);
|
311 |
596 |
}
|
... | ... | |
315 |
600 |
|
316 |
601 |
public ObjectVertexEffects getVertexEffects(int variant)
|
317 |
602 |
{
|
|
603 |
int[] numLayers = getNumLayers();
|
|
604 |
int numL = numLayers[0];
|
|
605 |
final float F = JING_F[numL];
|
318 |
606 |
final float Y = F*SQ2/2;
|
319 |
607 |
final float Z =-F/2;
|
320 |
608 |
|
321 |
609 |
if( variant==0 )
|
322 |
610 |
{
|
323 |
|
float[][] corners = { {0.08f,0.20f*F},{0.07f,0.20f*F} };
|
324 |
|
int[] cornerIndices = { 0,1,1,-1,1,-1,-1,-1 };
|
|
611 |
float[][] corners = { {0.08f,0.10f},{0.04f,0.10f} };
|
|
612 |
int[] cornerIndices = { 0,1,1,1,1,-1,-1,-1 };
|
325 |
613 |
float[][] centers = { { 0.0f, Y, Z-F/2} };
|
326 |
|
int[] centerIndices = { 0,0,0,-1,0,-1,-1,-1 };
|
|
614 |
int[] centerIndices = { 0,0,0,0,0,-1,-1,-1 };
|
327 |
615 |
return FactoryCubit.generateVertexEffect(getVertices(variant),corners,cornerIndices,centers,centerIndices);
|
328 |
616 |
}
|
329 |
617 |
else if( variant==1 )
|
330 |
618 |
{
|
331 |
|
float[][] corners = { {0.07f,0.20f*F} };
|
332 |
|
int[] cornerIndices = { 0,0,-1,0,0,0,-1,0 };
|
|
619 |
float[][] corners = { { 0.05f,0.10f} };
|
|
620 |
int[] cornerIndices = { 0,-1,-1,-1,0,-1,-1,-1 };
|
333 |
621 |
float[][] centers = { { 0, F*SQ2/2, 0 } };
|
334 |
|
int[] centerIndices = { 0,0,-1,0,0,0,-1,0 };
|
335 |
|
return FactoryCubit.generateVertexEffect(getVertices(variant),corners,cornerIndices,centers,centerIndices);
|
336 |
|
}
|
337 |
|
else
|
338 |
|
{
|
339 |
|
float[][] corners = { {0.04f,0.6f*F} };
|
340 |
|
int[] cornerIndices = { 0,0,0,-1,-1,-1 };
|
341 |
|
float[][] centers = { { 0, -2*Y/3, 4*Z/3 } };
|
342 |
|
int[] centerIndices = { 0,0,0,-1,-1,-1 };
|
|
622 |
int[] centerIndices = { 0,-1,-1,-1,0,-1,-1,-1 };
|
343 |
623 |
return FactoryCubit.generateVertexEffect(getVertices(variant),corners,cornerIndices,centers,centerIndices);
|
344 |
624 |
}
|
|
625 |
else return null;
|
345 |
626 |
}
|
346 |
627 |
|
347 |
628 |
///////////////////////////////////////////////////////////////////////////////////////////////////
|
348 |
629 |
|
349 |
630 |
public int getNumCubitVariants(int[] numLayers)
|
350 |
631 |
{
|
351 |
|
return 3;
|
|
632 |
return numLayers[0] < 4 ? 3: (numLayers[0] < 5 ? 4 : 5);
|
352 |
633 |
}
|
353 |
634 |
|
354 |
635 |
///////////////////////////////////////////////////////////////////////////////////////////////////
|
355 |
636 |
|
356 |
637 |
public int getCubitVariant(int cubit, int[] numLayers)
|
357 |
638 |
{
|
358 |
|
return cubit<4 ? 0 : (cubit<10?1:2);
|
|
639 |
switch( numLayers[0] )
|
|
640 |
{
|
|
641 |
case 2: return cubit< 4 ? 0 : (cubit<10 ? 1:2);
|
|
642 |
case 3: return cubit< 4 ? 0 : (cubit<16 ? 1:2);
|
|
643 |
case 4: return cubit<28 ? 0 : (cubit<34 ? 1 : (cubit<46 ? 2:3) );
|
|
644 |
default: return cubit<28 ? 0 : (cubit<40 ? 1 : (cubit<52 ? 2: (cubit<64 ? 3:4)) );
|
|
645 |
}
|
359 |
646 |
}
|
360 |
647 |
|
361 |
648 |
///////////////////////////////////////////////////////////////////////////////////////////////////
|
362 |
649 |
|
363 |
650 |
public float getStickerRadius()
|
364 |
651 |
{
|
365 |
|
return 0.04f;
|
|
652 |
int[] numLayers = getNumLayers();
|
|
653 |
|
|
654 |
switch( numLayers[0] )
|
|
655 |
{
|
|
656 |
case 2: return 0.05f;
|
|
657 |
case 3: return 0.06f;
|
|
658 |
case 4: return 0.08f;
|
|
659 |
default: return 0.10f;
|
|
660 |
}
|
366 |
661 |
}
|
367 |
662 |
|
368 |
663 |
///////////////////////////////////////////////////////////////////////////////////////////////////
|
369 |
664 |
|
370 |
665 |
public float getStickerStroke()
|
371 |
666 |
{
|
372 |
|
return isInIconMode() ? 0.08f : 0.04f;
|
|
667 |
boolean icon = isInIconMode();
|
|
668 |
int[] numLayers = getNumLayers();
|
|
669 |
|
|
670 |
switch( numLayers[0] )
|
|
671 |
{
|
|
672 |
case 2: return icon ? 0.10f : 0.05f;
|
|
673 |
case 3: return icon ? 0.14f : 0.07f;
|
|
674 |
case 4: return icon ? 0.16f : 0.08f;
|
|
675 |
default: return icon ? 0.20f : 0.10f;
|
|
676 |
}
|
373 |
677 |
}
|
374 |
678 |
|
375 |
679 |
///////////////////////////////////////////////////////////////////////////////////////////////////
|
... | ... | |
406 |
710 |
|
407 |
711 |
public String getShortName()
|
408 |
712 |
{
|
409 |
|
return ObjectType.JING_2.name();
|
|
713 |
int[] numLayers = getNumLayers();
|
|
714 |
|
|
715 |
switch( numLayers[0] )
|
|
716 |
{
|
|
717 |
case 2: return ObjectType.JING_2.name();
|
|
718 |
case 3: return ObjectType.JING_3.name();
|
|
719 |
case 4: return ObjectType.JING_4.name();
|
|
720 |
default: return ObjectType.JING_5.name();
|
|
721 |
}
|
410 |
722 |
}
|
411 |
723 |
|
412 |
724 |
///////////////////////////////////////////////////////////////////////////////////////////////////
|
413 |
725 |
|
414 |
726 |
public ObjectSignature getSignature()
|
415 |
727 |
{
|
416 |
|
return new ObjectSignature(ObjectSignatures.JING_2);
|
|
728 |
int[] numLayers = getNumLayers();
|
|
729 |
int sig;
|
|
730 |
|
|
731 |
switch( numLayers[0] )
|
|
732 |
{
|
|
733 |
case 2: sig = ObjectSignatures.JING_2; break;
|
|
734 |
case 3: sig = ObjectSignatures.JING_3; break;
|
|
735 |
case 4: sig = ObjectSignatures.JING_4; break;
|
|
736 |
default: sig = ObjectSignatures.JING_5; break;
|
|
737 |
}
|
|
738 |
|
|
739 |
return new ObjectSignature(sig);
|
417 |
740 |
}
|
418 |
741 |
|
419 |
742 |
///////////////////////////////////////////////////////////////////////////////////////////////////
|
420 |
743 |
|
421 |
744 |
public String getObjectName()
|
422 |
745 |
{
|
423 |
|
return "Jing Pyraminx";
|
|
746 |
int[] numLayers = getNumLayers();
|
|
747 |
|
|
748 |
switch( numLayers[0] )
|
|
749 |
{
|
|
750 |
case 2: return "Jing Pyraminx";
|
|
751 |
case 3: return "4x4 Pyramid";
|
|
752 |
case 4: return "5x5 Pyramid";
|
|
753 |
default: return "6x6 Pyramid";
|
|
754 |
}
|
424 |
755 |
}
|
425 |
756 |
|
426 |
757 |
///////////////////////////////////////////////////////////////////////////////////////////////////
|
427 |
758 |
|
428 |
759 |
public String getInventor()
|
429 |
760 |
{
|
430 |
|
return "Tony Fisher";
|
|
761 |
int[] numLayers = getNumLayers();
|
|
762 |
return numLayers[0]==2 ? "Tony Fisher" : "Unknown";
|
431 |
763 |
}
|
432 |
764 |
|
433 |
765 |
///////////////////////////////////////////////////////////////////////////////////////////////////
|
434 |
766 |
|
435 |
767 |
public int getYearOfInvention()
|
436 |
768 |
{
|
437 |
|
return 1991;
|
|
769 |
int[] numLayers = getNumLayers();
|
|
770 |
return numLayers[0]==2 ? 1991 : 0;
|
438 |
771 |
}
|
439 |
772 |
|
440 |
773 |
///////////////////////////////////////////////////////////////////////////////////////////////////
|
441 |
774 |
|
442 |
775 |
public int getComplexity()
|
443 |
776 |
{
|
444 |
|
return 1;
|
|
777 |
int[] numLayers = getNumLayers();
|
|
778 |
|
|
779 |
switch( numLayers[0] )
|
|
780 |
{
|
|
781 |
case 2: return 1;
|
|
782 |
case 3: return 2;
|
|
783 |
case 4: return 3;
|
|
784 |
default: return 4;
|
|
785 |
}
|
445 |
786 |
}
|
446 |
787 |
|
447 |
788 |
///////////////////////////////////////////////////////////////////////////////////////////////////
|
448 |
789 |
|
449 |
790 |
public String[][] getTutorials()
|
450 |
791 |
{
|
451 |
|
return new String[][]{
|
|
792 |
int[] numLayers = getNumLayers();
|
|
793 |
|
|
794 |
if( numLayers[0]==2 )
|
|
795 |
return new String[][]{
|
452 |
796 |
{"gb","0T8Iw6aI2gA","Jing's Pyraminx Tutorial","SuperAntoniovivaldi"},
|
453 |
797 |
{"es","Na27_GUIzqY","Resolver Jing Pyraminx","Cuby"},
|
454 |
798 |
{"ru","rlQXFzjsyAo","Как собрать Jing's pyraminx","Илья Топор-Гилка"},
|
... | ... | |
457 |
801 |
{"pl","nRYoJAy1c_8","Jing's Pyraminx TUTORIAL PL","MrUK"},
|
458 |
802 |
{"vn","yX9KjDpHjws","Tutorial N.50 - Jing's Pyraminx","Duy Thích Rubik"},
|
459 |
803 |
};
|
|
804 |
else
|
|
805 |
return null;
|
460 |
806 |
}
|
461 |
807 |
}
|
Support Jing3 and Jing4 ( aka 4x4 Pyramind and 5x5 Pyramid).
Progress with 6x6 Pyramid.