/********************************************************************************* * * Purpose: interpolate interpolates for the position and velocity components * at a specific time within time ordered arrays of position and * velocity data. A hermite polynomial, which considers both * position and velocity components, is used for the interpolation. * * Input: posArray 2D Array of Position Components * velArray 2D Array of Velocity Components * xn Starting Point Index for Interpolation * cnum Number of Coordinates Being Interpolated * asize Number of Elements in Array[cnum][asize] * tstep Time Difference between Points in Array * intpts Number of Interpolation Points * tdif Time Difference xn - xi = tdif * Output: newPos Interpolated Position Vector for time xi * newVel Interpolated Velocity Vector for time xi * * Converted from FORTRAN INTRP0 (J.Toth) on 10/21/2002 by C.W.Brown * **********************************************************************************/ #include #include "HInterpolate.h" //using namespace std; //void interpolate(double posArray[][MAX_ARR_SIZE], double velArray[][MAX_ARR_SIZE], void interpolate(double *posArray, double *velArray, int xn, int cnum, int asize, double tstep, int intpts, double tdif, double newPos[], double newVel[]) { int i, j; int ic, jc, xnmod; //Coefficient Counters int npoint; double nsteps; double ll, a, b; double close; //double posArray[3][MAX_ARR_SIZE]; //double velArray[3][MAX_ARR_SIZE]; double hp[2][MAX_INTPTS]; double hv[2][MAX_INTPTS]; /* for(i=0; i