How to calculate all 24 rotations of 3d array?
问题 I have a 3d numpy array describing a polycube (imagine a 3d tetris piece). How can I calculate all 24 rotations? Numpy's array manipulation routines includes a rot90 method, which gives 4 of the 24, but I'm clueless how to calculate the rest. My only idea is to convert the 3d array to a 2d matrix of co-ordinates, multiply by a rotation matrix, and convert back. But I'd rather work directly with the 3d array. Example 2x2x2 array: >>> from numpy import array >>> polycube array([[[1, 0], [1, 0]]