| 1 | greg | 2.2 | /* RCSid $Id: interp2d.h,v 2.1 2013/02/09 00:55:40 greg Exp $ */ | 
| 2 | greg | 2.1 | /* | 
| 3 |  |  | * Header for interpolation of anisotropic values on 2-D plane. | 
| 4 |  |  | * | 
| 5 |  |  | *      G.Ward Feb 2013 | 
| 6 |  |  | */ | 
| 7 |  |  |  | 
| 8 |  |  | #define NI2DSMF 0.42f                   /* minimal smoothing radius */ | 
| 9 |  |  |  | 
| 10 |  |  | #define NI2DIR  (2*4)                   /* # interpolation directions */ | 
| 11 |  |  |  | 
| 12 |  |  | /* Data structure for interpolant */ | 
| 13 |  |  | typedef struct { | 
| 14 |  |  | int             ns;             /* number of sample positions */ | 
| 15 |  |  | float           rmin;           /* minimum valid radius (default=.5) */ | 
| 16 |  |  | float           smf;            /* smoothing factor (def=NI2DSMF) */ | 
| 17 |  |  | unsigned short  (*ra)[NI2DIR];  /* anisotropic radii (private) */ | 
| 18 |  |  | float           spt[1][2];      /* sample positions (extends struct) */ | 
| 19 |  |  | } INTERP2; | 
| 20 |  |  |  | 
| 21 |  |  | /* Allocate a new set of interpolation samples (caller assigns spt[] array) */ | 
| 22 |  |  | extern INTERP2  *interp2_alloc(int nsamps); | 
| 23 |  |  |  | 
| 24 | greg | 2.2 | /* Resize interpolation array (caller must assign any new values) */ | 
| 25 |  |  | extern INTERP2  *interp2_realloc(INTERP2 *ip, int nsamps); | 
| 26 |  |  |  | 
| 27 | greg | 2.1 | /* Assign full set of normalized weights to interpolate the given location */ | 
| 28 |  |  | extern int      interp2_weights(float wtv[], INTERP2 *ip, double x, double y); | 
| 29 |  |  |  | 
| 30 |  |  | /* Get normalized weights and indexes for n best samples in descending order */ | 
| 31 |  |  | extern int      interp2_topsamp(float wt[], int si[], const int n, | 
| 32 |  |  | INTERP2 *ip, double x, double y); | 
| 33 |  |  | /* Free interpolant */ | 
| 34 |  |  | extern void     interp2_free(INTERP2 *ip); | 
| 35 | greg | 2.2 |  | 
| 36 |  |  | /* (Re)compute anisotropic basis function interpolant (normally automatic) */ | 
| 37 |  |  | extern int      interp2_analyze(INTERP2 *ip); |