Open rubaiate opened 11 months ago
looks good and is well commented, however your choice of ordering of the axis (first <= second <= third) is the opposite to the previous ordering method, if possible could that be reversed to (first >= second >= third) , otherwise I'm happy to merge this asap!
Logic is updated to provide (first >= second >= third) axis size ordering.
This change enhance run time performance of python implementation by reducing number of rotations necessary.
The logic is based on bounding box of the new cube shape. Since cube is already cropped we can safely use np.shape as bounding box.
Performance improvement tested for n = 8
Without improvement![image](https://github.com/mikepound/opencubes/assets/7001376/12a690cd-fc6a-4111-9c37-592cd577fee9)
With improvement![image](https://github.com/mikepound/opencubes/assets/7001376/214384b0-2d7f-4f7f-853a-5bfbf671d581)
New steps
Following is the list of all possibilities
All axes size is equal No constraints are possible. Should be validated for 24 rotations.
Two axes sizes are equal other axis size is different Only 8 rotations are possible without breaking bounding box `for _ in range(0, 4): yield cube cube = np.rot90(cube, 1, equal_axes)
cube = np.rot90(cube, 2, (diff_axis, equal_axes[0]))
for _ in range(0, 4): yield cube cube = np.rot90(cube, 1, equal_axes)`
All axes sizes are different. Only 4 rotations are possible without breaking bounding box. yield cube yield np.rot90(cube, 2, (0, 1)) yield np.rot90(cube, 2, (0, 2)) yield np.rot90(cube, 2, (1, 2))