/* FILE: /mxtools/src/psfshift/ip_shift2d.c * PURPOSE: * AUTHOR: Kenneth J. Mighell (mighell@noao.edu) * LANGUAGE: ANSI C * DATE: 2001OCT25 * COPYRIGHT: (C) 2001 Assoc. of Universities for Research in Astronomy Inc. */ #include #include "inc.h" int ip_Shift2d_i3( struct mxip_image_s *image, double deltax, double deltay ) { char mxfunc[] = "ip_Shift2d_i3"; int mxstatus = 0; int status = 1; int nx; int ny; int ix; int iy; int size; float *ivecd; float *ovecd; nx = image->nxi; ny = image->nyi; /* Allocate working vectors */ size = nx; if (ny>nx) size = ny; ivecd = (float *)calloc( size, sizeof(float)); mxstatus++; if ((float *)NULL==ivecd) { sprintf (MX.tmpmsg, "# Could not allocate ivecd with %d floats!\n", size); goto mx_error2; } ovecd = (float *)calloc( size, sizeof(float)); mxstatus++; if ((float *)NULL==ovecd) { sprintf (MX.tmpmsg, "# Could not allocate ovecd with %d floats!\n", size); goto mx_error2; } /* Shift DELTAX pixels in the X direction */ for (iy=0; iymatrixd[iy][ix]; } sshift_ansi( ivecd, nx, (float)deltax, (float)0.0, ovecd); for (ix=0; ixmatrixd[iy][ix] = ovecd[ix]; } } /* Shift DELTAY pixels in the Y direction */ for (ix=0; ixmatrixd[iy][ix]; } sshift_ansi( ivecd, ny, (float)deltay, (float)0.0, ovecd); for (iy=0; iymatrixd[iy][ix] = ovecd[iy]; } } ok: status = 0; goto bye; mx_error1: mxp_tmpmsg_init_f0(); mx_error2: mxp_errmsg_append_f3 (mxfunc, mxstatus, MX.tmpmsg); goto bye; bye: free (ivecd); free (ovecd); return(status); } /* end-of-file */