Back to index

radiance  4R0+20100331
warp3d.h
Go to the documentation of this file.
00001 /* RCSid: $Id: warp3d.h,v 3.5 2004/03/28 20:33:14 schorsch Exp $ */
00002 /*
00003  * Header file for 3D warping routines.
00004  */
00005 #ifndef _RAD_WARP3D_H_
00006 #define _RAD_WARP3D_H_
00007 
00008 #include "lookup.h"
00009 
00010 #ifdef __cplusplus
00011 extern "C" {
00012 #endif
00013 
00014                             /* interpolation flags */
00015 #define W3EXACT             01            /* no interpolation (slow) */
00016 #define W3FAST              02            /* discontinuous approx. (fast) */
00017 
00018                             /* return flags for warp3d() */
00019 #define W3OK         0             /* normal return status */
00020 #define W3GAMUT             01            /* out of gamut */
00021 #define W3BADMAP     02            /* singular map */
00022 #define W3ERROR             04            /* system error (check errno) */
00023 
00024 #define GNBITS       6             /* number of bits per grid size <= 8 */
00025 #define MAXGN (1<<GNBITS)   /* maximum grid dimension */
00026 
00027 typedef unsigned char       GNDX[3];      /* grid index type */
00028 
00029 typedef float W3VEC[3];     /* vector type for 3D warp maps */
00030 
00031 struct grid3d {
00032        unsigned char flags;        /* interpolation flags */
00033        GNDX   gn;                  /* grid dimensions */
00034        W3VEC  gmin, gstep;         /* grid corner and voxel size */
00035        LUTAB  gtab;                /* grid lookup table */
00036 };                          /* a regular, sparse warping grid */
00037 
00038 typedef struct {
00039        W3VEC  *ip, *ov;            /* discrete input/displ. pairs */
00040        int    npts;                /* number of point pairs */
00041        W3VEC  llim, ulim;          /* lower and upper input limits */
00042        double d2min, d2max;        /* min. and max. point distance^2 */
00043        struct grid3d grid;         /* point conversion grid */
00044 } WARP3D;                   /* a warp map */
00045 
00046 extern int warp3d(W3VEC po, W3VEC pi, WARP3D *wp);
00047 extern int add3dpt(WARP3D* wp, W3VEC pti, W3VEC pto);
00048 extern WARP3D* new3dw(int flgs);
00049 extern WARP3D* load3dw(char *fn, WARP3D *wp);
00050 extern void free3dw(WARP3D *wp);
00051 extern int set3dwfl(WARP3D *wp, int flgs);
00052 
00053 #define  W3VCPY(v1,v2)      ((v1)[0]=(v2)[0],(v1)[1]=(v2)[1],(v1)[2]=(v2)[2])
00054 
00055 #ifdef __cplusplus
00056 }
00057 #endif
00058 #endif /* _RAD_WARP3D_H_ */
00059