--- ray/src/util/glarendx.c 1995/06/04 10:58:38 2.5 +++ ray/src/util/glarendx.c 2003/11/19 16:21:28 2.9 @@ -1,9 +1,6 @@ -/* Copyright (c) 1991 Regents of the University of California */ - #ifndef lint -static char SCCSid[] = "$SunId$ LBL"; +static const char RCSid[] = "$Id: glarendx.c,v 2.9 2003/11/19 16:21:28 greg Exp $"; #endif - /* * Compute Glare Index given by program name or -t option: * @@ -22,6 +19,8 @@ static char SCCSid[] = "$SunId$ LBL"; * 19 April 1993 R. Compagnon EPFL (added dgi, brs_gi, ugr) */ +#include + #include "standard.h" #include "view.h" @@ -75,13 +74,12 @@ main(argc, argv) int argc; char *argv[]; { - extern char *rindex(); struct named_func *funp; char *progtail; int i; /* get program name */ progname = argv[0]; - progtail = rindex(progname, '/'); /* final component */ + progtail = strrchr(progname, '/'); /* final component */ if (progtail == NULL) progtail = progname; else @@ -127,6 +125,7 @@ userr: } +int headline(s) /* get line from header */ char *s; { @@ -140,6 +139,7 @@ char *s; formatval(fmt, s); wrongformat = strcmp(fmt, "ascii"); } + return(0); } @@ -310,7 +310,7 @@ struct glare_dir *gd; { register struct glare_src *gs; FVECT mydir,testdir[7],vhor; - double r,omega,p[7],sum; + double r,posn,omega,p[7],sum; int i,n; spinvector(mydir, midview.vdir, midview.vup, gd->ang); @@ -332,8 +332,11 @@ struct glare_dir *gd; fvsum(testdir[4],testdir[4],midview.vup,-0.866*r); for (i = 0; i < 7; i++) { normalize(testdir[i]); - p[i] = pow(posindex(testdir[i],mydir,midview.vup),-2.0); - if (p[i] <= FTINY) p[i] = 0.0; + posn = posindex(testdir[i],mydir,midview.vup); + if (posn <= FTINY) + p[i] = 0.0; + else + p[i] = 1./(posn*posn); } r = 1-gs->dom/2./PI; omega = gs->dom*p[0];