ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/util/rfluxmtx.c
(Generate patch)

Comparing ray/src/util/rfluxmtx.c (file contents):
Revision 2.52 by greg, Mon Sep 7 04:06:17 2020 UTC vs.
Revision 2.60 by greg, Tue Jun 3 21:31:51 2025 UTC

# Line 22 | Line 22 | static const char RCSid[] = "$Id$";
22   #define MAXRCARG        10000
23   #endif
24  
25 char            *progname;              /* global argv[0] */
26
25   int             verbose = 0;            /* verbose mode (< 0 no warnings) */
26  
27   char            *rcarg[MAXRCARG+1] = {"rcontrib", "-fo+"};
# Line 41 | Line 39 | char           *shirchiufn = "disk2square.cal";
39   char            *kfullfn = "klems_full.cal";
40   char            *khalffn = "klems_half.cal";
41   char            *kquarterfn = "klems_quarter.cal";
42 + char            *ciefn = "cieskyscan.cal";
43  
44                                          /* string indicating parameters */
45   const char      PARAMSTART[] = "@rfluxmtx";
# Line 499 | Line 498 | finish_receiver(void)
498                  calfn = kquarterfn; kquarterfn = NULL;
499                  binf = "kqbin";
500                  nbins = "Nkqbins";
501 +        } else if (!strcasecmp(curparams.hemis, "cie")) {
502 +                calfn = ciefn; ciefn = NULL;
503 +                sprintf(sbuf, "rNx=%g,rNy=%g,rNz=%g,Ux=%g,Uy=%g,Uz=%g,RHS=%c1",
504 +                        curparams.nrm[0], curparams.nrm[1], curparams.nrm[2],
505 +                        curparams.vup[0], curparams.vup[1], curparams.vup[2],
506 +                        curparams.sign);
507 +                binv = "cbin";
508 +                nbins = "Ncbins";
509          } else {
510                  fprintf(stderr, "%s: unrecognized hemisphere sampling: h=%s\n",
511                                  progname, curparams.hemis);
# Line 508 | Line 515 | finish_receiver(void)
515                  sprintf(sbuf, "RHS=%c1", curparams.sign);
516                  params = savqstr(sbuf);
517          }
518 <        if (!uniform & (curparams.slist->styp == ST_SOURCE)) {
518 >        if (!uniform) {
519                  SURF    *sp;
520                  for (sp = curparams.slist; sp != NULL; sp = sp->next)
521 <                        if (fabs(sp->area - PI) > 1e-3) {
521 >                        if (sp->styp == ST_SOURCE && fabs(sp->area - PI) > 1e-3) {
522                                  fprintf(stderr, "%s: source '%s' must be 180-degrees\n",
523                                                  progname, sp->sname);
524                                  exit(1);
# Line 740 | Line 747 | sample_uniform(PARAMS *p, int b, FILE *fp)
747   {
748          int     n = sampcnt;
749          double  samp3[3];
750 <        double  duvw[3];
744 <        FVECT   orig_dir[2];
750 >        FVECT   duvw, orig_dir[2];
751          int     i;
752  
753          if (fp == NULL)                 /* just requesting number of bins? */
# Line 749 | Line 755 | sample_uniform(PARAMS *p, int b, FILE *fp)
755  
756          while (n--) {                   /* stratified hemisphere sampling */
757                  SDmultiSamp(samp3, 3, (n+frandom())/sampcnt);
758 <                SDsquare2disk(duvw, samp3[1], samp3[2]);
758 >                square2disk(duvw, samp3[1], samp3[2]);
759                  duvw[2] = -sqrt(1. - duvw[0]*duvw[0] - duvw[1]*duvw[1]);
760                  for (i = 3; i--; )
761                          orig_dir[1][i] = duvw[0]*p->udir[i] +
# Line 769 | Line 775 | sample_shirchiu(PARAMS *p, int b, FILE *fp)
775   {
776          int     n = sampcnt;
777          double  samp3[3];
778 <        double  duvw[3];
773 <        FVECT   orig_dir[2];
778 >        FVECT   duvw, orig_dir[2];
779          int     i;
780  
781          if (fp == NULL)                 /* just requesting number of bins? */
# Line 778 | Line 783 | sample_shirchiu(PARAMS *p, int b, FILE *fp)
783  
784          while (n--) {                   /* stratified sampling */
785                  SDmultiSamp(samp3, 3, (n+frandom())/sampcnt);
786 <                SDsquare2disk(duvw, (b/p->hsiz + samp3[1])/curparams.hsiz,
786 >                square2disk(duvw, (b/p->hsiz + samp3[1])/curparams.hsiz,
787                                  (b%p->hsiz + samp3[2])/curparams.hsiz);
788                  duvw[2] = sqrt(1. - duvw[0]*duvw[0] - duvw[1]*duvw[1]);
789                  for (i = 3; i--; )
# Line 1097 | Line 1102 | add_recv_object(FILE *fp)
1102          }
1103                                          /* is it a new receiver? */
1104          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                }
1105                  if (strcmp(thismod, curmod)) {
1106                          if (curmod[0]) {        /* output last receiver? */
1107                                  finish_receiver();
# Line 1238 | Line 1237 | main(int argc, char *argv[])
1237          FILE    *rcfp;
1238          int     nsbins;
1239          int     a, i;
1240 +                                        /* set global progname */
1241 +        fixargv0(argv[0]);
1242                                          /* screen rcontrib options */
1242        progname = argv[0];
1243          for (a = 1; a < argc-2; a++) {
1244                  int     na;
1245                                          /* check for argument expansion */
# Line 1285 | Line 1285 | main(int argc, char *argv[])
1285                          yrs = argv[++a];
1286                          na = 0;
1287                          continue;
1288 <                case 'c':               /* number of samples */
1289 <                        sampcnt = atoi(argv[++a]);
1290 <                        if (sampcnt <= 0)
1291 <                                goto userr;
1292 <                        na = 0;         /* we re-add this later */
1293 <                        continue;
1288 >                case 'c':               /* spectral sampling or count */
1289 >                        switch (argv[a][2]) {
1290 >                        case 's':
1291 >                                na = 2;
1292 >                                break;
1293 >                        case 'w':
1294 >                                na = 3;
1295 >                                break;
1296 >                        case '\0':
1297 >                                sampcnt = atoi(argv[++a]);
1298 >                                if (sampcnt <= 0)
1299 >                                        goto userr;
1300 >                                na = 0;         /* we re-add this later */
1301 >                                continue;
1302 >                        }
1303 >                        break;
1304                  case 'I':               /* only for pass-through mode */
1305                  case 'i':
1306                          iropt = argv[a];
# Line 1308 | Line 1318 | main(int argc, char *argv[])
1318                  case 'n':               /* options with 1 argument */
1319                  case 's':
1320                  case 'o':
1321 +                case 't':
1322                          na = 2;
1323                          break;
1324                  case 'b':               /* special case */

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines