ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/Development/ray/src/rt/ambcomp.c
(Generate patch)

Comparing ray/src/rt/ambcomp.c (file contents):
Revision 2.103 by greg, Fri Jun 20 16:48:39 2025 UTC vs.
Revision 2.105 by greg, Thu Aug 21 20:38:41 2025 UTC

# Line 25 | Line 25 | static const char      RCSid[] = "$Id$";
25   #define MINADIV         7       /* minimum # divisions in each dimension */
26   #endif
27   #ifndef MINSDIST
28 < #define MINSDIST        0.25    /* def. min. spacing = 1/4th division */
28 > #define MINSDIST        0.2     /* def. min. spacing = 1/5th division */
29   #endif
30  
31   typedef struct {
# Line 81 | Line 81 | static void
81   trade_patchsamp(double ss[2])           /* trade in problem patch position */
82   {
83          static float    tradelot[XLOTSIZ][2];
84 <        static short    gterm[COTHER+1];
84 >        static int      gterm[COTHER+1];
85          double          repl[2];
86          int             sclass, rclass;
87          int             x;
88 <                                        /* initialize lot? */
88 > re_initialize:                          /* initialize lot? */
89          while (gterm[COTHER] < XLOTSIZ) {
90                  tradelot[gterm[COTHER]][0] = frandom();
91                  tradelot[gterm[COTHER]][1] = frandom();
# Line 106 | Line 106 | trade_patchsamp(double ss[2])          /* trade in problem pat
106                  x += (x >= gterm[sclass-1])*(gterm[sclass] - gterm[sclass-1]);
107                  break;
108          }
109 +        if (x >= XLOTSIZ) {             /* uh-oh... trapped in a corner! */
110 +                memset(gterm, 0, sizeof(gterm));
111 +                goto re_initialize;
112 +        }
113          repl[0] = tradelot[x][0];       /* save selected replacement (result) */
114          repl[1] = tradelot[x][1];
115                                          /* identify replacement class */
# Line 217 | Line 221 | ambsample(                             /* initial ambient division sample */
221                                  spt[1]*hp->uy[ii] +
222                                  zd*hp->onrm[ii];
223          checknorm(ar.rdir);
224 <        dimlist[ndims_inc] = AI(hp,i,j) + 90171;
224 >        dimlist[ndims_inc()] = AI(hp,i,j) + 90171;
225          rayvalue(&ar);                  /* evaluate ray */
226 <        dec_ndims;
226 >        dec_ndims();
227          zd = raydistance(&ar);
228          if (zd <= FTINY)
229                  return(0);              /* should never happen */

Diff Legend

Removed lines
+ Added lines
< Changed lines (old)
> Changed lines (new)