input slice
rotation counter, can be negative
n-dimensional slice
import mir.ndslice.slice; import mir.ndslice.topology: iota; auto slice = iota(2, 3); auto a = [[0, 1, 2], [3, 4, 5]]; auto b = [[2, 5], [1, 4], [0, 3]]; auto c = [[5, 4, 3], [2, 1, 0]]; auto d = [[3, 0], [4, 1], [5, 2]]; assert(slice.rotated ( 4) == a); assert(slice.rotated!(0, 1)(-4) == a); assert(slice.rotated (1, 0, 8) == a); assert(slice.rotated == b); assert(slice.rotated!(0, 1)(-3) == b); assert(slice.rotated (1, 0, 3) == b); assert(slice.rotated ( 6) == c); assert(slice.rotated!(0, 1)( 2) == c); assert(slice.rotated (0, 1, -2) == c); assert(slice.rotated ( 7) == d); assert(slice.rotated!(0, 1)( 3) == d); assert(slice.rotated (1, 0, ) == d);
Rotates two selected dimensions by k*90 degrees. The order of dimensions is important. If the slice has two dimensions, the default direction is counterclockwise.