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

Comparing ray/src/cv/mgflib/fvect.c (file contents):
Revision 1.1 by greg, Tue Jun 21 14:45:44 1994 UTC vs.
Revision 1.2 by greg, Thu Jun 23 23:02:45 1994 UTC

# Line 19 | Line 19 | register FVECT  v;
19   {
20          static double  len;
21          
22 <        len = v[0]*v[0] + v[1]*v[1] + v[2]*v[2];
22 >        len = DOT(v, v);
23          
24          if (len <= 0.0)
25                  return(0.0);
26          
27 <        len = sqrt(len);
27 >        if (len <= 1.0+FTINY && len >= 1.0-FTINY)
28 >                len = 0.5 + 0.5*len;    /* first order approximation */
29 >        else
30 >                len = sqrt(len);
31  
32          v[0] /= len;
33          v[1] /= len;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines