26 |
|
int input_orient = 0; |
27 |
|
int output_orient = 0; |
28 |
|
|
29 |
+ |
/* BSDF histogram */ |
30 |
+ |
int bsdf_hist[HISTLEN]; |
31 |
+ |
|
32 |
+ |
/* BSDF value for boundary regions */ |
33 |
+ |
double bsdf_min = 0; |
34 |
+ |
|
35 |
|
/* processed incident DSF measurements */ |
36 |
|
RBFNODE *dsf_list = NULL; |
37 |
|
|
247 |
|
double |
248 |
|
eval_rbfrep(const RBFNODE *rp, const FVECT outvec) |
249 |
|
{ |
250 |
+ |
double minval = bsdf_min*output_orient*outvec[2]; |
251 |
|
double res = 0; |
252 |
|
const RBFVAL *rbfp; |
253 |
|
FVECT odir; |
254 |
|
double sig2; |
255 |
|
int n; |
256 |
< |
|
257 |
< |
if (rp == NULL) |
258 |
< |
return(.0); |
256 |
> |
/* use minimum if no information avail. */ |
257 |
> |
if (rp == NULL) { |
258 |
> |
if (outvec[2] > 0 ^ output_orient > 0) |
259 |
> |
return(.0); |
260 |
> |
return(minval); |
261 |
> |
} |
262 |
|
rbfp = rp->rbfa; |
263 |
|
for (n = rp->nrbf; n--; rbfp++) { |
264 |
|
ovec_from_pos(odir, rbfp->gx, rbfp->gy); |
267 |
|
if (sig2 > -19.) |
268 |
|
res += rbfp->peak * exp(sig2); |
269 |
|
} |
270 |
+ |
if (res < minval) /* never return less than minval */ |
271 |
+ |
return(minval); |
272 |
|
return(res); |
273 |
|
} |
274 |
|
|
402 |
|
fprintf(ofp, "SYMMETRY=%d\n", !single_plane_incident * inp_coverage); |
403 |
|
fprintf(ofp, "IO_SIDES= %d %d\n", input_orient, output_orient); |
404 |
|
fprintf(ofp, "GRIDRES=%d\n", grid_res); |
405 |
+ |
fprintf(ofp, "BSDFMIN=%g\n", bsdf_min); |
406 |
|
fputformat(BSDFREP_FMT, ofp); |
407 |
|
fputc('\n', ofp); |
408 |
|
/* write each DSF */ |
466 |
|
} |
467 |
|
if (!strncmp(s, "GRIDRES=", 8)) { |
468 |
|
sscanf(s+8, "%d", &grid_res); |
469 |
+ |
return(0); |
470 |
+ |
} |
471 |
+ |
if (!strncmp(s, "BSDFMIN=", 8)) { |
472 |
+ |
sscanf(s+8, "%lf", &bsdf_min); |
473 |
|
return(0); |
474 |
|
} |
475 |
|
if (formatval(fmt, s) && strcmp(fmt, BSDFREP_FMT)) |