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