| 1 | 
/* RCSid $Id: view.h,v 2.11 2003/06/27 06:53:22 greg Exp $ */ | 
| 2 | 
/* | 
| 3 | 
 *  view.h - header file for image generation. | 
| 4 | 
 * | 
| 5 | 
 *  Include after stdio.h and fvect.h | 
| 6 | 
 *  Includes resolu.h | 
| 7 | 
 */ | 
| 8 | 
#ifndef _RAD_VIEW_H_ | 
| 9 | 
#define _RAD_VIEW_H_ | 
| 10 | 
#ifdef __cplusplus | 
| 11 | 
extern "C" { | 
| 12 | 
#endif | 
| 13 | 
 | 
| 14 | 
#include  "resolu.h" | 
| 15 | 
 | 
| 16 | 
                                /* view types */ | 
| 17 | 
#define  VT_PER         'v'             /* perspective */ | 
| 18 | 
#define  VT_PAR         'l'             /* parallel */ | 
| 19 | 
#define  VT_ANG         'a'             /* angular fisheye */ | 
| 20 | 
#define  VT_HEM         'h'             /* hemispherical fisheye */ | 
| 21 | 
#define  VT_CYL         'c'             /* cylindrical panorama */ | 
| 22 | 
 | 
| 23 | 
typedef struct { | 
| 24 | 
        int  type;              /* view type */ | 
| 25 | 
        FVECT  vp;              /* view origin */ | 
| 26 | 
        FVECT  vdir;            /* view direction */ | 
| 27 | 
        FVECT  vup;             /* view up */ | 
| 28 | 
        double  horiz;          /* horizontal view size */ | 
| 29 | 
        double  vert;           /* vertical view size */ | 
| 30 | 
        double  hoff;           /* horizontal image offset */ | 
| 31 | 
        double  voff;           /* vertical image offset */ | 
| 32 | 
        double  vfore;          /* fore clipping plane */ | 
| 33 | 
        double  vaft;           /* aft clipping plane (<=0 for inf) */ | 
| 34 | 
        FVECT  hvec;            /* computed horizontal image vector */ | 
| 35 | 
        FVECT  vvec;            /* computed vertical image vector */ | 
| 36 | 
        double  hn2;            /* DOT(hvec,hvec) */ | 
| 37 | 
        double  vn2;            /* DOT(vvec,vvec) */ | 
| 38 | 
} VIEW;                 /* view parameters */ | 
| 39 | 
 | 
| 40 | 
extern VIEW  stdview; | 
| 41 | 
 | 
| 42 | 
#define  viewaspect(v)  sqrt((v)->vn2/(v)->hn2) | 
| 43 | 
 | 
| 44 | 
#define  STDVIEW        {VT_PER,{0.,0.,0.},{0.,1.,0.},{0.,0.,1.}, \ | 
| 45 | 
                                45.,45.,0.,0.,0.,0., \ | 
| 46 | 
                                {0.,0.,0.},{0.,0.,0.},0.,0.} | 
| 47 | 
 | 
| 48 | 
#define  VIEWSTR        "VIEW=" | 
| 49 | 
#define  VIEWSTRL       5 | 
| 50 | 
 | 
| 51 | 
 | 
| 52 | 
extern char     *setview(VIEW *v); | 
| 53 | 
extern void     normaspect(double va, double *ap, int *xp, int *yp); | 
| 54 | 
extern double   viewray(FVECT orig, FVECT direc, VIEW *v, double x, double y); | 
| 55 | 
extern void     viewloc(FVECT ip, VIEW *v, FVECT p); | 
| 56 | 
extern void     pix2loc(RREAL loc[2], RESOLU *rp, int px, int py); | 
| 57 | 
extern void     loc2pix(int pp[2], RESOLU *rp, double lx, double ly); | 
| 58 | 
extern int      getviewopt(VIEW *v, int ac, char *av[]); | 
| 59 | 
extern int      sscanview(VIEW *vp, char *s); | 
| 60 | 
extern void     fprintview(VIEW *vp, FILE *fp); | 
| 61 | 
extern char     *viewopt(VIEW *vp); | 
| 62 | 
extern int      isview(char *s); | 
| 63 | 
extern int      viewfile(char *fname, VIEW *vp, RESOLU *rp); | 
| 64 | 
 | 
| 65 | 
 | 
| 66 | 
#ifdef __cplusplus | 
| 67 | 
} | 
| 68 | 
#endif | 
| 69 | 
#endif /* _RAD_VIEW_H_ */ | 
| 70 | 
 |