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 1.4 by greg, Thu Apr 18 15:18:20 1991 UTC vs.
Revision 1.5 by greg, Mon Apr 22 10:07:36 1991 UTC

# Line 239 | Line 239 | struct glare_dir       *gd;
239   * All vectors are assumed to be normalized.
240   * This function is an implementation of the method proposed by
241   * Robert Levin in his 1975 JIES article.
242 + * This calculation presumes the view direction and up vectors perpendicular.
243   * We return a value less than zero for improper positions.
244   */
245  
# Line 252 | Line 253 | FVECT  sd, vd, vu;
253          d = DOT(sd,vd);
254          if (d <= 0.0)
255                  return(-1.0);
256 +        if (d >= 1.0)
257 +                return(1.0);
258          sigma = acos(d) * (180./PI);
259 <        tau = acos(DOT(sd,vu)/sqrt(1.0-d*d)) * (180./PI);
259 >        d = DOT(sd,vu)/sqrt(1.0-d*d);
260 >        if (d >= 1.0)
261 >                tau = 0.0;
262 >        else
263 >                tau = acos(d) * (180./PI);
264          return( exp( sigma*( (35.2 - tau*.31889 - 1.22*exp(-.22222*tau))*1e-3
265                          + sigma*(21. + tau*(.26667 + tau*-.002963))*1e-5 )
266                  ) );

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines