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