| 49 |
|
memerr("view span brightness buffer"); |
| 50 |
|
for (v = vsize; v >= -vsize; v--) { |
| 51 |
|
close_sources(v); |
| 52 |
+ |
#ifndef DEBUG |
| 53 |
+ |
if (verbose) |
| 54 |
+ |
fprintf(stderr, "%s: analyzing... %3ld%%\r", |
| 55 |
+ |
progname, 100L*(vsize-v)/(2*vsize)); |
| 56 |
+ |
#endif |
| 57 |
|
getviewspan(v, spanbr); |
| 58 |
|
left = hsize + 1; |
| 59 |
|
for (h = -hsize; h <= hsize; h++) { |
| 80 |
|
} |
| 81 |
|
free((char *)spanbr); |
| 82 |
|
close_allsrcs(); |
| 78 |
– |
absorb_specks(); |
| 83 |
|
} |
| 84 |
|
|
| 85 |
|
|
| 91 |
|
register int i; |
| 92 |
|
|
| 93 |
|
if (h <= -hlim) { /* left region */ |
| 94 |
< |
d = (double)(h+hlim)/sampdens; |
| 95 |
< |
if (d <= -1.0+FTINY) |
| 94 |
> |
d = (double)(-h-hlim)/sampdens; |
| 95 |
> |
if (d >= 1.0-FTINY) |
| 96 |
|
return; |
| 97 |
|
tanb = d/sqrt(1.0-d*d); |
| 98 |
|
for (i = 0; i < nglardirs; i++) { |
| 99 |
|
d = indirect[i].lcos - tanb*indirect[i].lsin; |
| 100 |
|
if (d > 0.0) { |
| 101 |
|
indirect[i].sum += d * br; |
| 102 |
< |
indirect[i].n++; |
| 102 |
> |
indirect[i].n += d; |
| 103 |
|
} |
| 104 |
|
} |
| 105 |
|
return; |
| 106 |
|
} |
| 107 |
|
if (h >= hlim) { /* right region */ |
| 108 |
< |
d = (double)(h-hlim)/sampdens; |
| 109 |
< |
if (d >= 1.0-FTINY) |
| 108 |
> |
d = (double)(-h+hlim)/sampdens; |
| 109 |
> |
if (d <= -1.0+FTINY) |
| 110 |
|
return; |
| 111 |
|
tanb = d/sqrt(1.0-d*d); |
| 112 |
|
for (i = 0; i < nglardirs; i++) { |
| 113 |
|
d = indirect[i].rcos - tanb*indirect[i].rsin; |
| 114 |
|
if (d > 0.0) { |
| 115 |
|
indirect[i].sum += d * br; |
| 116 |
< |
indirect[i].n++; |
| 116 |
> |
indirect[i].n += d; |
| 117 |
|
} |
| 118 |
|
} |
| 119 |
|
return; |
| 123 |
|
d = cos(h_theta(h) - indirect[i].theta); |
| 124 |
|
if (d > 0.0) { |
| 125 |
|
indirect[i].sum += d * br; |
| 126 |
< |
indirect[i].n++; |
| 126 |
> |
indirect[i].n += d; |
| 127 |
|
} |
| 128 |
|
} |
| 129 |
|
} |
| 157 |
|
exit(1); |
| 158 |
|
} |
| 159 |
|
if (verbose) { |
| 160 |
+ |
#ifdef DEBUG |
| 161 |
|
pict_stats(); |
| 162 |
+ |
#endif |
| 163 |
|
fprintf(stderr, |
| 164 |
|
"%s: threshold set to %f cd/m2 from %d samples\n", |
| 165 |
|
progname, threshold, nsamps); |
| 339 |
|
fprintf(stderr, "%s: absorbing small sources...\n", progname); |
| 340 |
|
head.next = donelist; |
| 341 |
|
last = &head; |
| 342 |
< |
for (this = donelist; this != NULL; this = this->next) |
| 342 |
> |
for (this = head.next; this != NULL; this = this->next) |
| 343 |
|
if (TOOSMALL(this)) { |
| 344 |
|
last->next = this->next; |
| 345 |
< |
buddy = findbuddy(this, donelist); |
| 345 |
> |
buddy = findbuddy(this, head.next); |
| 346 |
|
if (buddy != NULL) |
| 347 |
|
mergesource(buddy, this); |
| 348 |
|
else |
| 358 |
|
register struct source *s; |
| 359 |
|
{ |
| 360 |
|
FVECT dir; |
| 361 |
< |
register int i, n; |
| 361 |
> |
double d; |
| 362 |
> |
register int i; |
| 363 |
|
|
| 364 |
|
for (i = 0; i < nglardirs; i++) { |
| 365 |
|
spinvector(dir, ourview.vdir, ourview.vup, indirect[i].theta); |
| 366 |
< |
n = DOT(dir,s->dir)*s->dom*(sampdens*sampdens) + 0.5; |
| 367 |
< |
if (n == 0) |
| 366 |
> |
d = DOT(dir,s->dir)*s->dom*(sampdens*sampdens); |
| 367 |
> |
if (d <= 0.0) |
| 368 |
|
continue; |
| 369 |
< |
indirect[i].sum += n * s->brt; |
| 370 |
< |
indirect[i].n += n; |
| 369 |
> |
indirect[i].sum += d * s->brt; |
| 370 |
> |
indirect[i].n += d; |
| 371 |
|
} |
| 372 |
|
for ( ; s->first != NULL; s->first = s->first->next) |
| 373 |
|
free((char *)s->first); |