1 |
greg |
2.11 |
/* RCSid $Id: view.h,v 2.10 2003/06/26 00:58:09 schorsch Exp $ */ |
2 |
greg |
1.1 |
/* |
3 |
|
|
* view.h - header file for image generation. |
4 |
|
|
* |
5 |
greg |
2.7 |
* Include after fvect.h |
6 |
|
|
* Includes resolu.h |
7 |
|
|
*/ |
8 |
schorsch |
2.9 |
#ifndef _RAD_VIEW_H_ |
9 |
|
|
#define _RAD_VIEW_H_ |
10 |
|
|
#ifdef __cplusplus |
11 |
|
|
extern "C" { |
12 |
|
|
#endif |
13 |
greg |
1.1 |
|
14 |
greg |
2.7 |
#include "resolu.h" |
15 |
|
|
|
16 |
greg |
1.1 |
/* view types */ |
17 |
|
|
#define VT_PER 'v' /* perspective */ |
18 |
|
|
#define VT_PAR 'l' /* parallel */ |
19 |
greg |
1.6 |
#define VT_ANG 'a' /* angular fisheye */ |
20 |
|
|
#define VT_HEM 'h' /* hemispherical fisheye */ |
21 |
greg |
2.5 |
#define VT_CYL 'c' /* cylindrical panorama */ |
22 |
greg |
1.1 |
|
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 |
greg |
1.4 |
double hoff; /* horizontal image offset */ |
31 |
|
|
double voff; /* vertical image offset */ |
32 |
greg |
2.4 |
double vfore; /* fore clipping plane */ |
33 |
|
|
double vaft; /* aft clipping plane (<=0 for inf) */ |
34 |
greg |
1.4 |
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 |
greg |
1.1 |
} VIEW; /* view parameters */ |
39 |
|
|
|
40 |
|
|
extern VIEW stdview; |
41 |
|
|
|
42 |
greg |
1.4 |
#define viewaspect(v) sqrt((v)->vn2/(v)->hn2) |
43 |
|
|
|
44 |
greg |
2.3 |
#define STDVIEW {VT_PER,{0.,0.,0.},{0.,1.,0.},{0.,0.,1.}, \ |
45 |
greg |
2.4 |
45.,45.,0.,0.,0.,0., \ |
46 |
|
|
{0.,0.,0.},{0.,0.,0.},0.,0.} |
47 |
greg |
1.1 |
|
48 |
|
|
#define VIEWSTR "VIEW=" |
49 |
greg |
1.7 |
#define VIEWSTRL 5 |
50 |
greg |
2.7 |
|
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 |
schorsch |
2.10 |
extern void pix2loc(RREAL loc[2], RESOLU *rp, int px, int py); |
57 |
greg |
2.7 |
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 |
schorsch |
2.9 |
|
66 |
|
|
#ifdef __cplusplus |
67 |
|
|
} |
68 |
greg |
2.7 |
#endif |
69 |
schorsch |
2.9 |
#endif /* _RAD_VIEW_H_ */ |
70 |
|
|
|