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.43 by greg, Tue Feb 7 19:53:59 2017 UTC vs.
Revision 2.48 by greg, Mon Jul 29 22:52:39 2019 UTC

# Line 18 | Line 18 | static const char RCSid[] = "$Id$";
18   #include "triangulate.h"
19   #include "platform.h"
20  
21 < #define MAXRCARG        512
21 > #ifndef MAXRCARG
22 > #define MAXRCARG        10000
23 > #endif
24  
25   char            *progname;              /* global argv[0] */
26  
# Line 142 | Line 144 | oconv_command(int ac, char *av[])
144                  strcpy(cp, "-w- ");
145                  cp += 4;
146          }
147 <        while (ac-- > 0) {
148 <                strcpy(cp, *av++);
149 <                while (*cp) cp++;
148 <                *cp++ = ' ';
149 <                if (cp >= oconvbuf+(sizeof(oconvbuf)-32))
147 >        while (ac-- > 0) {      /* copy each argument */
148 >                int     len = strlen(*av);
149 >                if (cp+len+4 >= oconvbuf+sizeof(oconvbuf))
150                          goto overrun;
151 +                if (matchany(*av, SPECIALS)) {
152 +                        *cp++ = QUOTCHAR;
153 +                        strcpy(cp, *av++);
154 +                        cp += len;
155 +                        *cp++ = QUOTCHAR;
156 +                } else {
157 +                        strcpy(cp, *av++);
158 +                        cp += len;
159 +                }
160 +                *cp++ = ' ';
161          }
162                                  /* receiver goes last */
163          if (matchany(recv, SPECIALS)) {
# Line 383 | Line 393 | finish_receiver(void)
393                          curparams.vup[1] = 1;
394          }
395                                          /* determine sample type/bin */
396 <        if (tolower(curparams.hemis[0]) == 'u' | curparams.hemis[0] == '1') {
396 >        if ((tolower(curparams.hemis[0]) == 'u') | (curparams.hemis[0] == '1')) {
397                  sprintf(sbuf, "if(-Dx*%g-Dy*%g-Dz*%g,0,-1)",
398                          curparams.nrm[0], curparams.nrm[1], curparams.nrm[2]);
399                  binv = savqstr(sbuf);
# Line 659 | Line 669 | sample_origin(PARAMS *p, FVECT orig, const FVECT rdir,
669                  projsa[i] = -DOT(sp->snrm, rdir) * sp->area;
670                  tarea += projsa[i] *= (double)(projsa[i] > FTINY);
671          }
672 <        if (tarea <= FTINY) {           /* wrong side of sender? */
672 >        if (tarea < 0) {                /* wrong side of sender? */
673                  fputs(progname, stderr);
674                  fputs(": internal - sample behind all sender elements!\n",
675                                  stderr);
# Line 760 | Line 770 | sample_reinhart(PARAMS *p, int b, FILE *fp)
770          }
771          while (n--) {                   /* stratified sampling */
772                  SDmultiSamp(samp3, 3, (n+frandom())/sampcnt);
773 +                if (row >= RowMax-1)    /* avoid crowding at zenith */
774 +                        samp3[1] *= samp3[1];
775                  alt = (row+samp3[1])*RAH;
776                  azi = (2.*PI)*(col+samp3[2]-.5)/rnaz(row);
777                  duvw[2] = cos(alt);     /* measured from horizon */
778                  duvw[0] = tsin(azi)*duvw[2];
779 <                duvw[1] = tcos(azi)*duvw[2];
779 >                duvw[1] = -tcos(azi)*duvw[2];
780                  duvw[2] = sqrt(1. - duvw[2]*duvw[2]);
781                  for (i = 3; i--; )
782                          orig_dir[1][i] = -duvw[0]*p->udir[i] -
# Line 871 | Line 883 | prepare_sampler(void)
883                  curparams.udir[1] *= -1.;
884                  curparams.udir[2] *= -1.;
885          }
886 <        if (tolower(curparams.hemis[0]) == 'u' | curparams.hemis[0] == '1')
886 >        if ((tolower(curparams.hemis[0]) == 'u') | (curparams.hemis[0] == '1'))
887                  curparams.sample_basis = sample_uniform;
888          else if (tolower(curparams.hemis[0]) == 's' &&
889                                  tolower(curparams.hemis[1]) == 'c')

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines