Revision c9e40dfc
Added by Leszek Koltunski about 2 years ago
src/main/java/org/distorted/objectlib/main/ObjectType.java | ||
---|---|---|
79 | 79 |
SKEW_3 ( TwistySkewb.class , new int[] {3,3,3,3} , 21, R.drawable.skew_3, true), |
80 | 80 |
CONT_2 ( TwistyContainer.class , new int[] {2,2,2,2} , 12, R.drawable.cont_2, true), |
81 | 81 |
|
82 |
VOID_3 ( TwistyVoid.class , new int[] {3,3,3} , 17, R.drawable.void_3, false), // wasDownloadableButNowIsBuiltIn()
|
|
83 |
CRYS_3 ( TwistyCrystal.class , new int[] {3,3,3,3,3,3}, 27, R.drawable.crys_3, false), // function!
|
|
84 |
STAR_3 ( TwistyStarminx.class , new int[] {3,3,3,3,3,3}, 27, R.drawable.star_3, false),
|
|
85 |
PENT_2 ( TwistyPentultimate.class , new int[] {2,2,2,2,2,2}, 21, R.drawable.pent_2, false),
|
|
82 |
VOID_3 ( TwistyVoid.class , new int[] {3,3,3} , 17, R.drawable.void_3, true), // wasDownloadableButNowIsBuiltIn()
|
|
83 |
CRYS_3 ( TwistyCrystal.class , new int[] {3,3,3,3,3,3}, 27, R.drawable.crys_3, true), // function!
|
|
84 |
STAR_3 ( TwistyStarminx.class , new int[] {3,3,3,3,3,3}, 27, R.drawable.star_3, true),
|
|
85 |
PENT_2 ( TwistyPentultimate.class , new int[] {2,2,2,2,2,2}, 21, R.drawable.pent_2, true),
|
|
86 | 86 |
|
87 | 87 |
; |
88 | 88 |
|
src/main/java/org/distorted/objectlib/main/TwistyObject.java | ||
---|---|---|
964 | 964 |
if( moves!=null ) |
965 | 965 |
{ |
966 | 966 |
Static4D quat; |
967 |
int index, axis, rowBitmap, angle; |
|
967 |
int index, axis, row, rowBitmap, angle;
|
|
968 | 968 |
|
969 | 969 |
for(int[] move: moves) |
970 | 970 |
{ |
971 | 971 |
axis = move[0]; |
972 | 972 |
rowBitmap= computeBitmapFromRow( move[1],axis ); |
973 |
angle = move[2]*(360/mBasicAngles[axis][move[1]]); // this assumes that all layers from |
|
974 |
// the bitmap have the same BasicAngle. |
|
975 |
// at the moment this is always true as |
|
976 |
// there are no bandaged objects with |
|
977 |
// different per-layer BasicAngles. |
|
973 |
row = computeRowFromBitmap( move[1] ); |
|
974 |
angle = move[2]*(360/mBasicAngles[axis][row]); // this assumes that all layers from |
|
975 |
// the bitmap have the same BasicAngle. |
|
976 |
// at the moment this is always true as |
|
977 |
// there are no bandaged objects with |
|
978 |
// different per-layer BasicAngles. |
|
978 | 979 |
quat = makeQuaternion(axis,angle); |
979 | 980 |
|
980 | 981 |
for(int j=0; j<mNumCubits; j++) |
... | ... | |
1017 | 1018 |
return rowBitmap; |
1018 | 1019 |
} |
1019 | 1020 |
|
1021 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
1022 |
|
|
1023 |
private int computeRowFromBitmap(int rowBitmap) |
|
1024 |
{ |
|
1025 |
int index = 0; |
|
1026 |
|
|
1027 |
while(index<32) |
|
1028 |
{ |
|
1029 |
if( (rowBitmap&0x1) != 0 ) return index; |
|
1030 |
rowBitmap>>=1; |
|
1031 |
index++; |
|
1032 |
} |
|
1033 |
return 0; |
|
1034 |
} |
|
1035 |
|
|
1020 | 1036 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
1021 | 1037 |
// Clamp all rotated positions to one of those original ones to avoid accumulating errors. |
1022 | 1038 |
// Do so only if minimal Error is appropriately low (shape-shifting puzzles - Square-1) |
Also available in: Unified diff
Bugfix