19 |
|
char *rtargv[32] = {"rtrace", "-h", "-ov", "-fff"}; |
20 |
|
int rtargc = 4; |
21 |
|
|
22 |
< |
VIEW ourview; /* our view */ |
22 |
> |
VIEW ourview = STDVIEW; /* our view */ |
23 |
|
VIEW pictview = STDVIEW; /* picture view */ |
24 |
|
VIEW leftview, rightview; /* leftmost and rightmost views */ |
25 |
|
|
29 |
|
int verbose = 0; /* verbose reporting */ |
30 |
|
char *progname; /* global argv[0] */ |
31 |
|
|
32 |
+ |
double threshold = 0.; /* glare threshold */ |
33 |
+ |
|
34 |
|
int sampdens = SAMPDENS; /* sample density */ |
35 |
|
ANGLE glarang[180] = {AEND}; /* glare calculation angles */ |
36 |
|
int nglarangs = 0; |
59 |
|
continue; |
60 |
|
} |
61 |
|
switch (argv[i][1]) { |
62 |
+ |
case 't': |
63 |
+ |
threshold = atof(argv[++i]); |
64 |
+ |
break; |
65 |
|
case 'r': |
66 |
|
sampdens = atoi(argv[++i])/2; |
67 |
|
break; |
173 |
|
exit(1); |
174 |
|
} |
175 |
|
init(); /* initialize program */ |
176 |
< |
comp_thresh(); /* compute glare threshold */ |
176 |
> |
if (threshold <= FTINY) |
177 |
> |
comp_thresh(); /* compute glare threshold */ |
178 |
|
analyze(); /* analyze view */ |
179 |
|
cleanup(); /* tidy up */ |
180 |
|
/* print header */ |
211 |
|
} |
212 |
|
nglarangs = i; |
213 |
|
/* nglardirs = 2*nglarangs + 1; */ |
214 |
< |
/* vsize = sampdens; */ |
214 |
> |
/* vsize = sampdens - 1; */ |
215 |
|
if (nglarangs > 0) |
216 |
|
maxtheta = (PI/180.)*glarang[nglarangs-1]; |
217 |
|
else |
218 |
|
maxtheta = 0.0; |
219 |
|
hlim = sampdens*maxtheta; |
220 |
< |
hsize = sampdens + hlim; |
220 |
> |
hsize = hlim + sampdens - 1; |
221 |
|
if (hsize > (int)(PI*sampdens)) |
222 |
|
hsize = PI*sampdens; |
223 |
|
indirect = (struct illum *)calloc(nglardirs, sizeof(struct illum)); |
301 |
|
} |
302 |
|
|
303 |
|
|
298 |
– |
spinvector(vres, vorig, vnorm, theta) /* rotate vector around normal */ |
299 |
– |
FVECT vres, vorig, vnorm; |
300 |
– |
double theta; |
301 |
– |
{ |
302 |
– |
extern double sin(), cos(); |
303 |
– |
double sint, cost, dotp; |
304 |
– |
FVECT vperp; |
305 |
– |
register int i; |
306 |
– |
|
307 |
– |
sint = sin(theta); |
308 |
– |
cost = cos(theta); |
309 |
– |
dotp = DOT(vorig, vnorm); |
310 |
– |
fcross(vperp, vnorm, vorig); |
311 |
– |
for (i = 0; i < 3; i++) |
312 |
– |
vres[i] = vnorm[i]*dotp*(1.-cost) + |
313 |
– |
vorig[i]*cost + vperp[i]*sint; |
314 |
– |
} |
315 |
– |
|
316 |
– |
|
304 |
|
memerr(s) /* malloc failure */ |
305 |
|
char *s; |
306 |
|
{ |
307 |
< |
fprintf(stderr, "%s: out of memory for %s\n", s); |
307 |
> |
fprintf(stderr, "%s: out of memory for %s\n", progname, s); |
308 |
|
exit(1); |
309 |
|
} |
310 |
|
|