Revision c9e40dfc
Added by Leszek Koltunski about 2 years ago
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