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

Comparing ray/src/util/glarendx.c (file contents):
Revision 2.5 by greg, Sun Jun 4 10:58:38 1995 UTC vs.
Revision 2.9 by greg, Wed Nov 19 16:21:28 2003 UTC

# Line 1 | Line 1
1 /* Copyright (c) 1991 Regents of the University of California */
2
1   #ifndef lint
2 < static char SCCSid[] = "$SunId$ LBL";
2 > static const char       RCSid[] = "$Id$";
3   #endif
6
4   /*
5   * Compute Glare Index given by program name or -t option:
6   *
# Line 22 | Line 19 | static char SCCSid[] = "$SunId$ LBL";
19   *              19 April 1993   R. Compagnon    EPFL (added dgi, brs_gi, ugr)
20   */
21  
22 + #include <string.h>
23 +
24   #include "standard.h"
25   #include "view.h"
26  
# Line 75 | Line 74 | main(argc, argv)
74   int     argc;
75   char    *argv[];
76   {
78        extern char     *rindex();
77          struct named_func       *funp;
78          char    *progtail;
79          int     i;
80                                          /* get program name */
81          progname = argv[0];
82 <        progtail = rindex(progname, '/');       /* final component */
82 >        progtail = strrchr(progname, '/');      /* final component */
83          if (progtail == NULL)
84                  progtail = progname;
85          else
# Line 127 | Line 125 | userr:
125   }
126  
127  
128 + int
129   headline(s)                     /* get line from header */
130   char    *s;
131   {
# Line 140 | Line 139 | char   *s;
139                  formatval(fmt, s);
140                  wrongformat = strcmp(fmt, "ascii");
141          }
142 +        return(0);
143   }
144  
145  
# Line 310 | Line 310 | struct glare_dir       *gd;
310   {
311          register struct glare_src       *gs;
312          FVECT   mydir,testdir[7],vhor;
313 <        double  r,omega,p[7],sum;
313 >        double  r,posn,omega,p[7],sum;
314          int     i,n;
315  
316          spinvector(mydir, midview.vdir, midview.vup, gd->ang);
# Line 332 | Line 332 | struct glare_dir       *gd;
332                  fvsum(testdir[4],testdir[4],midview.vup,-0.866*r);
333                  for (i = 0; i < 7; i++) {
334                          normalize(testdir[i]);
335 <                        p[i] = pow(posindex(testdir[i],mydir,midview.vup),-2.0);
336 <                        if (p[i] <= FTINY) p[i] = 0.0;
335 >                        posn = posindex(testdir[i],mydir,midview.vup);
336 >                        if (posn <= FTINY)
337 >                                p[i] = 0.0;
338 >                        else
339 >                                p[i] = 1./(posn*posn);
340                  }
341                  r = 1-gs->dom/2./PI;
342                  omega = gs->dom*p[0];

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines