740 |
|
{ |
741 |
|
int n = sampcnt; |
742 |
|
double samp3[3]; |
743 |
< |
double duvw[3]; |
744 |
< |
FVECT orig_dir[2]; |
743 |
> |
FVECT duvw, orig_dir[2]; |
744 |
|
int i; |
745 |
|
|
746 |
|
if (fp == NULL) /* just requesting number of bins? */ |
748 |
|
|
749 |
|
while (n--) { /* stratified hemisphere sampling */ |
750 |
|
SDmultiSamp(samp3, 3, (n+frandom())/sampcnt); |
751 |
< |
SDsquare2disk(duvw, samp3[1], samp3[2]); |
751 |
> |
square2disk(duvw, samp3[1], samp3[2]); |
752 |
|
duvw[2] = -sqrt(1. - duvw[0]*duvw[0] - duvw[1]*duvw[1]); |
753 |
|
for (i = 3; i--; ) |
754 |
|
orig_dir[1][i] = duvw[0]*p->udir[i] + |
768 |
|
{ |
769 |
|
int n = sampcnt; |
770 |
|
double samp3[3]; |
771 |
< |
double duvw[3]; |
773 |
< |
FVECT orig_dir[2]; |
771 |
> |
FVECT duvw, orig_dir[2]; |
772 |
|
int i; |
773 |
|
|
774 |
|
if (fp == NULL) /* just requesting number of bins? */ |
776 |
|
|
777 |
|
while (n--) { /* stratified sampling */ |
778 |
|
SDmultiSamp(samp3, 3, (n+frandom())/sampcnt); |
779 |
< |
SDsquare2disk(duvw, (b/p->hsiz + samp3[1])/curparams.hsiz, |
779 |
> |
square2disk(duvw, (b/p->hsiz + samp3[1])/curparams.hsiz, |
780 |
|
(b%p->hsiz + samp3[2])/curparams.hsiz); |
781 |
|
duvw[2] = sqrt(1. - duvw[0]*duvw[0] - duvw[1]*duvw[1]); |
782 |
|
for (i = 3; i--; ) |
1283 |
|
yrs = argv[++a]; |
1284 |
|
na = 0; |
1285 |
|
continue; |
1286 |
< |
case 'c': /* number of samples */ |
1287 |
< |
sampcnt = atoi(argv[++a]); |
1288 |
< |
if (sampcnt <= 0) |
1289 |
< |
goto userr; |
1290 |
< |
na = 0; /* we re-add this later */ |
1286 |
> |
case 'c': /* spectral sampling or count */ |
1287 |
> |
switch (argv[a][2]) { |
1288 |
> |
case 's': |
1289 |
> |
na = 2; |
1290 |
> |
break; |
1291 |
> |
case 'w': |
1292 |
> |
na = 3; |
1293 |
> |
break; |
1294 |
> |
case '\0': |
1295 |
> |
sampcnt = atoi(argv[++a]); |
1296 |
> |
if (sampcnt <= 0) |
1297 |
> |
goto userr; |
1298 |
> |
na = 0; /* we re-add this later */ |
1299 |
> |
break; |
1300 |
> |
} |
1301 |
|
continue; |
1302 |
|
case 'I': /* only for pass-through mode */ |
1303 |
|
case 'i': |