--- ray/src/util/rfluxmtx.c 2020/09/07 04:06:17 2.52 +++ ray/src/util/rfluxmtx.c 2023/11/15 18:02:53 2.55 @@ -1,5 +1,5 @@ #ifndef lint -static const char RCSid[] = "$Id: rfluxmtx.c,v 2.52 2020/09/07 04:06:17 greg Exp $"; +static const char RCSid[] = "$Id: rfluxmtx.c,v 2.55 2023/11/15 18:02:53 greg Exp $"; #endif /* * Calculate flux transfer matrix or matrices using rcontrib @@ -740,8 +740,7 @@ sample_uniform(PARAMS *p, int b, FILE *fp) { int n = sampcnt; double samp3[3]; - double duvw[3]; - FVECT orig_dir[2]; + FVECT duvw, orig_dir[2]; int i; if (fp == NULL) /* just requesting number of bins? */ @@ -749,7 +748,7 @@ sample_uniform(PARAMS *p, int b, FILE *fp) while (n--) { /* stratified hemisphere sampling */ SDmultiSamp(samp3, 3, (n+frandom())/sampcnt); - SDsquare2disk(duvw, samp3[1], samp3[2]); + square2disk(duvw, samp3[1], samp3[2]); duvw[2] = -sqrt(1. - duvw[0]*duvw[0] - duvw[1]*duvw[1]); for (i = 3; i--; ) orig_dir[1][i] = duvw[0]*p->udir[i] + @@ -769,8 +768,7 @@ sample_shirchiu(PARAMS *p, int b, FILE *fp) { int n = sampcnt; double samp3[3]; - double duvw[3]; - FVECT orig_dir[2]; + FVECT duvw, orig_dir[2]; int i; if (fp == NULL) /* just requesting number of bins? */ @@ -778,7 +776,7 @@ sample_shirchiu(PARAMS *p, int b, FILE *fp) while (n--) { /* stratified sampling */ SDmultiSamp(samp3, 3, (n+frandom())/sampcnt); - SDsquare2disk(duvw, (b/p->hsiz + samp3[1])/curparams.hsiz, + square2disk(duvw, (b/p->hsiz + samp3[1])/curparams.hsiz, (b%p->hsiz + samp3[2])/curparams.hsiz); duvw[2] = sqrt(1. - duvw[0]*duvw[0] - duvw[1]*duvw[1]); for (i = 3; i--; ) @@ -1285,11 +1283,21 @@ main(int argc, char *argv[]) yrs = argv[++a]; na = 0; continue; - case 'c': /* number of samples */ - sampcnt = atoi(argv[++a]); - if (sampcnt <= 0) - goto userr; - na = 0; /* we re-add this later */ + case 'c': /* spectral sampling or count */ + switch (argv[a][2]) { + case 's': + na = 2; + break; + case 'w': + na = 3; + break; + case '\0': + sampcnt = atoi(argv[++a]); + if (sampcnt <= 0) + goto userr; + na = 0; /* we re-add this later */ + break; + } continue; case 'I': /* only for pass-through mode */ case 'i': @@ -1308,6 +1316,7 @@ main(int argc, char *argv[]) case 'n': /* options with 1 argument */ case 's': case 'o': + case 't': na = 2; break; case 'b': /* special case */