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

Comparing ray/src/hd/rholo3.c (file contents):
Revision 3.14 by gregl, Thu Dec 18 14:46:00 1997 UTC vs.
Revision 3.17 by gregl, Wed Dec 31 20:24:11 1997 UTC

# Line 191 | Line 191 | int    bi;
191                  VSUM(edgeA, cp[1], cp[0], -1.0);
192                  VSUM(edgeB, cp[3], cp[1], -1.0);
193                  fcross(crossp[i], edgeA, edgeB);
194                VSUM(edgeA, cp[2], cp[3], -1.0);
195                VSUM(edgeB, cp[0], cp[2], -1.0);
196                fcross(v, edgeA, edgeB);
197                VSUM(crossp[i], crossp[i], v, 1.0);
194                                          /* compute center */
195                  cent[i][0] = 0.5*(cp[0][0] + cp[2][0]);
196                  cent[i][1] = 0.5*(cp[0][1] + cp[2][1]);
# Line 203 | Line 199 | int    bi;
199                                          /* compute difference vector */
200          VSUM(diffv, cent[1], cent[0], -1.0);
201          for (i = 0; i < 2; i++) {       /* compute volume contributions */
202 <                vol[i] = 0.25*DOT(crossp[i], diffv);
202 >                vol[i] = 0.5*DOT(crossp[i], diffv);
203                  if (vol[i] < 0.) vol[i] = -vol[i];
204          }
205          return(vol[0] + vol[1]);        /* return total volume */
# Line 231 | Line 227 | init_global()                  /* initialize global ray computation *
227          for (j = 0; hdlist[j] != NULL; j++) {
228                  frac = 512. * hdlist[j]->wg[0] *
229                                  hdlist[j]->wg[1] * hdlist[j]->wg[2];
230 +                if (frac < 0.) frac = -frac;
231                  for (i = nbeams(hdlist[j]); i > 0; i--) {
232                          complist[k].hd = j;
233                          complist[k].bi = i;
# Line 250 | Line 247 | init_global()                  /* initialize global ray computation *
247  
248  
249   mergeclists(cdest, cl1, n1, cl2, n2)    /* merge two sorted lists */
250 < PACKHEAD        *cdest;
251 < PACKHEAD        *cl1, *cl2;
250 > register PACKHEAD       *cdest;
251 > register PACKHEAD       *cl1, *cl2;
252   int     n1, n2;
253   {
254 <        int     cmp;
254 >        register int    cmp;
255  
256          while (n1 | n2) {
257                  if (!n1) cmp = 1;
# Line 319 | Line 316 | sortcomplist()                 /* fix our list order */
316   * list and start again from the beginning.  Since
317   * a merge sort is used, the sorting costs are minimal.
318   */
319 < next_packet(p)                  /* prepare packet for computation */
319 > next_packet(p, n)               /* prepare packet for computation */
320   register PACKET *p;
321 + int     n;
322   {
323          register int    i;
324  
# Line 334 | Line 332 | register PACKET        *p;
332          p->nr = complist[listpos].nr - p->nc;
333          if (p->nr <= 0)
334                  return(0);
335 <        if (p->nr > RPACKSIZ)
336 <                p->nr = RPACKSIZ;
335 > #ifdef DEBUG
336 >        if (n < 1 | n > RPACKSIZ)
337 >                error(CONSISTENCY, "next_packet called with bad n value");
338 > #endif
339 >        if (p->nr > n)
340 >                p->nr = n;
341          complist[listpos].nc += p->nr;  /* find where this one would go */
342          while (lastin > listpos &&
343                          beamcmp(complist+lastin, complist+listpos) > 0)

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines