Revision c3203fb1
Added by Leszek Koltunski over 4 years ago
| src/main/java/org/distorted/objects/TwistyMinx.java | ||
|---|---|---|
| 326 | 326 |
mBasicCornerV[2] = new Static4D( 0, -0.500f, 0.0f, 0.0f ); |
| 327 | 327 |
} |
| 328 | 328 |
|
| 329 |
private static float[] mRowChances; |
|
| 330 |
|
|
| 331 | 329 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
| 332 | 330 |
|
| 333 | 331 |
TwistyMinx(int numLayers, int realSize, Static4D quat, DistortedTexture texture, MeshSquare mesh, |
| ... | ... | |
| 336 | 334 |
super(numLayers, realSize, quat, texture, mesh, effects, moves, obj, res, scrWidth); |
| 337 | 335 |
} |
| 338 | 336 |
|
| 339 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 340 |
|
|
| 341 |
private float[] getRowChances(int numLayers) |
|
| 342 |
{
|
|
| 343 |
float[] chances = new float[numLayers]; |
|
| 344 |
float denom = (float)(numLayers-1); |
|
| 345 |
int change = (numLayers-1)/2; |
|
| 346 |
|
|
| 347 |
for(int i= 0; i<change ; i++) chances[i] = (i+1)/denom; |
|
| 348 |
for(int i=change; i<numLayers; i++) chances[i] = (i )/denom; |
|
| 349 |
|
|
| 350 |
return chances; |
|
| 351 |
} |
|
| 352 |
|
|
| 353 | 337 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
| 354 | 338 |
|
| 355 | 339 |
Static4D[] getQuats() |
| ... | ... | |
| 463 | 447 |
{
|
| 464 | 448 |
int numLayers = getNumLayers(); |
| 465 | 449 |
|
| 466 |
if( mRowChances==null ) mRowChances = getRowChances(numLayers); |
|
| 467 |
|
|
| 468 | 450 |
if( num==0 ) |
| 469 | 451 |
{
|
| 470 | 452 |
scramble[num][0] = rnd.nextInt(NUM_AXIS); |
| ... | ... | |
| 477 | 459 |
|
| 478 | 460 |
if( num==0 ) |
| 479 | 461 |
{
|
| 480 |
float rowFloat = rnd.nextFloat(); |
|
| 481 |
|
|
| 482 |
for(int row=0; row<numLayers; row++) |
|
| 483 |
{
|
|
| 484 |
if( rowFloat<=mRowChances[row] ) |
|
| 485 |
{
|
|
| 486 |
scramble[num][1] = row; |
|
| 487 |
break; |
|
| 488 |
} |
|
| 489 |
} |
|
| 462 |
int nom = (numLayers-1)/2; |
|
| 463 |
int row = rnd.nextInt(nom); |
|
| 464 |
int lf = rnd.nextInt(2); |
|
| 465 |
scramble[num][1] = (lf==0 ? row : numLayers-1-row); |
|
| 490 | 466 |
} |
| 491 | 467 |
else |
| 492 | 468 |
{
|
Also available in: Unified diff
Minx'es: fix for the automatic rotations.