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.104 by greg, Fri Jun 20 18:05:30 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 105 | Line 105 | trade_patchsamp(double ss[2])          /* trade in problem pat
105                  x = irandom(XLOTSIZ - (gterm[sclass] - gterm[sclass-1]));
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];

Diff Legend

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