The ROT function rotates an image by an arbitrary amount. At the same time, it can magnify, demagnify, and/or translate an image. Note that if you want to rotate an array by a multiple of 90 degrees, you should use the ROTATE function for faster results.

This routine is written in the IDL language. Its source code can be found in the file ```
rot.pro
```

in the ```
lib
```

subdirectory of the IDL distribution.

The image array to be rotated. This array can be of any type, but must have two dimensions. The output image has the same dimensions and data type of the input image.

An optional magnification factor. A value of 1.0 results in no change. A value greater than one performs magnification and a value less than one performs demagnification.

Set this keyword to use bilinear interpolation. The default is to use nearest neighbor sampling.

Set this keyword to a value between -1 and 0 to use the cubic convolution interpolation method with the specified value as the interpolation parameter. Setting this keyword equal to a value greater than zero specifies a value of -1 for the interpolation parameter. Park and Schowengerdt (see reference below) suggest that a value of -0.5 significantly improves the reconstruction properties of this algorithm.

Cubic convolution is an interpolation method that closely approximates the theoretically optimum sinc interpolation function using cubic polynomials. According to sampling theory, details of which are beyond the scope of this document, if the original signal, *
f*
, is a band-limited signal, with no frequency component larger than *
w*
_{
0}
, and *
f*
is sampled with spacing less than or equal to 1/(2*
w*
_{
0}
), then *
f*
can be reconstructed by convolving with a sinc function: sinc(*
x*
) = sin(*
p*
*
x*
) / (*
p*
*
x*
).

In the one-dimensional case, four neighboring points are used, while in the two-dimensional case 16 points are used. Note that cubic convolution interpolation is significantly slower than bilinear interpolation.

Rifman, S.S. and McKinnon, D.M., "Evaluation of Digital Correction Techniques for ERTS Images; Final Report", Report 20634-6003-TU-00, TRW Systems, Redondo Beach, CA, July 1974.

S. Park and R. Schowengerdt, 1983 "Image Reconstruction by Parametric Cubic Convolution", Computer Vision, Graphics & Image Processing 23, 256.

A = BYTSCL(DIST(256)) *;
Create a byte image.*

B = ROT(A, 33, 1.5, /INTERP) *;
Rotate the image 33 degrees, magnify it 15 times, and use bilinear interpolation to make the output look nice.*