Returns arotated and/or transposed copy of the input array.
direction An integer that specifies the type of rotation to be performed, as shown below:
Direction | Transpose | Rotation Clockwise |
---|---|---|
0 | No | None |
1 | No | 90º |
2 | No | 180º |
3 | No | 270º |
4 | Yes | None |
5 | Yes | 90º |
6 | Yes | 180º |
7 | Yes | 270º |
The resulting array is of the same data type as the input array. The dimensions of the result are the same as those of array if direction is equal to 0 or 2; the dimensions are switched if direction is 1 or 3.
TIP: To rotate by amounts other than multiples of 90 degrees, use the functions ROT and ROT_INT. However, note that ROTATE is more efficient than either of those functions.
X
, use the expression:
ROTATE(X,2)
X = [0,1,2,3]
ROTATE(X,2) = [3,2,1,0]
OPENR, unit, FILEPATH('x2y2.dat', $
Subdir ='data'), /Get_Lun
.
img = BYTARR(320, 256) READU, unit, img FREE_LUN, unit
.
WINDOW, 0, Xsize = 640, Ysize = 640
TV, img, 0, 321 TV, ROTATE(img, 1), 321, 257 TV, ROTATE(img, 2), 0, 0 TV, ROTATE(img, 3), 321, 0
Figure 2-99 Original image and rotations.
Figure 2-100 Original image and rotations.