|
CubeTwister 2.0alpha142 2012-02-11 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectch.randelshofer.rubik.AbstractCube
ch.randelshofer.rubik.PocketCube
public class PocketCube
Represents the state of a 2-times sliced cube (Pocket Cube) by the location and orientation of its parts.
A Pocket Cube has 8 corner parts. The parts divide each face of the cube into 2 x 2 layers.
The following diagram shows the initial orientations and locations of the corner parts:
+---+---+
|4.0|2.0|
+--- ---+
ulb ufl|6.0|0.0|urf ubr
+---+---+---+---+---+---+---+---+
|4.1|6.2|6.1|0.2|0.1|2.2|2.1|4.2|
+--- ---+--- ---+--- ---+--- ---+
|5.2|7.1|7.2|1.1|1.2|3.1|3.2|5.1|
+---+---+---+---+---+---+---+---+
dbl dlf|7.0|1.0|dfr drb
+--- ---+
|5.0|3.0|
+---+---+
For more information about the location and orientation of the parts see
AbstractCube.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class ch.randelshofer.rubik.AbstractCube |
|---|
AbstractCube.TransformType |
| Field Summary |
|---|
| Fields inherited from class ch.randelshofer.rubik.AbstractCube |
|---|
CENTER_PART, CENTER_TO_SIDE_MAP, CORNER_PART, CORNER_SWIPE_TABLE, CORNER_TO_FACE_MAP, cornerLoc, cornerOrient, EDGE_PART, EDGE_TO_ANGLE_MAP, EDGE_TO_AXIS_MAP, EDGE_TO_FACE_MAP, edgeLoc, edgeOrient, layerCount, NUMBER_OF_CORNER_PARTS, SIDE_PART, sideLoc, sideOrient, transformAngle, transformAxis, transformMask, transformType |
| Constructor Summary | |
|---|---|
PocketCube()
Creates a new instance. |
|
| Method Summary | |
|---|---|
int |
getPartLayerMask(int part,
int orientation)
Returns the current layer mask on which the orientation of the part lies. |
int |
getPartSwipeAngle(int part,
int orientation,
int swipeDirection)
Returns the angle on which the orientation of the part can be swiped into the specified direction. |
int |
getPartSwipeAxis(int part,
int orientation,
int swipeDirection)
Returns the axis on which the orientation of the part can be swiped into the specified direction. |
int |
getPartSwipeLayerMask(int part,
int orientation,
int swipeDirection)
Returns the layer mask on which the orientation of the part can be swiped into the specified direction. |
void |
setToStickers(int[][] stickers)
Sets the cube to a state where the faces of the parts map to the provided stickers array. |
int[][] |
toStickers()
Converts the cube into a stickers array reflecting the current permutation of the cube. |
protected void |
transform0(int axis,
int layerMask,
int angle)
Transforms the cube and fires a cubeTwisted event. |
| Methods inherited from class java.lang.Object |
|---|
finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public PocketCube()
| Method Detail |
|---|
public int getPartLayerMask(int part,
int orientation)
getPartLayerMask in interface CubegetPartLayerMask in class AbstractCube
protected void transform0(int axis,
int layerMask,
int angle)
transform0 in class AbstractCubeaxis - 0=x, 1=y, 2=z axis.layerMask - A bitmask specifying the layers to be transformed.
The size of the layer mask depends on the value returned by
getLayerCount(axis). For a 3x3x3 cube, the layer mask has the
following meaning:
3=rotate the whole cube;angle - positive values=clockwise rotationAbstractCube.getLayerCount()public int[][] toStickers()
Cube
Cube.setToStickers(int[][])public void setToStickers(int[][] stickers)
Cube
stickers - Sticker array to be reused. The method creates a new
array if this parameter is null.
public int getPartSwipeAxis(int part,
int orientation,
int swipeDirection)
Cube
part - The part index.orientation - The orientation of the part where swiping is performed.swipeDirection - The direction of the swipe. 0=up,1=right,2=down,4=left.
public int getPartSwipeLayerMask(int part,
int orientation,
int swipeDirection)
Cube
part - The part index.orientation - The orientation of the part where swiping is performed.swipeDirection - The direction of the swipe. 0=up,1=right,2=down,4=left.
public int getPartSwipeAngle(int part,
int orientation,
int swipeDirection)
Cube
part - The part index.orientation - The orientation of the part where swiping is performed.swipeDirection - The direction of the swipe. 0=up,1=right,2=down,4=left.
|
(c) Werner Randelshofer. All rights reserved. |
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||