# nnbvec -- Interpolation using nearest neighbor pixel of input data window # # Description: # ------------ # This routine calculates the nearest neighbor in the input data window, # given the position of the output pixel in the reference frame of the # input array. # # # Version Date Author Description # 27-JAN-1993 RAY WILLIAMSON Convert to SPP # 2 1-AUG-1983 PAT MURPHY Add PDL and FORTRAN code # 1 1-AUG-1983 PAT MURPHY Prolog Generation procedure nnbvec ( input, dim, coord, badpix,result) int dim, i # Size of input and local loop variable real input[dim] # The input vector real coord, badpix # Location in input and fill value real result # The result of the interpolation begin # Assume point is outside window result = badpix # Get nearest neighbor i = int( .5 + coord) if (i >= 1 && i <= dim) result = input[i] end