| 14 |
|
#include <math.h> |
| 15 |
|
#include "platform.h" |
| 16 |
|
#include "bsdfrep.h" |
| 17 |
+ |
#include "resolu.h" |
| 18 |
|
/* global argv[0] */ |
| 19 |
|
char *progname; |
| 20 |
|
|
| 25 |
|
long dstart; /* data start offset in file */ |
| 26 |
|
} PGINPUT; |
| 27 |
|
|
| 28 |
+ |
double angle_eps = 0; /* epsilon for angle comparisons */ |
| 29 |
+ |
|
| 30 |
|
PGINPUT *inpfile; /* input files sorted by incidence */ |
| 31 |
|
int ninpfiles; /* number of input files */ |
| 32 |
|
|
| 37 |
|
const PGINPUT *inp1 = (const PGINPUT *)p1; |
| 38 |
|
const PGINPUT *inp2 = (const PGINPUT *)p2; |
| 39 |
|
|
| 40 |
< |
if (inp1->theta > inp2->theta+FTINY) |
| 40 |
> |
if (inp1->theta > inp2->theta+angle_eps) |
| 41 |
|
return(1); |
| 42 |
< |
if (inp1->theta < inp2->theta-FTINY) |
| 42 |
> |
if (inp1->theta < inp2->theta-angle_eps) |
| 43 |
|
return(-1); |
| 44 |
< |
if (inp1->phi > inp2->phi+FTINY) |
| 44 |
> |
if (inp1->phi > inp2->phi+angle_eps) |
| 45 |
|
return(1); |
| 46 |
< |
if (inp1->phi < inp2->phi-FTINY) |
| 46 |
> |
if (inp1->phi < inp2->phi-angle_eps) |
| 47 |
|
return(-1); |
| 48 |
|
return(0); |
| 49 |
|
} |
| 124 |
|
return(0); |
| 125 |
|
} |
| 126 |
|
/* prepare input grid */ |
| 127 |
+ |
angle_eps = 180./2./GRIDRES; |
| 128 |
|
if (!i || cmp_inang(&inpfile[i-1], &inpfile[i])) { |
| 129 |
|
if (i) /* need to process previous incidence */ |
| 130 |
|
make_rbfrep(); |
| 184 |
|
for (i = 0; i < ninpfiles; i++) |
| 185 |
|
if (!init_pabopto_inp(i, argv[i+1])) |
| 186 |
|
return(1); |
| 187 |
+ |
angle_eps = 0; |
| 188 |
|
qsort(inpfile, ninpfiles, sizeof(PGINPUT), &cmp_inang); |
| 189 |
|
/* compile measurements */ |
| 190 |
|
for (i = 0; i < ninpfiles; i++) |
| 230 |
|
n = 0; |
| 231 |
|
for (i = 0; i < GRIDRES; i++) |
| 232 |
|
for (j = 0; j < GRIDRES; j++) |
| 233 |
< |
if (dsf_grid[i][j].nval > 0) { |
| 233 |
> |
if (dsf_grid[i][j].sum.n > 0) { |
| 234 |
|
ovec_from_pos(dir, i, j); |
| 235 |
< |
bsdf = dsf_grid[i][j].vsum / |
| 236 |
< |
(dsf_grid[i][j].nval*output_orient*dir[2]); |
| 235 |
> |
bsdf = dsf_grid[i][j].sum.v / |
| 236 |
> |
(dsf_grid[i][j].sum.n*output_orient*dir[2]); |
| 237 |
|
if (bsdf <= bsdf_min*.6) |
| 238 |
|
continue; |
| 239 |
|
bsdf = log(bsdf + 1e-5) - min_log; |