idlastro / DAOPHOT-Type Photometry Procedures: RINTER

[Source code]

NAME
RINTER
PURPOSE
Cubic interpolation of an image at a set of reference points.
EXPLANATION
This interpolation program is equivalent to using the intrinsic 
INTERPOLATE() function with CUBIC = -0.5.   However,
RINTER() has two advantages: (1) one can optionally obtain the 
X and Y derivatives at the reference points, and (2) if repeated
interpolation is to be applied to an array, then some values can
be pre-computed and stored in Common.   RINTER() was originally  
for use with the DAOPHOT procedures, but can also be used for 
general cubic interpolation.
CALLING SEQUENCE
Z = RINTER( P, X, Y, [ DFDX, DFDY ] )
         or
Z = RINTER(P, /INIT)
INPUTS
P  - Two dimensional data array, 
X  - Either an N element vector or an N x M element array,
         containing X subscripts where cubic interpolation is desired.
Y -  Either an N element vector or an N x M element array, 
         containing Y subscripts where cubic interpolation is desired.
OUTPUT
Z -  Result = interpolated vector or array.  If X and Y are vectors,
        then so is Z, but if X and Y are arrays then Z will be also.
        If P is DOUBLE precision, then so is Z, otherwise Z is REAL.
OPTIONAL OUTPUT
DFDX - Vector or Array, (same size and type as Z), containing the 
         derivatives with respect to X
DFDY - Array containing derivatives with respect to Y
OPTIONAL KEYWORD INPUT
/INIT - Perform computations associated only with the input array (i.e. 
        not with X and Y) and store in common.    This can save time if
        repeated calls to RINTER are made using the same array.  
EXAMPLE
suppose P is a 256 x 256 element array and X = FINDGEN(50)/2. + 100.
and Y = X.  Then Z will be a 50 element array, containing the
cubic interpolated points.
SIDE EFFECTS
can be time consuming.
RESTRICTION
Interpolation is not possible at positions outside the range of 
 the array (including all negative subscripts), or within 2 pixel
 units of the edge.  No error message is given but values of the 
 output array are meaningless at these positions.
PROCEDURE
invokes CUBIC interpolation algorithm to evaluate each element
in Z at virtual coordinates contained in X and Y with the data
in P.                                                          
COMMON BLOCKS
If repeated interpolation of the same array is to occur, then
one can save time by initializing the common block RINTER.    
REVISION HISTORY
March 1988 written W. Landsman STX Co.
Checked for IDL Version 2, J. Isensee, September, 1990
Corrected call to HISTOGRAM, W. Landsman November 1990
Converted to IDL V5.0   W. Landsman   September 1997
Fix output derivatives for 2-d inputs, added /INIT W. Landsman May 2000