1 |
greg |
3.3 |
/* RCSid: $Id$ */ |
2 |
greg |
3.1 |
/* |
3 |
|
|
* Header file for 3D warping routines. |
4 |
|
|
*/ |
5 |
|
|
|
6 |
|
|
#include "lookup.h" |
7 |
|
|
|
8 |
|
|
/* interpolation flags */ |
9 |
|
|
#define W3EXACT 01 /* no interpolation (slow) */ |
10 |
|
|
#define W3FAST 02 /* discontinuous approx. (fast) */ |
11 |
|
|
|
12 |
|
|
/* return flags for warp3d() */ |
13 |
|
|
#define W3OK 0 /* normal return status */ |
14 |
|
|
#define W3GAMUT 01 /* out of gamut */ |
15 |
|
|
#define W3BADMAP 02 /* singular map */ |
16 |
|
|
#define W3ERROR 04 /* system error (check errno) */ |
17 |
|
|
|
18 |
|
|
#define GNBITS 6 /* number of bits per grid size <= 8 */ |
19 |
|
|
#define MAXGN (1<<GNBITS) /* maximum grid dimension */ |
20 |
|
|
|
21 |
|
|
typedef unsigned char GNDX[3]; /* grid index type */ |
22 |
|
|
|
23 |
|
|
typedef float W3VEC[3]; /* vector type for 3D warp maps */ |
24 |
|
|
|
25 |
|
|
struct grid3d { |
26 |
greg |
3.2 |
unsigned char flags; /* interpolation flags */ |
27 |
greg |
3.1 |
GNDX gn; /* grid dimensions */ |
28 |
greg |
3.2 |
W3VEC gmin, gstep; /* grid corner and voxel size */ |
29 |
greg |
3.1 |
LUTAB gtab; /* grid lookup table */ |
30 |
|
|
}; /* a regular, sparse warping grid */ |
31 |
|
|
|
32 |
|
|
typedef struct { |
33 |
greg |
3.2 |
W3VEC *ip, *ov; /* discrete input/displ. pairs */ |
34 |
greg |
3.1 |
int npts; /* number of point pairs */ |
35 |
|
|
W3VEC llim, ulim; /* lower and upper input limits */ |
36 |
|
|
double d2min, d2max; /* min. and max. point distance^2 */ |
37 |
|
|
struct grid3d grid; /* point conversion grid */ |
38 |
|
|
} WARP3D; /* a warp map */ |
39 |
|
|
|
40 |
|
|
extern WARP3D *new3dw(), *load3dw(); |
41 |
|
|
|
42 |
|
|
#define W3VCPY(v1,v2) ((v1)[0]=(v2)[0],(v1)[1]=(v2)[1],(v1)[2]=(v2)[2]) |