Revision 387b6326
Added by Leszek Koltunski about 3 years ago
src/main/java/org/distorted/objects/MovementMinx.java | ||
---|---|---|
30 | 30 |
|
31 | 31 |
class MovementMinx extends Movement |
32 | 32 |
{ |
33 |
static final float DIST3D = (float)Math.sqrt(0.625f+0.275f*SQ5)/3;
|
|
34 |
static final float DIST2D = (0.5f*SIN54/COS54)/3;
|
|
33 |
static final float DIST3D = (float)Math.sqrt(0.625f+0.275f*SQ5); |
|
34 |
static final float DIST2D = (SIN54/COS54)/2;
|
|
35 | 35 |
|
36 | 36 |
static final Static3D[] FACE_AXIS = new Static3D[] |
37 | 37 |
{ |
src/main/java/org/distorted/objects/TwistyKilominx.java | ||
---|---|---|
90 | 90 |
|
91 | 91 |
float getScreenRatio() |
92 | 92 |
{ |
93 |
return 1.00f;
|
|
93 |
return 0.33f;
|
|
94 | 94 |
} |
95 | 95 |
|
96 | 96 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
... | ... | |
333 | 333 |
int numCubitsPerCenter = 5; |
334 | 334 |
int face = cubit/numCubitsPerCenter; |
335 | 335 |
int index= cubit%numCubitsPerCenter; |
336 |
int corner=mCenterMap[face][index]; |
|
337 |
|
|
338 |
return mQuatCornerIndices[corner]; |
|
336 |
int center=mCenterMap[face][index]; |
|
337 |
return mQuatCornerIndices[center]; |
|
339 | 338 |
} |
340 | 339 |
} |
341 | 340 |
|
... | ... | |
348 | 347 |
|
349 | 348 |
if( variant==0 ) |
350 | 349 |
{ |
351 |
float width = (numLayers/3.0f)/(numLayers-1);
|
|
350 |
float width = numLayers/(numLayers-1.0f);
|
|
352 | 351 |
float A = (2*SQ3/3)*SIN54; |
353 | 352 |
float B = 0.4f; |
354 | 353 |
double X = width*COS18*SIN_HALFD; |
... | ... | |
396 | 395 |
int numCubitsPerCorner = numCubitsPerCorner(numLayers); |
397 | 396 |
int numCubitsPerEdge = numCubitsPerEdge(numLayers); |
398 | 397 |
int type = computeEdgeType(cubit,numCubitsPerCorner,numCubitsPerEdge); |
399 |
float tmpVal= (numLayers/3.0f)/(numLayers-1);
|
|
398 |
float tmpVal= numLayers/(numLayers-1.0f);
|
|
400 | 399 |
float height= tmpVal*COS18; |
401 | 400 |
float width = tmpVal + (type/2)*tmpVal*SIN18; |
402 | 401 |
boolean left = (type%2)==0; |
... | ... | |
463 | 462 |
} |
464 | 463 |
else |
465 | 464 |
{ |
466 |
float width = (1+0.5f*(numLayers-3)*SIN18)*(numLayers/3.0f)/(numLayers-1);
|
|
465 |
float width = (1+0.5f*(numLayers-3)*SIN18)*numLayers/(numLayers-1);
|
|
467 | 466 |
|
468 | 467 |
double X = width*COS18*SIN_HALFD; |
469 | 468 |
double Y = width*SIN18; |
src/main/java/org/distorted/objects/TwistyMegaminx.java | ||
---|---|---|
70 | 70 |
|
71 | 71 |
float getScreenRatio() |
72 | 72 |
{ |
73 |
return 1.07f;
|
|
73 |
return 0.356f;
|
|
74 | 74 |
} |
75 | 75 |
|
76 | 76 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
... | ... | |
121 | 121 |
{ |
122 | 122 |
if( mCenterCoords==null ) initializeCenterCoords(); |
123 | 123 |
float[] coords = mCenterCoords[center]; |
124 |
float A = numLayers/3.0f;
|
|
124 |
float A = 0.33f*numLayers;
|
|
125 | 125 |
|
126 | 126 |
return new float[] { A*coords[0], A*coords[1], A*coords[2] }; |
127 | 127 |
} |
... | ... | |
215 | 215 |
float vY = D*center[1] - y; |
216 | 216 |
float vZ = D*center[2] - z; |
217 | 217 |
|
218 |
float A = mult*D*(0.5f-MEGA_D)*COS18/((numLayers-1)*0.5f); |
|
218 |
float A = 3*mult*D*(0.5f-MEGA_D)*COS18/((numLayers-1)*0.5f);
|
|
219 | 219 |
A /= (float)Math.sqrt(vX*vX+vY*vY+vZ*vZ); |
220 | 220 |
|
221 | 221 |
return new float[] { x+A*vX, y+A*vY, z+A*vZ }; |
... | ... | |
291 | 291 |
|
292 | 292 |
if( variant==0 ) |
293 | 293 |
{ |
294 |
float width = (numLayers/3.0f)*(0.5f-MEGA_D)/(0.5f*(numLayers-1));
|
|
294 |
float width = numLayers*(0.5f-MEGA_D)/(0.5f*(numLayers-1));
|
|
295 | 295 |
float A = (2*SQ3/3)*SIN54; |
296 | 296 |
float B = 0.4f; |
297 | 297 |
double X = width*COS18*SIN_HALFD; |
... | ... | |
340 | 340 |
int numCubitsPerCorner = numCubitsPerCorner(numLayers); |
341 | 341 |
int numCubitsPerEdge = numCubitsPerEdge(numLayers); |
342 | 342 |
int type = computeEdgeType(cubit,numCubitsPerCorner,numCubitsPerEdge); |
343 |
float height= (numLayers/3.0f)*(0.5f-MEGA_D)*COS18/((numLayers-1)*0.5f);
|
|
344 |
float width = (numLayers/3.0f)*2*MEGA_D + 2*type*height*SIN18/COS18;
|
|
343 |
float height= numLayers*(0.5f-MEGA_D)*COS18/((numLayers-1)*0.5f);
|
|
344 |
float width = numLayers*2*MEGA_D + 2*type*height*SIN18/COS18;
|
|
345 | 345 |
|
346 | 346 |
double W = width/2; |
347 | 347 |
double X = height*SIN_HALFD; |
... | ... | |
387 | 387 |
} |
388 | 388 |
else |
389 | 389 |
{ |
390 |
float width = 2 * (numLayers/3.0f) * (MEGA_D+(0.5f-MEGA_D)*SIN18);
|
|
390 |
float width = 2*numLayers*(MEGA_D+(0.5f-MEGA_D)*SIN18);
|
|
391 | 391 |
final double V = 0.83; // ?? |
392 | 392 |
final double ANGLE = V*Math.PI; |
393 | 393 |
final double cosA = Math.cos(ANGLE); |
src/main/java/org/distorted/objects/TwistyMinx.java | ||
---|---|---|
121 | 121 |
mBasicCornerV = new Static4D[3]; |
122 | 122 |
mCurrCornerV = new Static4D[3]; |
123 | 123 |
|
124 |
mBasicCornerV[0] = new Static4D( (SQ5+1)*0.125f, (SQ5-1)*0.125f, -0.250f, 0.0f );
|
|
125 |
mBasicCornerV[1] = new Static4D(-(SQ5+1)*0.125f, (SQ5-1)*0.125f, -0.250f, 0.0f );
|
|
126 |
mBasicCornerV[2] = new Static4D( 0, -0.500f, 0.0f, 0.0f );
|
|
124 |
mBasicCornerV[0] = new Static4D( (SQ5+1)*0.375f, (SQ5-1)*0.375f, -0.750f, 0.0f );
|
|
125 |
mBasicCornerV[1] = new Static4D(-(SQ5+1)*0.375f, (SQ5-1)*0.375f, -0.750f, 0.0f );
|
|
126 |
mBasicCornerV[2] = new Static4D( 0, -1.500f, 0.0f, 0.0f );
|
|
127 | 127 |
} |
128 | 128 |
|
129 | 129 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
... | ... | |
316 | 316 |
|
317 | 317 |
void initializeCorners() |
318 | 318 |
{ |
319 |
float cA = 1.5f; |
|
320 |
float cB = 3*C2; |
|
321 |
float cC = 3*SIN54; |
|
322 |
|
|
319 | 323 |
mCorners = new float[][] |
320 | 324 |
{ |
321 |
{ 0.0f, 0.5f, C2},
|
|
322 |
{ 0.0f, 0.5f, -C2},
|
|
323 |
{ 0.0f, -0.5f, C2},
|
|
324 |
{ 0.0f, -0.5f, -C2},
|
|
325 |
{ C2, 0.0f, 0.5f},
|
|
326 |
{ C2, 0.0f, -0.5f},
|
|
327 |
{ -C2, 0.0f, 0.5f},
|
|
328 |
{ -C2, 0.0f, -0.5f},
|
|
329 |
{ 0.5f, C2, 0.0f},
|
|
330 |
{ 0.5f, -C2, 0.0f},
|
|
331 |
{ -0.5f, C2, 0.0f},
|
|
332 |
{ -0.5f, -C2, 0.0f},
|
|
333 |
{ SIN54, SIN54, SIN54},
|
|
334 |
{ SIN54, SIN54,-SIN54},
|
|
335 |
{ SIN54,-SIN54, SIN54},
|
|
336 |
{ SIN54,-SIN54,-SIN54},
|
|
337 |
{-SIN54, SIN54, SIN54},
|
|
338 |
{-SIN54, SIN54,-SIN54},
|
|
339 |
{-SIN54,-SIN54, SIN54},
|
|
340 |
{-SIN54,-SIN54,-SIN54},
|
|
325 |
{ 0, cA, cB},
|
|
326 |
{ 0, cA,-cB},
|
|
327 |
{ 0,-cA, cB},
|
|
328 |
{ 0,-cA,-cB},
|
|
329 |
{ cB, 0, cA},
|
|
330 |
{ cB, 0,-cA},
|
|
331 |
{-cB, 0, cA},
|
|
332 |
{-cB, 0,-cA},
|
|
333 |
{ cA, cB, 0},
|
|
334 |
{ cA,-cB, 0},
|
|
335 |
{-cA, cB, 0},
|
|
336 |
{-cA,-cB, 0},
|
|
337 |
{ cC, cC, cC},
|
|
338 |
{ cC, cC,-cC},
|
|
339 |
{ cC,-cC, cC},
|
|
340 |
{ cC,-cC,-cC},
|
|
341 |
{-cC, cC, cC},
|
|
342 |
{-cC, cC,-cC},
|
|
343 |
{-cC,-cC, cC},
|
|
344 |
{-cC,-cC,-cC},
|
|
341 | 345 |
}; |
342 | 346 |
} |
343 | 347 |
|
Also available in: Unified diff
Make the Kilo and Megaminxes standard size (dodecahedron size=3,5, i.e. equal to numLayers so that DIST2D and DIST3D are standard)