1 |
/* Copyright (c) 1991 Regents of the University of California */ |
2 |
|
3 |
/* SCCSid "$SunId$ LBL" */ |
4 |
|
5 |
/* |
6 |
* Common data structures for glare source finding routines |
7 |
*/ |
8 |
|
9 |
#include "standard.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. */ |
15 |
|
16 |
#define SAMPDENS 50 /* samples per unit in image */ |
17 |
#define TSAMPSTEP 10 /* sample step to compute threshold */ |
18 |
|
19 |
#define SEPS 2 /* sources this close ==> contig. */ |
20 |
|
21 |
extern VIEW ourview; /* our view */ |
22 |
extern VIEW pictview; /* picture view */ |
23 |
extern VIEW leftview, rightview; /* leftmost and rightmost views */ |
24 |
|
25 |
extern int verbose; /* verbose reporting */ |
26 |
extern char *progname; /* global argv[0] */ |
27 |
|
28 |
extern ANGLE glarang[]; /* glare calculation angles */ |
29 |
extern int nglarangs; |
30 |
extern double maxtheta; /* maximum glare angle (in radians) */ |
31 |
extern int hsize; /* horizontal size */ |
32 |
extern int hlim; /* horizontal limit of central view */ |
33 |
|
34 |
#define nglardirs (2*nglarangs+1) |
35 |
#define vsize SAMPDENS |
36 |
#define h_theta(h) ((double)(h)/(double)SAMPDENS) |
37 |
|
38 |
extern struct illum { |
39 |
float theta; /* glare direction */ |
40 |
float lcos, lsin; /* cosine and sine to left view */ |
41 |
float rcos, rsin; /* cosine and sine to right view */ |
42 |
double sum; /* sum of indirect luminances */ |
43 |
int n; /* number of values in sum */ |
44 |
} *indirect; /* array of indirect illuminances */ |
45 |
|
46 |
struct srcspan { |
47 |
short v; /* vertical position */ |
48 |
short l, r; /* left and right horizontal limits */ |
49 |
float brsum; /* sum of brightnesses for this span */ |
50 |
struct srcspan *next; /* next source span in list */ |
51 |
}; |
52 |
|
53 |
extern struct source { |
54 |
FVECT dir; /* source direction */ |
55 |
float dom; /* solid angle of source */ |
56 |
float brt; /* average source brightness */ |
57 |
struct srcspan *first; /* first span for this source */ |
58 |
struct source *next; /* next source in list */ |
59 |
} *donelist; /* finished sources */ |
60 |
|
61 |
extern double getviewpix(); |