the 2D array to be rotated.
The number of indexes to rotate the minor-axis to the right. positive values rotate right, while negative values rotate left.
The original array is returned back after the rotation.
const arr2d: Array2DRowMajor<number> = [
[1 , 2 , 3 , 4 , 5 , 6 ],
[7 , 8 , 9 , 10, 11, 12],
[13, 14, 15, 16, 17, 18],
]
rotateArray2DMinor(arr2d, 2)
arr2d === [
[5 , 6 , 1 , 2 , 3 , 4 ,],
[11, 12, 7 , 8 , 9 , 10,],
[17, 18, 13, 14, 15, 16,],
]
Generated using TypeDoc
rotate the minor-axis of a 2D array by the specified amount to the right. the original array is mutated
given a row-major (and column-minor) 2D array
arr2d
, this function would rotate its columns by the specifiedamount
.a positive
amount
would rotate the columns to the right, and a negativeamount
would rotate it to the left.