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