Revision f20119c6
Added by Leszek Koltunski over 4 years ago
| src/main/java/org/distorted/objects/TwistyBandagedAbstract.java | ||
|---|---|---|
| 514 | 514 |
} |
| 515 | 515 |
|
| 516 | 516 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
| 517 |
// this implements the fact that certain cubits have multiple 'centers' and this means the cubit |
|
| 518 |
// might span more than one layer along a given axis - i.e. that this is a bandaged puzzle. |
|
| 517 | 519 |
|
| 518 | 520 |
int computeBitmapFromRow(int rowBitmap, int axis) |
| 519 | 521 |
{
|
| src/main/java/org/distorted/objects/TwistyObject.java | ||
|---|---|---|
| 418 | 418 |
|
| 419 | 419 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
| 420 | 420 |
// Clamp all rotated positions to one of those original ones to avoid accumulating errors. |
| 421 |
// Do so only if minimal Error is appropriately low (shape-shifting puzzles - Square-1) |
|
| 421 | 422 |
|
| 422 | 423 |
void clampPos(float[] pos, int offset) |
| 423 | 424 |
{
|
| ... | ... | |
| 452 | 453 |
} |
| 453 | 454 |
} |
| 454 | 455 |
|
| 455 |
if( minError< 0.1f ) |
|
| 456 |
if( minError< 0.1f ) // TODO: 0.1 ?
|
|
| 456 | 457 |
{
|
| 457 | 458 |
pos[offset ] = mOrigPos[minErrorIndex1][3*minErrorIndex2 ]; |
| 458 | 459 |
pos[offset+1] = mOrigPos[minErrorIndex1][3*minErrorIndex2+1]; |
| src/main/java/org/distorted/objects/TwistySquare1.java | ||
|---|---|---|
| 110 | 110 |
{ 0.0f,-1.0f,-1.5f },
|
| 111 | 111 |
{-1.5f,-1.0f, 0.0f },
|
| 112 | 112 |
|
| 113 |
{ 1.5f, 1.0f, 1.5f },
|
|
| 114 |
{ 1.5f, 1.0f,-1.5f },
|
|
| 115 |
{-1.5f, 1.0f,-1.5f },
|
|
| 116 |
{-1.5f, 1.0f, 1.5f },
|
|
| 117 |
{ 1.5f,-1.0f, 1.5f },
|
|
| 118 |
{ 1.5f,-1.0f,-1.5f },
|
|
| 119 |
{-1.5f,-1.0f,-1.5f },
|
|
| 120 |
{-1.5f,-1.0f, 1.5f },
|
|
| 113 |
{ 1.0f, 1.0f, 2.0f, 2.0f, 1.0f, 1.0f },
|
|
| 114 |
{ 1.0f, 1.0f,-2.0f, 2.0f, 1.0f,-1.0f },
|
|
| 115 |
{-1.0f, 1.0f,-2.0f,-2.0f, 1.0f,-1.0f },
|
|
| 116 |
{-1.0f, 1.0f, 2.0f,-2.0f, 1.0f, 1.0f },
|
|
| 117 |
{ 1.0f,-1.0f, 2.0f, 2.0f,-1.0f, 1.0f },
|
|
| 118 |
{ 1.0f,-1.0f,-2.0f, 2.0f,-1.0f,-1.0f },
|
|
| 119 |
{-1.0f,-1.0f,-2.0f,-2.0f,-1.0f,-1.0f },
|
|
| 120 |
{-1.0f,-1.0f, 2.0f,-2.0f,-1.0f, 1.0f }
|
|
| 121 | 121 |
}; |
| 122 | 122 |
|
| 123 | 123 |
private static final double[][] VERTICES_MIDDLE = new double[][] |
| ... | ... | |
| 439 | 439 |
return new float[][] { {-0.5f,+0.5f}, {0.0f} };
|
| 440 | 440 |
} |
| 441 | 441 |
|
| 442 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
| 443 |
// this implements the fact that corner cubits have multiple 'centers' and this means the cubit |
|
| 444 |
// might span more than one layer along a given axis - i.e. that this is a bandaged puzzle. |
|
| 445 |
|
|
| 446 |
int computeBitmapFromRow(int rowBitmap, int axis) |
|
| 447 |
{
|
|
| 448 |
int bitmap, initBitmap=0; |
|
| 449 |
|
|
| 450 |
while( initBitmap!=rowBitmap ) |
|
| 451 |
{
|
|
| 452 |
initBitmap = rowBitmap; |
|
| 453 |
|
|
| 454 |
for(int cubit=0; cubit<NUM_CUBITS; cubit++) |
|
| 455 |
{
|
|
| 456 |
bitmap = CUBITS[cubit].mRotationRow[axis]; |
|
| 457 |
if( (rowBitmap & bitmap) != 0 ) rowBitmap |= bitmap; |
|
| 458 |
} |
|
| 459 |
} |
|
| 460 |
|
|
| 461 |
return rowBitmap; |
|
| 462 |
} |
|
| 463 |
|
|
| 442 | 464 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
| 443 | 465 |
// PUBLIC API |
| 444 | 466 |
|
Also available in: Unified diff
Square-1: implement the fact that corners might bandage the puzzle.