Back to index

radiance  4R0+20100331
glare.h
Go to the documentation of this file.
00001 /* RCSid: $Id: glare.h,v 2.7 2008/05/01 16:42:06 greg Exp $ */
00002 /*
00003  * Common data structures for glare source finding routines
00004  */
00005 #ifndef _RAD_GLARE_H_
00006 #define _RAD_GLARE_H_
00007 
00008 #include "standard.h"
00009 #include "view.h"
00010 #include "color.h"
00011 #include "setscan.h"
00012 
00013 #ifdef __cplusplus
00014 extern "C" {
00015 #endif
00016 
00017 #define GLAREBR             7.0           /* glare source is this * avg. lum. */
00018 
00019 #define SAMPDENS     75            /* default samples per unit in image */
00020 #define TSAMPSTEP    10            /* sample step to compute threshold */
00021 
00022 #define SEPS         1             /* sources this close ==> contig. */
00023 
00024 #define SAMIN        .005          /* minimum solid angle for source */
00025 #define MAXBUDDY     (4.*sqrt(SAMIN/PI))  /* max separation for pairing */
00026 
00027 #define TOOSMALL(s)  ((s)->brt*(s)->dom < threshold*SAMIN)
00028 
00029 #define SABIG        .025          /* solid angle of splittable source */
00030 #define LCORR        .12           /* linearity of splittable source */
00031 
00032 extern VIEW   ourview;             /* our view */
00033 extern VIEW   pictview;            /* picture view */
00034 extern VIEW   leftview, rightview; /* leftmost and rightmost views */
00035 
00036 extern int    verbose;             /* verbose reporting */
00037 extern char   *progname;           /* global argv[0] */
00038 
00039 extern double threshold;           /* threshold value for glare sources */
00040 
00041 extern int    sampdens;            /* sample density */
00042 extern ANGLE  glarang[];           /* glare calculation angles */
00043 extern int    nglarangs;
00044 extern double maxtheta;            /* maximum glare angle (in radians) */
00045 extern int    hsize;               /* horizontal size */
00046 
00047 #define nglardirs    (2*nglarangs+1)
00048 #define vsize        (sampdens-1)
00049 #define hscale(v)    sqrt((double)(sampdens*sampdens - (v)*(v)))
00050 #define hlim(v)             (int)(maxtheta*hscale(v))
00051 #define h_theta(h,v) (-(h)/hscale(v))
00052 
00053 extern struct illum {
00054        float  theta;        /* glare direction */
00055        float  lcos, lsin;   /* cosine and sine to left view */
00056        float  rcos, rsin;   /* cosine and sine to right view */
00057        double sum;          /* sum of indirect luminances */
00058        double n;            /* number of values in sum */
00059 } *indirect;         /* array of indirect illuminances */
00060 
00061 struct srcspan {
00062        short  v;            /* vertical position */
00063        short  l, r;         /* left and right horizontal limits */
00064        float  brsum;        /* sum of brightnesses for this span */
00065        struct srcspan       *next; /* next source span in list */
00066 };
00067 
00068 extern struct source {
00069        FVECT  dir;          /* source direction */
00070        double dom;          /* solid angle of source */
00071        double brt;          /* average source brightness */
00072        struct srcspan       *first;       /* first span for this source */
00073        struct source *next; /* next source in list */
00074 } *donelist;                /* finished sources */
00075 
00076 
00077 extern long   npixinvw;     /* number of samples in view */
00078 extern long   npixmiss;     /* number of samples missing */
00079 
00080        /* defined in findglare.c */
00081 extern void memerr(char     *s);
00082 extern int compdir(FVECT vd, int x, int y);
00083 extern double pixsize(int x, int y);
00084        /* defined in glaresrc.c */
00085 extern void comp_thresh(void);
00086 extern void analyze(void);
00087 extern void absorb_specks(void);
00088        /* defined in glareval.c */
00089 extern void open_pict(char *fn);
00090 extern void fork_rtrace(char *av[]);
00091 extern void close_pict(void);
00092 extern void done_rtrace(void);
00093 extern void getviewspan(int vv, float *vb);
00094 extern double getviewpix(int vh, int vv);
00095 
00096 #ifdef __cplusplus
00097 }
00098 #endif
00099 #endif /* _RAD_GLARE_H_ */
00100