|
CubeTwister 2.0alpha141 2011-10-13 | ||||||||
| 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.Cube7
public class Cube7
Represents the state of a 7-times sliced cube (such as a V-Cube 7) by the location and orientation of its parts.
A V-Cube 7 has 8 corner parts, 60 edge parts, 150 side parts and one center part. The parts divide each face of the cube into 7 x 7 layers.
Corner parts
The following diagram shows the initial orientations and locations of the corner parts:
+---+---+---+---+---+---+---+
|4.0| |2.0|
+---+ +---+
| |
+ +
| |
+ +
| u |
+ +
| |
+ +
| |
+---+ +---+
|6.0| |0.0|
+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
|4.1| |6.2|6.1| |0.2|0.1| |2.2|2.1| |4.2|
+---+ +---+---+ +---+---+ +---+---+ +---+
| | | | |
+ + + + +
| | | | |
+ + + + +
| l | f | r | b |
+ + + + +
| | | | |
+ + + + +
| | | | |
+---+ +---+---+ +---+---+ +---+---+ +---+
|5.2| |7.1|7.2| |1.1|1.2| |3.1|3.2| |5.1|
+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
|7.0| |1.0|
+---+ +---+
| |
+ +
| |
+ +
| d |
+ +
| |
+ +
| |
+---+ +---+
|5.0| |3.0|
+---+---+---+---+---+---+---+
Edge parts
The following diagram shows the initial orientations and locations of the edge parts. The first 12 edges are located at the center of the x-, y-, and z-axis. The second 12 edges are located near the origins of the x-, y- and z-axis. The last 12 edges are located far from the origin of the x-, y- and z-axis.
X--->
+---+---+---+---+---+---+---+
| |39 |15 |3.1| 27|51 | |
+---+---+---+---+---+---+---+
|42 | |36 |
+---+ +---+
|18 | |12 |
Z +---+ +---+ Z
| |6.0| u |0.0| |
V +---+ +---+ V
|30 | |24 |
+---+ +---+
|54 | |48 |
+---+---+---+---+---+---+---+
Z---> | |45 |21 |9.1|33 |57 | | <---Z <---X
+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
| |42 |18 |6.1|30 |54 | | |45 |21 |9.0|33 |57 | | |48 |24 |0.1|12 |36 | | |51 |27 |3.0|15 |39 | |
+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
|55 | |58 |58 | |49 |49 | |52 |52 | |55 |
+---+ +---+---+ +---+---+ +---+---+ +---+
|31 | |34 |34 | |25 |25 | |28 |28 | |31 |
^ +---+ +---+---+ +---+---+ +---+---+ +---+ ^
| |7.0| l 10.0|10.1 f |1.1|1.0| r |4.0|4.1| b |7.1| |
Y +---+ +---+---+ +---+---+ +---+---+ +---+ Y
|19 | |22 |22 | |13 |13 | |16 |16 | |19 |
+---+ +---+---+ +---+---+ +---+---+ +---+
|43 | |46 |46 | |37 |37 | |40 |40 | |43 |
+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
| |44 |20 |8.1|32 |56 | | |47 |23 11.0|35 |59 | | |50 |26 |2.1|14 |38 | | |53 |29 |5.0| 17|41 | |
+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
| |47 |23 11.1|35 |59 | | <---Z <---X
+---+---+---+---+---+---+---+
|56 | |50 |
+---+ +---+
|32 | |26 |
+---+ +---+ ^
|8.0| d |2.0| |
+---+ +---+ Z
|20 | |14 |
+---+ +---+
|44 | |38 |
+---+---+---+---+---+---+---+
| |41 |17 |5.1|29 |53 | |
+---+---+---+---+---+---+---+
X-->
Side parts
The following diagram shows the initial orientation and location of the side parts:
+---+---+---+---+---+---+---+
| .1 |
+ +---+---+---+---+---+ +
| |55 |133|85 |109|61 | |
+ +---+---+---+---+---+ +
| |103| 7 |37 |13 |139| |
+ +---+---+---+---+---+ +
| .0|79 |31 | 1 |43 |91 |.2 |
+ +---+---+---+---+---+ +
| |127|25 |49 |19 |115| |
+ +---+---+---+---+---+ +
| |73 |121|97 |145|67 | |
+ +---+---+---+---+---+ +
| .3 |
+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
| .0 | .2 | .3 | .1 |
+ +---+---+---+---+---+ + +---+---+---+---+---+ + +---+---+---+---+---+ + +---+---+---+---+---+ +
| |75 |129|81 |105|57 | | |62 |140|92 |116|68 | | |66 |144|96 |120|72 | | |59 |137|89 |113|65 | |
+ +---+---+---+---+---+ + +---+---+---+---+---+ + +---+---+---+---+---+ + +---+---+---+---+---+ +
| |123|27 |33 | 9 |135| | |110|14 |44 |20 |146| | |114|18 |48 |24 |126| | |107|11 |41 |17 |143| |
+ +---+---+---+---+---+ + +---+---+---+---+---+ + +---+---+---+---+---+ + +---+---+---+---+---+ +
| .3|99 |51 | 3 |39 |87 |.1 | .1|86 |38 | 2 |50 |98 |.3 | .2|90 |42 | 0 |30 |78 |.0 | .0|83 |35 | 5 |47 |95 |.2 |
+ +---+---+---+---+---+ + +---+---+---+---+---+ + +---+---+---+---+---+ + +---+---+---+---+---+ +
| |147|21 |45 |15 |111| | |134| 8 |32 |26 |122| | |138|12 |36 | 6 |102| | |131|29 |53 |23 |119| |
+ +---+---+---+---+---+ + +---+---+---+---+---+ + +---+---+---+---+---+ + +---+---+---+---+---+ +
| |69 |117|93 |141|63 | | |56 |104|80 |128|74 | | |60 |108|84 |132|54 | | |77 |125|101|149|71 | |
+ +---+---+---+---+---+ + +---+---+---+---+---+ + +---+---+---+---+---+ + +---+---+---+---+---+ +
| .2 | .0 | .1 | .3 |
+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
| .0 |
+ +---+---+---+---+---+ +
| |76 |130|82 |106|58 | |
+ +---+---+---+---+---+ +
| |124|28 |34 |10 |136| |
+ +---+---+---+---+---+ +
| .3|100|52 | 4 |40 |88 |.1 |
+ +---+---+---+---+---+ +
| |148|22 |46 |16 |112| |
+ +---+---+---+---+---+ +
| |70 |118|94 |142|64 | |
+ +---+---+---+---+---+ +
| .2 |
+---+---+---+---+---+---+---+
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 | |
|---|---|
Cube7()
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. |
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 Cube7()
| Method Detail |
|---|
public void transform0(int axis,
int layerMask,
int angle)
AbstractCube
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:
7=rotate the whole cube;angle - positive values=clockwise rotationAbstractCube.getLayerCount()
public int getPartLayerMask(int part,
int orientation)
getPartLayerMask in interface CubegetPartLayerMask in class AbstractCubepublic 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 | ||||||||