// // Author: Joshua Cohen // Copyright 2017 // #include #include #include #include "Interpolator.h" #include "Constants.h" #include "ResampMethods.h" using std::complex; using std::vector; ResampMethods::ResampMethods() { return; } void ResampMethods::prepareMethods(int method) { if (method == SINC_METHOD) { vector filter((SINC_SUB*SINC_LEN)+1); double ssum; int intplength, filtercoef; Interpolator interp; printf("Initializing Sinc interpolator\n"); interp.sinc_coef(1.,SINC_LEN,SINC_SUB,0.,1,intplength,filtercoef,filter); // Normalize filter for (int i=0; i ResampMethods::interpolate_cx(vector > > &ifg, int x, int y, double fx, double fy, int nx, int ny, int method) { int xx, yy; Interpolator interp; if (method != SINC_METHOD) { printf("Error in ResampMethods::interpolate_cx - invalid interpolation method; interpolate_cx only performs a sinc interpolation currently\n"); return complex(0.,0.); } if ((x < SINC_HALF) || (x > (nx-SINC_HALF))) return complex(0.,0.); if ((y < SINC_HALF) || (y > (ny-SINC_HALF))) return complex(0.,0.); xx = x + SINC_HALF - 1; yy = y + SINC_HALF - 1; return interp.sinc_eval_2d(ifg,fintp,SINC_SUB,SINC_LEN,xx,yy,fx,fy,nx,ny); }