FacePosition
¶
An enum describing the different faces of a rubik's cube.
Also (through same-value declaration) provides a mapping from relative to absolute faces.
from_vector(vector)
staticmethod
¶
Converts the given vector to the corresponding face.
Conversion is done according to the default definition: BLUE/FRONT -> x+, RED/LEFT -> y+, YELLOW/TOP -> z+
Parameters:
Name | Type | Description | Default |
---|---|---|---|
vector |
ndarray |
the vector to convert to a face |
required |
Returns:
Type | Description |
---|---|
FacePosition |
the corresponding face |
Source code in core/cube/FacePosition.py
147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 |
|
from_string_notation(string)
staticmethod
¶
Returns the internal representation for a given character, swapping left and right because of the different models used.
Note
left and right are swapped because cuber notation uses the point of view
of the cuber and our FacePosition
uses the point of view of the cube
Returns:
Type | Description |
---|---|
FacePosition |
the internal representation of the face |
Source code in core/cube/FacePosition.py
172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 |
|
from_tile_color(tile_color)
staticmethod
¶
Converts the given color to the corresponding face.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
tile_color |
TileColor |
the color of the face |
required |
Returns:
Type | Description |
---|---|
FacePosition |
the matching face |
Source code in core/cube/FacePosition.py
202 203 204 205 206 207 208 209 210 211 212 |
|
is_next_to(self, other)
¶
Checks whether the given face is next to this face.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
other |
FacePosition |
the possibly neighboring face |
required |
Returns:
Type | Description |
---|---|
bool |
whether the given face is a neighbor |
Source code in core/cube/FacePosition.py
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
|
to_vector(self)
¶
Converts the face to its vector representation.
Conversion is done according to the default definition: BLUE/FRONT -> x+, RED/LEFT -> y+, YELLOW/TOP -> z+
Source code in core/cube/FacePosition.py
68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 |
|
to_rotation(self, degrees)
¶
Returns the rotation matching this face axis and the given degrees.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
degrees |
float |
the amount of rotation. |
required |
Returns:
Type | Description |
---|---|
Rotation |
the rotation |
Source code in core/cube/FacePosition.py
86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 |
|
to_color(self)
¶
Converts this face to its color.
Returns:
Type | Description |
---|---|
TileColor |
the matching color |
Source code in core/cube/FacePosition.py
114 115 116 117 118 119 120 |
|
to_string_notation(self)
¶
Returns the cuber notation representation, swapping left and right because of the different models used.
Note
left and right are swapped because cuber notation uses the point of view
of the cuber and our FacePosition
uses the point of view of the cube
Returns:
Type | Description |
---|---|
str |
the cuber notation of this face (a letter) |
Source code in core/cube/FacePosition.py
122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 |
|