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

Comparing ray/src/rt/ambcomp.c (file contents):
Revision 2.99 by greg, Sun Apr 27 20:20:01 2025 UTC vs.
Revision 2.100 by greg, Mon Apr 28 19:30:01 2025 UTC

# Line 146 | Line 146 | trade_patchsamp(double ss[2])          /* trade in problem pat
146                  x += (x >= gterm[sclass-1])*(gterm[sclass] - gterm[sclass-1]);
147                  break;
148          }
149 <        srep[0] = excharr[x][0];        /* save selected trade output */
149 >        srep[0] = excharr[x][0];        /* save selected replacement (result) */
150          srep[1] = excharr[x][1];
151 <                                        /* adjust our lot groups */
151 >                                        /* identify replacement class */
152          for (rclass = CFIRST; rclass < COTHER; rclass++)
153                  if (x < gterm[rclass])
154 <                        break;
155 <        if (sclass < rclass) {          /* submitted group before replacement? */
154 >                        break;          /* repark to keep classes grouped */
155 >        while (rclass > sclass) {       /* replacement group after submitted? */
156                  CXCOPY(x, gterm[rclass-1]);
157 <                while (--rclass > sclass) {
158 <                        CXCOPY(gterm[rclass], gterm[rclass-1]);
159 <                        ++gterm[rclass];
160 <                }
161 <                x = gterm[sclass]++;
162 <        } else if (sclass > rclass) {   /* submitted group after replacement? */
157 >                x = gterm[--rclass]++;
158 >        }
159 >        while (rclass < sclass) {       /* replacement group before submitted? */
160                  --gterm[rclass];
161                  CXCOPY(x, gterm[rclass]);
162 <                while (++rclass < sclass) {
166 <                        --gterm[rclass];
167 <                        CXCOPY(gterm[rclass-1], gterm[rclass]);
168 <                }
169 <                x = gterm[sclass-1];
162 >                x = gterm[rclass++];
163          }
164 <        excharr[x][0] = ss[0];          /* complete the transaction */
164 >        excharr[x][0] = ss[0];          /* complete the trade-in */
165          excharr[x][1] = ss[1];
166          ss[0] = srep[0];
167          ss[1] = srep[1];

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines