## ROT

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.

### Calling Sequence

Result = ROT( A, Angle, [Mag, X 0 , Y 0 ; ] )

### Arguments

#### A

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.

#### ANGLE

Angle of rotation in degrees clockwise .

#### MAG

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.

#### X 0

X subscript for the center of rotation. If omitted, X 0 equals the number of columns in the image divided by 2.

#### Y 0

Y subscript for the center of rotation. If omitted, Y 0 equals the number of rows in the image divided by 2.

### Keywords

#### INTERP

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

#### CUBIC

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.

For further details see:

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.

#### MISSING

Set this keyword to a value to be substituted for pixels in the output image that map outside the input image.

#### PIVOT

Set this keyword to cause the image to pivot around the point (X 0 , Y 0 ) so that this point maps into the same point in the output image. By default, the point (X 0 , Y 0 ) in the input image is mapped into the center of the output image.

### Example

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

TV, A ; Display it.

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.

TV, B ; Display the rotated image.