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.51 by greg, Mon Mar 2 22:00:05 2020 UTC vs.
Revision 2.57 by greg, Tue Mar 19 10:48:05 2024 UTC

# Line 41 | Line 41 | char           *shirchiufn = "disk2square.cal";
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";
# Line 499 | Line 500 | finish_receiver(void)
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);
# Line 720 | Line 729 | sample_origin(PARAMS *p, FVECT orig, const FVECT rdir,
729                                          /* compute projected areas */
730          for (i = 0, sp = p->slist; sp != NULL; i++, sp = sp->next) {
731                  projsa[i] = -DOT(sp->snrm, rdir) * sp->area;
732 <                tarea += projsa[i] *= (double)(projsa[i] > FTINY);
732 >                tarea += projsa[i] *= (double)(projsa[i] > 0);
733          }
734 <        if (tarea < 0) {                /* wrong side of sender? */
734 >        if (tarea < FTINY*FTINY) {      /* wrong side of sender? */
735                  fputs(progname, stderr);
736                  fputs(": internal - sample behind all sender elements!\n",
737                                  stderr);
# Line 740 | Line 749 | sample_uniform(PARAMS *p, int b, FILE *fp)
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? */
# Line 749 | Line 757 | sample_uniform(PARAMS *p, int b, FILE *fp)
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] +
# Line 769 | Line 777 | sample_shirchiu(PARAMS *p, int b, FILE *fp)
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? */
# Line 778 | Line 785 | sample_shirchiu(PARAMS *p, int b, FILE *fp)
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--; )
# Line 997 | Line 1004 | finish_polygon(SURF *p)
1004                  VCOPY(e1, e2);
1005          }
1006          p->area = normalize(p->snrm)*0.5;
1007 <        return(p->area > FTINY);
1007 >        return(p->area > FTINY*FTINY);
1008   }
1009  
1010   /* Add a surface to our current parameters */
# Line 1060 | Line 1067 | add_surface(int st, const char *oname, FILE *fp)
1067                  snew->area *= PI*snew->area;
1068                  break;
1069          }
1070 <        if ((snew->area <= FTINY) & (verbose >= 0)) {
1070 >        if ((snew->area <= FTINY*FTINY) & (verbose >= 0)) {
1071                  fprintf(stderr, "%s: warning - zero area for surface '%s'\n",
1072                                  progname, oname);
1073                  free(snew);
# Line 1285 | Line 1292 | main(int argc, char *argv[])
1292                          yrs = argv[++a];
1293                          na = 0;
1294                          continue;
1295 <                case 'c':               /* number of samples */
1296 <                        sampcnt = atoi(argv[++a]);
1297 <                        if (sampcnt <= 0)
1298 <                                goto userr;
1299 <                        na = 0;         /* we re-add this later */
1300 <                        continue;
1295 >                case 'c':               /* spectral sampling or count */
1296 >                        switch (argv[a][2]) {
1297 >                        case 's':
1298 >                                na = 2;
1299 >                                break;
1300 >                        case 'w':
1301 >                                na = 3;
1302 >                                break;
1303 >                        case '\0':
1304 >                                sampcnt = atoi(argv[++a]);
1305 >                                if (sampcnt <= 0)
1306 >                                        goto userr;
1307 >                                na = 0;         /* we re-add this later */
1308 >                                continue;
1309 >                        }
1310 >                        break;
1311                  case 'I':               /* only for pass-through mode */
1312                  case 'i':
1313                          iropt = argv[a];
# Line 1308 | Line 1325 | main(int argc, char *argv[])
1325                  case 'n':               /* options with 1 argument */
1326                  case 's':
1327                  case 'o':
1328 +                case 't':
1329                          na = 2;
1330                          break;
1331                  case 'b':               /* special case */

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines