Back to index

radiance  4R0+20100331
view.h
Go to the documentation of this file.
00001 /* RCSid $Id: view.h,v 2.18 2008/03/11 02:21:46 greg Exp $ */
00002 /*
00003  *  view.h - header file for image generation.
00004  *
00005  *  Include after stdio.h and rtmath.h
00006  *  Includes resolu.h
00007  */
00008 #ifndef _RAD_VIEW_H_
00009 #define _RAD_VIEW_H_
00010 
00011 #include  "resolu.h"
00012 
00013 #ifdef __cplusplus
00014 extern "C" {
00015 #endif
00016 
00017                             /* view types */
00018 #define  VT_PER             'v'           /* perspective */
00019 #define  VT_PAR             'l'           /* parallel */
00020 #define  VT_ANG             'a'           /* angular fisheye */
00021 #define  VT_HEM             'h'           /* hemispherical fisheye */
00022 #define  VT_PLS             's'           /* planispheric fisheye */
00023 #define  VT_CYL             'c'           /* cylindrical panorama */
00024 
00025 typedef struct {
00026        int  type;           /* view type */
00027        FVECT  vp;           /* view origin */
00028        FVECT  vdir;         /* view direction */
00029        FVECT  vup;          /* view up */
00030        double  vdist;              /* view distance */
00031        double  horiz;              /* horizontal view size */
00032        double  vert;        /* vertical view size */
00033        double  hoff;        /* horizontal image offset */
00034        double  voff;        /* vertical image offset */
00035        double  vfore;              /* fore clipping plane */
00036        double  vaft;        /* aft clipping plane (<=0 for inf) */
00037        FVECT  hvec;         /* computed horizontal image vector */
00038        FVECT  vvec;         /* computed vertical image vector */
00039        double  hn2;         /* DOT(hvec,hvec) */
00040        double  vn2;         /* DOT(vvec,vvec) */
00041 } VIEW;                     /* view parameters */
00042 
00043 extern VIEW  stdview;
00044 
00045 #define  viewaspect(v)      sqrt((v)->vn2/(v)->hn2)
00046 
00047 #define  STDVIEW     {VT_PER,{0.,0.,0.},{0.,1.,0.},{0.,0.,1.}, \
00048                             1.,45.,45.,0.,0.,0.,0., \
00049                             {0.,0.,0.},{0.,0.,0.},0.,0.}
00050 
00051 #define  VIEWSTR     "VIEW="
00052 #define  VIEWSTRL    5
00053 
00054 
00055 extern char   *setview(VIEW *v);
00056 extern void   normaspect(double va, double *ap, int *xp, int *yp);
00057 extern double viewray(FVECT orig, FVECT direc, VIEW *v, double x, double y);
00058 extern void   viewloc(FVECT ip, VIEW *v, FVECT p);
00059 extern void   pix2loc(RREAL loc[2], RESOLU *rp, int px, int py);
00060 extern void   loc2pix(int pp[2], RESOLU *rp, double lx, double ly);
00061 extern int    getviewopt(VIEW *v, int ac, char *av[]);
00062 extern int    sscanview(VIEW *vp, char *s);
00063 extern void   fprintview(VIEW *vp, FILE *fp);
00064 extern char   *viewopt(VIEW *vp);
00065 extern int    isview(char *s);
00066 extern int    viewfile(char *fname, VIEW *vp, RESOLU *rp);
00067 
00068 
00069 #ifdef __cplusplus
00070 }
00071 #endif
00072 #endif /* _RAD_VIEW_H_ */
00073