Rotation
¶
A class representing a cube rotation of a face by n
90° turns.
Attributes:
Name | Type | Description |
---|---|---|
rotation |
scipy.spatial.transform.Rotation |
the rotation matrix to apply to 3d coordinates |
face |
FacePosition |
the face to rotate |
n |
int |
the number of clockwise turns. |
apply(self, to_item)
¶
Applies the rotation to the given item (e.g. vector or matrix).
Parameters:
Name | Type | Description | Default |
---|---|---|---|
to_item |
ndarray |
the item to rotate |
required |
Returns:
Type | Description |
---|---|
ndarray |
the rotated item |
Source code in core/spatial/Rotation.py
23 24 25 26 27 28 29 30 31 32 33 34 35 |
|
from_string_notation(string)
staticmethod
¶
Parses a list of cuber notation rotations and converts them to the internal representation.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
string |
str |
the cuber notation formatted string |
required |
Returns:
Type | Description |
---|---|
List[Rotation] |
a list of |
Source code in core/spatial/Rotation.py
51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 |
|
reverse_multiple(rotations)
staticmethod
¶
Reverse a list of rotations by reversing the order but also each rotation individually. This creates the inverse set of rotations to apply to a cube to bring it back to its initial state.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
rotations |
List[Rotation] |
the rotations to reverse |
required |
Returns:
Type | Description |
---|---|
List[Rotation] |
the resulting list of rotations |
Source code in core/spatial/Rotation.py
78 79 80 81 82 83 84 85 86 87 88 89 |
|
reversed(self)
¶
Returns a reversed Rotation
which basically undoes the original one.
Source code in core/spatial/Rotation.py
47 48 49 |
|