| 14 |
|
#include "rtio.h" |
| 15 |
|
#include "resolu.h" |
| 16 |
|
#include "bsdfrep.h" |
| 17 |
+ |
/* name and manufacturer if known */ |
| 18 |
+ |
char bsdf_name[256]; |
| 19 |
+ |
char bsdf_manuf[256]; |
| 20 |
|
/* active grid resolution */ |
| 21 |
|
int grid_res = GRIDRES; |
| 22 |
|
|
| 261 |
|
double |
| 262 |
|
eval_rbfrep(const RBFNODE *rp, const FVECT outvec) |
| 263 |
|
{ |
| 264 |
+ |
const double rfact2 = (38./M_PI/M_PI)*(grid_res*grid_res); |
| 265 |
|
double minval = bsdf_min*output_orient*outvec[2]; |
| 266 |
|
int pos[2]; |
| 267 |
|
double res = 0; |
| 284 |
|
(pos[1]-rbfp->gy)*(pos[1]-rbfp->gy); |
| 285 |
|
rad2 = R2ANG(rbfp->crad); |
| 286 |
|
rad2 *= rad2; |
| 287 |
< |
if (d2 > (38.*GRIDRES*GRIDRES/M_PI/M_PI)*rad2) |
| 287 |
> |
if (d2 > rad2*rfact2) |
| 288 |
|
continue; |
| 289 |
|
ovec_from_pos(odir, rbfp->gx, rbfp->gy); |
| 290 |
|
res += rbfp->peak * exp((DOT(odir,outvec) - 1.) / rad2); |
| 407 |
|
dsf_list = rbf->next; |
| 408 |
|
free(rbf); |
| 409 |
|
} |
| 410 |
+ |
bsdf_name[0] = '\0'; |
| 411 |
+ |
bsdf_manuf[0] = '\0'; |
| 412 |
|
inp_coverage = 0; |
| 413 |
|
single_plane_incident = -1; |
| 414 |
|
input_orient = output_orient = 0; |
| 423 |
|
MIGRATION *mig; |
| 424 |
|
int i, n; |
| 425 |
|
/* finish header */ |
| 426 |
+ |
if (bsdf_name[0]) |
| 427 |
+ |
fprintf(ofp, "NAME=%s\n", bsdf_name); |
| 428 |
+ |
if (bsdf_manuf[0]) |
| 429 |
+ |
fprintf(ofp, "MANUFACT=%s\n", bsdf_manuf); |
| 430 |
|
fprintf(ofp, "SYMMETRY=%d\n", !single_plane_incident * inp_coverage); |
| 431 |
|
fprintf(ofp, "IO_SIDES= %d %d\n", input_orient, output_orient); |
| 432 |
|
fprintf(ofp, "GRIDRES=%d\n", grid_res); |
| 483 |
|
{ |
| 484 |
|
char fmt[32]; |
| 485 |
|
|
| 486 |
+ |
if (!strncmp(s, "NAME=", 5)) { |
| 487 |
+ |
strcpy(bsdf_name, s+5); |
| 488 |
+ |
bsdf_name[strlen(bsdf_name)-1] = '\0'; |
| 489 |
+ |
} |
| 490 |
+ |
if (!strncmp(s, "MANUFACT=", 9)) { |
| 491 |
+ |
strcpy(bsdf_manuf, s+9); |
| 492 |
+ |
bsdf_manuf[strlen(bsdf_manuf)-1] = '\0'; |
| 493 |
+ |
} |
| 494 |
|
if (!strncmp(s, "SYMMETRY=", 9)) { |
| 495 |
|
inp_coverage = atoi(s+9); |
| 496 |
|
single_plane_incident = !inp_coverage; |
| 530 |
|
progname); |
| 531 |
|
return(0); |
| 532 |
|
} |
| 533 |
< |
rbfh.next = NULL; /* read each DSF */ |
| 516 |
< |
rbfh.ejl = NULL; |
| 533 |
> |
memset(&rbfh, 0, sizeof(rbfh)); /* read each DSF */ |
| 534 |
|
while ((rbfh.ord = getint(4, ifp)) >= 0) { |
| 535 |
|
RBFNODE *newrbf; |
| 536 |
|
|
| 547 |
|
sizeof(RBFVAL)*(rbfh.nrbf-1)); |
| 548 |
|
if (newrbf == NULL) |
| 549 |
|
goto memerr; |
| 550 |
< |
memcpy(newrbf, &rbfh, sizeof(RBFNODE)-sizeof(RBFVAL)); |
| 550 |
> |
*newrbf = rbfh; |
| 551 |
|
for (i = 0; i < rbfh.nrbf; i++) { |
| 552 |
|
newrbf->rbfa[i].peak = getflt(ifp); |
| 553 |
|
newrbf->rbfa[i].crad = getint(2, ifp) & 0xffff; |