41 |
|
char *kfullfn = "klems_full.cal"; |
42 |
|
char *khalffn = "klems_half.cal"; |
43 |
|
char *kquarterfn = "klems_quarter.cal"; |
44 |
+ |
char *ciefn = "cieskyscan.cal"; |
45 |
|
|
46 |
|
/* string indicating parameters */ |
47 |
|
const char PARAMSTART[] = "@rfluxmtx"; |
500 |
|
calfn = kquarterfn; kquarterfn = NULL; |
501 |
|
binf = "kqbin"; |
502 |
|
nbins = "Nkqbins"; |
503 |
+ |
} else if (!strcasecmp(curparams.hemis, "cie")) { |
504 |
+ |
calfn = ciefn; ciefn = NULL; |
505 |
+ |
sprintf(sbuf, "rNx=%g,rNy=%g,rNz=%g,Ux=%g,Uy=%g,Uz=%g,RHS=%c1", |
506 |
+ |
curparams.nrm[0], curparams.nrm[1], curparams.nrm[2], |
507 |
+ |
curparams.vup[0], curparams.vup[1], curparams.vup[2], |
508 |
+ |
curparams.sign); |
509 |
+ |
binv = "cbin"; |
510 |
+ |
nbins = "Ncbins"; |
511 |
|
} else { |
512 |
|
fprintf(stderr, "%s: unrecognized hemisphere sampling: h=%s\n", |
513 |
|
progname, curparams.hemis); |
517 |
|
sprintf(sbuf, "RHS=%c1", curparams.sign); |
518 |
|
params = savqstr(sbuf); |
519 |
|
} |
520 |
< |
if (!uniform & (curparams.slist->styp == ST_SOURCE)) { |
520 |
> |
if (!uniform) { |
521 |
|
SURF *sp; |
522 |
|
for (sp = curparams.slist; sp != NULL; sp = sp->next) |
523 |
< |
if (fabs(sp->area - PI) > 1e-3) { |
523 |
> |
if (sp->styp == ST_SOURCE && fabs(sp->area - PI) > 1e-3) { |
524 |
|
fprintf(stderr, "%s: source '%s' must be 180-degrees\n", |
525 |
|
progname, sp->sname); |
526 |
|
exit(1); |
749 |
|
{ |
750 |
|
int n = sampcnt; |
751 |
|
double samp3[3]; |
752 |
< |
double duvw[3]; |
744 |
< |
FVECT orig_dir[2]; |
752 |
> |
FVECT duvw, orig_dir[2]; |
753 |
|
int i; |
754 |
|
|
755 |
|
if (fp == NULL) /* just requesting number of bins? */ |
757 |
|
|
758 |
|
while (n--) { /* stratified hemisphere sampling */ |
759 |
|
SDmultiSamp(samp3, 3, (n+frandom())/sampcnt); |
760 |
< |
SDsquare2disk(duvw, samp3[1], samp3[2]); |
760 |
> |
square2disk(duvw, samp3[1], samp3[2]); |
761 |
|
duvw[2] = -sqrt(1. - duvw[0]*duvw[0] - duvw[1]*duvw[1]); |
762 |
|
for (i = 3; i--; ) |
763 |
|
orig_dir[1][i] = duvw[0]*p->udir[i] + |
777 |
|
{ |
778 |
|
int n = sampcnt; |
779 |
|
double samp3[3]; |
780 |
< |
double duvw[3]; |
773 |
< |
FVECT orig_dir[2]; |
780 |
> |
FVECT duvw, orig_dir[2]; |
781 |
|
int i; |
782 |
|
|
783 |
|
if (fp == NULL) /* just requesting number of bins? */ |
785 |
|
|
786 |
|
while (n--) { /* stratified sampling */ |
787 |
|
SDmultiSamp(samp3, 3, (n+frandom())/sampcnt); |
788 |
< |
SDsquare2disk(duvw, (b/p->hsiz + samp3[1])/curparams.hsiz, |
788 |
> |
square2disk(duvw, (b/p->hsiz + samp3[1])/curparams.hsiz, |
789 |
|
(b%p->hsiz + samp3[2])/curparams.hsiz); |
790 |
|
duvw[2] = sqrt(1. - duvw[0]*duvw[0] - duvw[1]*duvw[1]); |
791 |
|
for (i = 3; i--; ) |
1104 |
|
} |
1105 |
|
/* is it a new receiver? */ |
1106 |
|
if ((st = surf_type(otype)) != ST_NONE) { |
1100 |
– |
if (curparams.slist != NULL && (st == ST_SOURCE) ^ |
1101 |
– |
(curparams.slist->styp == ST_SOURCE)) { |
1102 |
– |
fputs(progname, stderr); |
1103 |
– |
fputs(": cannot mix source/non-source receivers!\n", stderr); |
1104 |
– |
return(-1); |
1105 |
– |
} |
1107 |
|
if (strcmp(thismod, curmod)) { |
1108 |
|
if (curmod[0]) { /* output last receiver? */ |
1109 |
|
finish_receiver(); |
1286 |
|
yrs = argv[++a]; |
1287 |
|
na = 0; |
1288 |
|
continue; |
1289 |
< |
case 'c': /* number of samples */ |
1290 |
< |
sampcnt = atoi(argv[++a]); |
1291 |
< |
if (sampcnt <= 0) |
1292 |
< |
goto userr; |
1293 |
< |
na = 0; /* we re-add this later */ |
1294 |
< |
continue; |
1289 |
> |
case 'c': /* spectral sampling or count */ |
1290 |
> |
switch (argv[a][2]) { |
1291 |
> |
case 's': |
1292 |
> |
na = 2; |
1293 |
> |
break; |
1294 |
> |
case 'w': |
1295 |
> |
na = 3; |
1296 |
> |
break; |
1297 |
> |
case '\0': |
1298 |
> |
sampcnt = atoi(argv[++a]); |
1299 |
> |
if (sampcnt <= 0) |
1300 |
> |
goto userr; |
1301 |
> |
na = 0; /* we re-add this later */ |
1302 |
> |
continue; |
1303 |
> |
} |
1304 |
> |
break; |
1305 |
|
case 'I': /* only for pass-through mode */ |
1306 |
|
case 'i': |
1307 |
|
iropt = argv[a]; |
1319 |
|
case 'n': /* options with 1 argument */ |
1320 |
|
case 's': |
1321 |
|
case 'o': |
1322 |
+ |
case 't': |
1323 |
|
na = 2; |
1324 |
|
break; |
1325 |
|
case 'b': /* special case */ |