53 |
|
/* current input direction */ |
54 |
|
double theta_in_deg, phi_in_deg; |
55 |
|
|
56 |
+ |
/* header line sharing callback */ |
57 |
+ |
int (*sir_headshare)(char *s) = NULL; |
58 |
+ |
|
59 |
|
/* Register new input direction */ |
60 |
|
int |
61 |
|
new_input_direction(double new_theta, double new_phi) |
478 |
|
double t, full_dist; |
479 |
|
/* get relative position */ |
480 |
|
t = Acos(DOT(invec, mig->rbfv[0]->invec)); |
481 |
< |
if (t < M_PI/grid_res) { /* near first DSF */ |
481 |
> |
if (t <= .001) { /* near first DSF */ |
482 |
|
n = sizeof(RBFNODE) + sizeof(RBFVAL)*(mig->rbfv[0]->nrbf-1); |
483 |
|
rbf = (RBFNODE *)malloc(n); |
484 |
|
if (rbf == NULL) |
488 |
|
return(rbf); |
489 |
|
} |
490 |
|
full_dist = acos(DOT(mig->rbfv[0]->invec, mig->rbfv[1]->invec)); |
491 |
< |
if (t > full_dist-M_PI/grid_res) { /* near second DSF */ |
491 |
> |
if (t >= full_dist-.001) { /* near second DSF */ |
492 |
|
n = sizeof(RBFNODE) + sizeof(RBFVAL)*(mig->rbfv[1]->nrbf-1); |
493 |
|
rbf = (RBFNODE *)malloc(n); |
494 |
|
if (rbf == NULL) |
664 |
|
char fmt[MAXFMTLEN]; |
665 |
|
int i; |
666 |
|
|
667 |
+ |
if (isheadid(s)) |
668 |
+ |
return(0); |
669 |
|
if (!strncmp(s, "NAME=", 5)) { |
670 |
|
strcpy(bsdf_name, s+5); |
671 |
|
bsdf_name[strlen(bsdf_name)-1] = '\0'; |
672 |
+ |
return(1); |
673 |
|
} |
674 |
|
if (!strncmp(s, "MANUFACT=", 9)) { |
675 |
|
strcpy(bsdf_manuf, s+9); |
676 |
|
bsdf_manuf[strlen(bsdf_manuf)-1] = '\0'; |
677 |
+ |
return(1); |
678 |
|
} |
679 |
|
if (!strncmp(s, "SYMMETRY=", 9)) { |
680 |
|
inp_coverage = atoi(s+9); |
681 |
|
single_plane_incident = !inp_coverage; |
682 |
< |
return(0); |
682 |
> |
return(1); |
683 |
|
} |
684 |
|
if (!strncmp(s, "IO_SIDES=", 9)) { |
685 |
|
sscanf(s+9, "%d %d", &input_orient, &output_orient); |
686 |
< |
return(0); |
686 |
> |
return(1); |
687 |
|
} |
688 |
|
if (!strncmp(s, "COLORIMETRY=", 12)) { |
689 |
|
fmt[0] = '\0'; |
694 |
|
if (i < 0) |
695 |
|
return(-1); |
696 |
|
rbf_colorimetry = i; |
697 |
< |
return(0); |
697 |
> |
return(1); |
698 |
|
} |
699 |
|
if (!strncmp(s, "GRIDRES=", 8)) { |
700 |
|
sscanf(s+8, "%d", &grid_res); |
701 |
< |
return(0); |
701 |
> |
return(1); |
702 |
|
} |
703 |
|
if (!strncmp(s, "BSDFMIN=", 8)) { |
704 |
|
sscanf(s+8, "%lf", &bsdf_min); |
705 |
< |
return(0); |
705 |
> |
return(1); |
706 |
|
} |
707 |
|
if (!strncmp(s, "BSDFSPEC=", 9)) { |
708 |
|
sscanf(s+9, "%lf %lf", &bsdf_spec_val, &bsdf_spec_rad); |
709 |
< |
return(0); |
709 |
> |
return(1); |
710 |
|
} |
711 |
< |
if (formatval(fmt, s) && strcmp(fmt, BSDFREP_FMT)) |
712 |
< |
return(-1); |
711 |
> |
if (formatval(fmt, s)) |
712 |
> |
return (strcmp(fmt, BSDFREP_FMT) ? -1 : 0); |
713 |
> |
if (sir_headshare != NULL) |
714 |
> |
return ((*sir_headshare)(s)); |
715 |
|
return(0); |
716 |
|
} |
717 |
|
|