Soma cube type puzzle solving (array rotation)
I''m trying to write a little problem to solve a Soma cube varient. Each piece is represented by a 6x6x6 array of booleans, and will be a brute-force method of trying every combination all the pieces together which fit into the cubes bounds.
Obviously each piece can be rotated around the x, y and z axies (at multiples of 90 deg.) and any combination of. This is where i''m stuck - how to ''rotate'' a 3d (or even 2d) array by a specified amount around an axis.
After scrawling down variations and figuring out small examples, there doesn''t seem to be an obvious pattern. The only thing that springs to mind is to construct a matrix for the transformation (eg. 90 around x), then multiply the original indices (eg. [0][0], [2][4] etc.) by the matrix, then use the result as the destination indices.
This seems like the long way around though, is there a more suitable and easier way?
Thanks
[size="1"][[size="1"]TriangularPixels.com[size="1"]] [[size="1"]Rescue Squad[size="1"]] [[size="1"]Snowman Village[size="1"]] [[size="1"]Growth Spurt[size="1"]]
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement