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