| 1 |
< |
/* Copyright (c) 1991 Regents of the University of California */ |
| 2 |
< |
|
| 3 |
< |
/* SCCSid "$SunId$ LBL" */ |
| 4 |
< |
|
| 1 |
> |
/* RCSid: $Id$ */ |
| 2 |
|
/* |
| 3 |
|
* Common data structures for glare source finding routines |
| 4 |
|
*/ |
| 5 |
+ |
#ifndef _RAD_GLARE_H_ |
| 6 |
+ |
#define _RAD_GLARE_H_ |
| 7 |
|
|
| 8 |
|
#include "standard.h" |
| 9 |
+ |
#include "paths.h" |
| 10 |
|
#include "view.h" |
| 11 |
|
#include "color.h" |
| 12 |
|
#include "setscan.h" |
| 13 |
|
|
| 14 |
< |
#define GLAREBR 10.0 /* glare source is this * avg. lum. */ |
| 14 |
> |
#ifdef __cplusplus |
| 15 |
> |
extern "C" { |
| 16 |
> |
#endif |
| 17 |
|
|
| 18 |
< |
#define SAMPDENS 50 /* default samples per unit in image */ |
| 18 |
> |
#define GLAREBR 7.0 /* glare source is this * avg. lum. */ |
| 19 |
> |
|
| 20 |
> |
#define SAMPDENS 75 /* default samples per unit in image */ |
| 21 |
|
#define TSAMPSTEP 10 /* sample step to compute threshold */ |
| 22 |
|
|
| 23 |
< |
#define SEPS 2 /* sources this close ==> contig. */ |
| 23 |
> |
#define SEPS 1 /* sources this close ==> contig. */ |
| 24 |
|
|
| 25 |
+ |
#define SAMIN .005 /* minimum solid angle for source */ |
| 26 |
+ |
#define MAXBUDDY (4.*sqrt(SAMIN/PI)) /* max separation for pairing */ |
| 27 |
+ |
|
| 28 |
+ |
#define TOOSMALL(s) ((s)->brt*(s)->dom < threshold*SAMIN) |
| 29 |
+ |
|
| 30 |
+ |
#define SABIG .025 /* solid angle of splittable source */ |
| 31 |
+ |
#define LCORR .12 /* linearity of splittable source */ |
| 32 |
+ |
|
| 33 |
|
extern VIEW ourview; /* our view */ |
| 34 |
|
extern VIEW pictview; /* picture view */ |
| 35 |
|
extern VIEW leftview, rightview; /* leftmost and rightmost views */ |
| 37 |
|
extern int verbose; /* verbose reporting */ |
| 38 |
|
extern char *progname; /* global argv[0] */ |
| 39 |
|
|
| 40 |
+ |
extern double threshold; /* threshold value for glare sources */ |
| 41 |
+ |
|
| 42 |
|
extern int sampdens; /* sample density */ |
| 43 |
|
extern ANGLE glarang[]; /* glare calculation angles */ |
| 44 |
|
extern int nglarangs; |
| 45 |
|
extern double maxtheta; /* maximum glare angle (in radians) */ |
| 46 |
|
extern int hsize; /* horizontal size */ |
| 33 |
– |
extern int hlim; /* horizontal limit of central view */ |
| 47 |
|
|
| 48 |
|
#define nglardirs (2*nglarangs+1) |
| 49 |
< |
#define vsize sampdens |
| 50 |
< |
#define h_theta(h) (-(double)(h)/(double)sampdens) |
| 49 |
> |
#define vsize (sampdens-1) |
| 50 |
> |
#define hscale(v) sqrt((double)(sampdens*sampdens - (v)*(v))) |
| 51 |
> |
#define hlim(v) (int)(maxtheta*hscale(v)) |
| 52 |
> |
#define h_theta(h,v) (-(h)/hscale(v)) |
| 53 |
|
|
| 54 |
|
extern struct illum { |
| 55 |
|
float theta; /* glare direction */ |
| 56 |
|
float lcos, lsin; /* cosine and sine to left view */ |
| 57 |
|
float rcos, rsin; /* cosine and sine to right view */ |
| 58 |
|
double sum; /* sum of indirect luminances */ |
| 59 |
< |
int n; /* number of values in sum */ |
| 59 |
> |
double n; /* number of values in sum */ |
| 60 |
|
} *indirect; /* array of indirect illuminances */ |
| 61 |
|
|
| 62 |
|
struct srcspan { |
| 68 |
|
|
| 69 |
|
extern struct source { |
| 70 |
|
FVECT dir; /* source direction */ |
| 71 |
< |
float dom; /* solid angle of source */ |
| 72 |
< |
float brt; /* average source brightness */ |
| 71 |
> |
double dom; /* solid angle of source */ |
| 72 |
> |
double brt; /* average source brightness */ |
| 73 |
|
struct srcspan *first; /* first span for this source */ |
| 74 |
|
struct source *next; /* next source in list */ |
| 75 |
|
} *donelist; /* finished sources */ |
| 76 |
|
|
| 77 |
< |
extern double getviewpix(); |
| 77 |
> |
|
| 78 |
> |
extern long npixinvw; /* number of samples in view */ |
| 79 |
> |
extern long npixmiss; /* number of samples missing */ |
| 80 |
> |
|
| 81 |
> |
/* defined in findglare.c */ |
| 82 |
> |
extern void memerr(char *s); |
| 83 |
> |
extern int compdir(FVECT vd, int x, int y); |
| 84 |
> |
extern double pixsize(int x, int y); |
| 85 |
> |
/* defined in glaresrc.c */ |
| 86 |
> |
extern void comp_thresh(void); |
| 87 |
> |
extern void analyze(void); |
| 88 |
> |
extern void absorb_specks(void); |
| 89 |
> |
/* defined in glareval.c */ |
| 90 |
> |
extern void open_pict(char *fn); |
| 91 |
> |
extern void fork_rtrace(char *av[]); |
| 92 |
> |
extern void close_pict(void); |
| 93 |
> |
extern void done_rtrace(void); |
| 94 |
> |
extern void getviewspan(int vv, float *vb); |
| 95 |
> |
extern double getviewpix(int vh, int vv); |
| 96 |
> |
|
| 97 |
> |
#ifdef __cplusplus |
| 98 |
> |
} |
| 99 |
> |
#endif |
| 100 |
> |
#endif /* _RAD_GLARE_H_ */ |
| 101 |
> |
|