| 34 |
|
|
| 35 |
|
/* BSDF value for boundary regions */ |
| 36 |
|
double bsdf_min = 0; |
| 37 |
< |
float bsdf_spec_peak = 0; |
| 38 |
< |
int bsdf_spec_crad = 0; |
| 37 |
> |
double bsdf_spec_peak = 0; |
| 38 |
> |
double bsdf_spec_rad = 0; |
| 39 |
|
|
| 40 |
|
/* processed incident DSF measurements */ |
| 41 |
|
RBFNODE *dsf_list = NULL; |
| 290 |
|
ovec_from_pos(odir, rbfp->gx, rbfp->gy); |
| 291 |
|
res += rbfp->peak * exp((DOT(odir,outvec) - 1.) / rad2); |
| 292 |
|
} |
| 293 |
< |
res /= output_orient*outvec[2]; |
| 293 |
> |
res /= COSF(outvec[2]); |
| 294 |
|
if (res < bsdf_min) /* never return less than bsdf_min */ |
| 295 |
|
return(bsdf_min); |
| 296 |
|
return(res); |
| 406 |
|
|
| 407 |
|
if (input_orient > 0 ^ invec[2] > 0) /* wrong side? */ |
| 408 |
|
return(NULL); |
| 409 |
< |
if ((bsdf_spec_peak <= bsdf_min) | (bsdf_spec_crad <= 0)) |
| 409 |
> |
if ((bsdf_spec_peak <= bsdf_min) | (bsdf_spec_rad <= 0)) |
| 410 |
|
return(NULL); /* nothing set */ |
| 411 |
|
rbf = (RBFNODE *)malloc(sizeof(RBFNODE)); |
| 412 |
|
if (rbf == NULL) |
| 421 |
|
VCOPY(rbf->invec, invec); |
| 422 |
|
rbf->nrbf = 1; |
| 423 |
|
rbf->rbfa[0].peak = bsdf_spec_peak * output_orient*ovec[2]; |
| 424 |
< |
rbf->rbfa[0].crad = bsdf_spec_crad; |
| 424 |
> |
rbf->rbfa[0].crad = ANG2R(bsdf_spec_rad); |
| 425 |
|
rbf->rbfa[0].gx = pos[0]; |
| 426 |
|
rbf->rbfa[0].gy = pos[1]; |
| 427 |
|
rbf->vtotal = rbf_volume(rbf->rbfa); |
| 536 |
|
grid_res = GRIDRES; |
| 537 |
|
bsdf_min = 0; |
| 538 |
|
bsdf_spec_peak = 0; |
| 539 |
< |
bsdf_spec_crad = 0; |
| 539 |
> |
bsdf_spec_rad = 0; |
| 540 |
|
} |
| 541 |
|
|
| 542 |
|
/* Write our BSDF mesh interpolant out to the given binary stream */ |
| 555 |
|
fprintf(ofp, "IO_SIDES= %d %d\n", input_orient, output_orient); |
| 556 |
|
fprintf(ofp, "GRIDRES=%d\n", grid_res); |
| 557 |
|
fprintf(ofp, "BSDFMIN=%g\n", bsdf_min); |
| 558 |
< |
if ((bsdf_spec_peak > bsdf_min) & (bsdf_spec_crad > 0)) |
| 559 |
< |
fprintf(ofp, "BSDFSPEC= %f %f\n", bsdf_spec_peak, |
| 560 |
< |
R2ANG(bsdf_spec_crad)); |
| 558 |
> |
if ((bsdf_spec_peak > bsdf_min) & (bsdf_spec_rad > 0)) |
| 559 |
> |
fprintf(ofp, "BSDFSPEC= %f %f\n", bsdf_spec_peak, bsdf_spec_rad); |
| 560 |
|
fputformat(BSDFREP_FMT, ofp); |
| 561 |
|
fputc('\n', ofp); |
| 562 |
|
/* write each DSF */ |
| 635 |
|
return(0); |
| 636 |
|
} |
| 637 |
|
if (!strncmp(s, "BSDFSPEC=", 9)) { |
| 638 |
< |
float bsdf_spec_rad = 0; |
| 640 |
< |
sscanf(s+9, "%f %f", &bsdf_spec_peak, &bsdf_spec_rad); |
| 641 |
< |
bsdf_spec_crad = ANG2R(bsdf_spec_rad); |
| 638 |
> |
sscanf(s+9, "%lf %lf", &bsdf_spec_peak, &bsdf_spec_rad); |
| 639 |
|
return(0); |
| 640 |
|
} |
| 641 |
|
if (formatval(fmt, s) && strcmp(fmt, BSDFREP_FMT)) |