| 1 |
greg |
2.1 |
/* RCSid $Id$ */ |
| 2 |
|
|
/* |
| 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 |
|
|
/* Assign full set of normalized weights to interpolate the given location */ |
| 25 |
|
|
extern int interp2_weights(float wtv[], INTERP2 *ip, double x, double y); |
| 26 |
|
|
|
| 27 |
|
|
/* Get normalized weights and indexes for n best samples in descending order */ |
| 28 |
|
|
extern int interp2_topsamp(float wt[], int si[], const int n, |
| 29 |
|
|
INTERP2 *ip, double x, double y); |
| 30 |
|
|
|
| 31 |
|
|
/* Free interpolant */ |
| 32 |
|
|
extern void interp2_free(INTERP2 *ip); |