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

Comparing ray/src/gen/mksource.c (file contents):
Revision 2.7 by greg, Mon Aug 15 19:48:06 2011 UTC vs.
Revision 2.10 by greg, Mon Feb 6 22:40:21 2023 UTC

# Line 398 | Line 398 | getlost(LOSTLIGHT **llp, COLOR intens, FVECT cent, dou
398   void
399   mksources(TRITREE *samptree, double thresh, double maxang)
400   {
401 + #define MAXITER         100
402          const int       ethresh = (int)(log(thresh)/log(2.) + (COLXS+.5));
403          const double    maxomega = 2.*PI*(1. - cos(PI/180./2.*maxang));
404          const double    minintens = .05*thresh*maxomega;
405 +        int             niter = MAXITER;
406          int             nsrcs = 0;
407          LOSTLIGHT       *lostlightlist = NULL;
408          int             emax;
# Line 426 | Line 428 | mksources(TRITREE *samptree, double thresh, double max
428           */
429          if (thresh <= FTINY)
430                  return;
431 <        for ( ; ; ) {
431 >        while (niter--) {
432                  emax = ethresh;         /* find brightest unclaimed */
433                  startleaf = NULL;
434                  for (i = 0; i < NTRUNKBR; i++) {
# Line 457 | Line 459 | mksources(TRITREE *samptree, double thresh, double max
459                                                  thisethresh);
460                          if (normalize(vsum) == .0)
461                                  break;
462 <                        movedist = acos(DOT(vsum,curcent));
462 >                        movedist = Acos(DOT(vsum,curcent));
463                          if (movedist > growstep) {
464                                  VSUB(vsum, vsum, curcent);
465                                  movedist = growstep/VLEN(vsum);
# Line 489 | Line 491 | mksources(TRITREE *samptree, double thresh, double max
491                  printf("0\n0\n4 %f %f %f %f\n",
492                                  curcent[0], curcent[1], curcent[2],
493                                  2.*180./PI*currad);
494 +                niter = MAXITER;
495          }
496 + #undef MAXITER
497   }
498  
499   int
# Line 554 | Line 558 | userr:
558   }
559  
560   void
561 < eputs(char  *s)
561 > eputs(const char  *s)
562   {
563          static int  midline = 0;
564  
# Line 572 | Line 576 | eputs(char  *s)
576   }
577  
578   void
579 < wputs(char *s)
579 > wputs(const char *s)
580   {
581          /* no warnings */
582   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines